Skip to content

Commit 3552c37

Browse files
committed
Merge tag 'nfsd-5.10-1' of git://linux-nfs.org/~bfields/linux
Pull nfsd fixes from Bruce Fields: "This is mainly server-to-server copy and fallout from Chuck's 5.10 rpc refactoring" * tag 'nfsd-5.10-1' of git://linux-nfs.org/~bfields/linux: net/sunrpc: fix useless comparison in proc_do_xprt() net/sunrpc: return 0 on attempt to write to "transports" NFSD: fix missing refcount in nfsd4_copy by nfsd4_do_async_copy NFSD: Fix use-after-free warning when doing inter-server copy NFSD: MKNOD should return NFSERR_BADTYPE instead of NFSERR_INVAL SUNRPC: Fix general protection fault in trace_rpc_xdr_overflow() NFSD: NFSv3 PATHCONF Reply is improperly formed
2 parents 91808cd + ae29750 commit 3552c37

File tree

5 files changed

+13
-14
lines changed

5 files changed

+13
-14
lines changed

fs/nfsd/nfs3proc.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,6 @@ nfsd3_proc_mknod(struct svc_rqst *rqstp)
316316
fh_copy(&resp->dirfh, &argp->fh);
317317
fh_init(&resp->fh, NFS3_FHSIZE);
318318

319-
if (argp->ftype == 0 || argp->ftype >= NF3BAD) {
320-
resp->status = nfserr_inval;
321-
goto out;
322-
}
323319
if (argp->ftype == NF3CHR || argp->ftype == NF3BLK) {
324320
rdev = MKDEV(argp->major, argp->minor);
325321
if (MAJOR(rdev) != argp->major ||
@@ -328,7 +324,7 @@ nfsd3_proc_mknod(struct svc_rqst *rqstp)
328324
goto out;
329325
}
330326
} else if (argp->ftype != NF3SOCK && argp->ftype != NF3FIFO) {
331-
resp->status = nfserr_inval;
327+
resp->status = nfserr_badtype;
332328
goto out;
333329
}
334330

fs/nfsd/nfs3xdr.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,7 @@ nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, __be32 *p)
11141114
{
11151115
struct nfsd3_pathconfres *resp = rqstp->rq_resp;
11161116

1117+
*p++ = resp->status;
11171118
*p++ = xdr_zero; /* no post_op_attr */
11181119

11191120
if (resp->status == 0) {

fs/nfsd/nfs4proc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1299,7 +1299,7 @@ nfsd4_cleanup_inter_ssc(struct vfsmount *ss_mnt, struct nfsd_file *src,
12991299
struct nfsd_file *dst)
13001300
{
13011301
nfs42_ssc_close(src->nf_file);
1302-
nfsd_file_put(src);
1302+
/* 'src' is freed by nfsd4_do_async_copy */
13031303
nfsd_file_put(dst);
13041304
mntput(ss_mnt);
13051305
}
@@ -1486,6 +1486,7 @@ static int nfsd4_do_async_copy(void *data)
14861486
cb_copy = kzalloc(sizeof(struct nfsd4_copy), GFP_KERNEL);
14871487
if (!cb_copy)
14881488
goto out;
1489+
refcount_set(&cb_copy->refcount, 1);
14891490
memcpy(&cb_copy->cp_res, &copy->cp_res, sizeof(copy->cp_res));
14901491
cb_copy->cp_clp = copy->cp_clp;
14911492
cb_copy->nfserr = copy->nfserr;

include/trace/events/sunrpc.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -655,10 +655,10 @@ TRACE_EVENT(rpc_xdr_overflow,
655655
__field(size_t, tail_len)
656656
__field(unsigned int, page_len)
657657
__field(unsigned int, len)
658-
__string(progname,
659-
xdr->rqst->rq_task->tk_client->cl_program->name)
660-
__string(procedure,
661-
xdr->rqst->rq_task->tk_msg.rpc_proc->p_name)
658+
__string(progname, xdr->rqst ?
659+
xdr->rqst->rq_task->tk_client->cl_program->name : "unknown")
660+
__string(procedure, xdr->rqst ?
661+
xdr->rqst->rq_task->tk_msg.rpc_proc->p_name : "unknown")
662662
),
663663

664664
TP_fast_assign(

net/sunrpc/sysctl.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,20 @@ static int proc_do_xprt(struct ctl_table *table, int write,
6363
void *buffer, size_t *lenp, loff_t *ppos)
6464
{
6565
char tmpbuf[256];
66-
size_t len;
66+
ssize_t len;
6767

68-
if ((*ppos && !write) || !*lenp) {
68+
if (write || *ppos) {
6969
*lenp = 0;
7070
return 0;
7171
}
7272
len = svc_print_xprts(tmpbuf, sizeof(tmpbuf));
73-
*lenp = memory_read_from_buffer(buffer, *lenp, ppos, tmpbuf, len);
73+
len = memory_read_from_buffer(buffer, *lenp, ppos, tmpbuf, len);
7474

75-
if (*lenp < 0) {
75+
if (len < 0) {
7676
*lenp = 0;
7777
return -EINVAL;
7878
}
79+
*lenp = len;
7980
return 0;
8081
}
8182

0 commit comments

Comments
 (0)