mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-25 07:43:59 +00:00
NFSv4: Check for NULL argument in nfs_*_seqid() functions
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
This commit is contained in:
parent
badc76dd0d
commit
a67964197c
2 changed files with 18 additions and 8 deletions
|
@ -1015,7 +1015,7 @@ void nfs_release_seqid(struct nfs_seqid *seqid)
|
||||||
{
|
{
|
||||||
struct nfs_seqid_counter *sequence;
|
struct nfs_seqid_counter *sequence;
|
||||||
|
|
||||||
if (list_empty(&seqid->list))
|
if (seqid == NULL || list_empty(&seqid->list))
|
||||||
return;
|
return;
|
||||||
sequence = seqid->sequence;
|
sequence = seqid->sequence;
|
||||||
spin_lock(&sequence->lock);
|
spin_lock(&sequence->lock);
|
||||||
|
@ -1071,13 +1071,15 @@ static void nfs_increment_seqid(int status, struct nfs_seqid *seqid)
|
||||||
|
|
||||||
void nfs_increment_open_seqid(int status, struct nfs_seqid *seqid)
|
void nfs_increment_open_seqid(int status, struct nfs_seqid *seqid)
|
||||||
{
|
{
|
||||||
struct nfs4_state_owner *sp = container_of(seqid->sequence,
|
struct nfs4_state_owner *sp;
|
||||||
struct nfs4_state_owner, so_seqid);
|
|
||||||
struct nfs_server *server = sp->so_server;
|
|
||||||
|
|
||||||
|
if (seqid == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
sp = container_of(seqid->sequence, struct nfs4_state_owner, so_seqid);
|
||||||
if (status == -NFS4ERR_BAD_SEQID)
|
if (status == -NFS4ERR_BAD_SEQID)
|
||||||
nfs4_drop_state_owner(sp);
|
nfs4_drop_state_owner(sp);
|
||||||
if (!nfs4_has_session(server->nfs_client))
|
if (!nfs4_has_session(sp->so_server->nfs_client))
|
||||||
nfs_increment_seqid(status, seqid);
|
nfs_increment_seqid(status, seqid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1088,14 +1090,18 @@ void nfs_increment_open_seqid(int status, struct nfs_seqid *seqid)
|
||||||
*/
|
*/
|
||||||
void nfs_increment_lock_seqid(int status, struct nfs_seqid *seqid)
|
void nfs_increment_lock_seqid(int status, struct nfs_seqid *seqid)
|
||||||
{
|
{
|
||||||
|
if (seqid != NULL)
|
||||||
nfs_increment_seqid(status, seqid);
|
nfs_increment_seqid(status, seqid);
|
||||||
}
|
}
|
||||||
|
|
||||||
int nfs_wait_on_sequence(struct nfs_seqid *seqid, struct rpc_task *task)
|
int nfs_wait_on_sequence(struct nfs_seqid *seqid, struct rpc_task *task)
|
||||||
{
|
{
|
||||||
struct nfs_seqid_counter *sequence = seqid->sequence;
|
struct nfs_seqid_counter *sequence;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
||||||
|
if (seqid == NULL)
|
||||||
|
goto out;
|
||||||
|
sequence = seqid->sequence;
|
||||||
spin_lock(&sequence->lock);
|
spin_lock(&sequence->lock);
|
||||||
seqid->task = task;
|
seqid->task = task;
|
||||||
if (list_empty(&seqid->list))
|
if (list_empty(&seqid->list))
|
||||||
|
@ -1106,6 +1112,7 @@ int nfs_wait_on_sequence(struct nfs_seqid *seqid, struct rpc_task *task)
|
||||||
status = -EAGAIN;
|
status = -EAGAIN;
|
||||||
unlock:
|
unlock:
|
||||||
spin_unlock(&sequence->lock);
|
spin_unlock(&sequence->lock);
|
||||||
|
out:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -946,7 +946,10 @@ static void encode_uint64(struct xdr_stream *xdr, u64 n)
|
||||||
static void encode_nfs4_seqid(struct xdr_stream *xdr,
|
static void encode_nfs4_seqid(struct xdr_stream *xdr,
|
||||||
const struct nfs_seqid *seqid)
|
const struct nfs_seqid *seqid)
|
||||||
{
|
{
|
||||||
|
if (seqid != NULL)
|
||||||
encode_uint32(xdr, seqid->sequence->counter);
|
encode_uint32(xdr, seqid->sequence->counter);
|
||||||
|
else
|
||||||
|
encode_uint32(xdr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void encode_compound_hdr(struct xdr_stream *xdr,
|
static void encode_compound_hdr(struct xdr_stream *xdr,
|
||||||
|
|
Loading…
Add table
Reference in a new issue