Skip to content

Commit 6b3dccd

Browse files
chuckleverJ. Bruce Fields
authored andcommitted
NFSD: Add missing NFSv2 .pc_func methods
There's no protection in nfsd_dispatch() against a NULL .pc_func helpers. A malicious NFS client can trigger a crash by invoking the unused/unsupported NFSv2 ROOT or WRITECACHE procedures. The current NFSD dispatcher does not support returning a void reply to a non-NULL procedure, so the reply to both of these is wrong, for the moment. Cc: <stable@vger.kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
1 parent 1395616 commit 6b3dccd

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎fs/nfsd/nfsproc.c‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ nfsd_proc_setattr(struct svc_rqst *rqstp)
118118
return nfsd_return_attrs(nfserr, resp);
119119
}
120120

121+
/* Obsolete, replaced by MNTPROC_MNT. */
122+
static __be32
123+
nfsd_proc_root(struct svc_rqst *rqstp)
124+
{
125+
return nfs_ok;
126+
}
127+
121128
/*
122129
* Look up a path name component
123130
* Note: the dentry in the resp->fh may be negative if the file
@@ -203,6 +210,13 @@ nfsd_proc_read(struct svc_rqst *rqstp)
203210
return fh_getattr(&resp->fh, &resp->stat);
204211
}
205212

213+
/* Reserved */
214+
static __be32
215+
nfsd_proc_writecache(struct svc_rqst *rqstp)
216+
{
217+
return nfs_ok;
218+
}
219+
206220
/*
207221
* Write data to a file
208222
* N.B. After this call resp->fh needs an fh_put
@@ -617,6 +631,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
617631
.pc_xdrressize = ST+AT,
618632
},
619633
[NFSPROC_ROOT] = {
634+
.pc_func = nfsd_proc_root,
620635
.pc_decode = nfssvc_decode_void,
621636
.pc_encode = nfssvc_encode_void,
622637
.pc_argsize = sizeof(struct nfsd_void),
@@ -654,6 +669,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
654669
.pc_xdrressize = ST+AT+1+NFSSVC_MAXBLKSIZE_V2/4,
655670
},
656671
[NFSPROC_WRITECACHE] = {
672+
.pc_func = nfsd_proc_writecache,
657673
.pc_decode = nfssvc_decode_void,
658674
.pc_encode = nfssvc_encode_void,
659675
.pc_argsize = sizeof(struct nfsd_void),

0 commit comments

Comments
 (0)