diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-09-02 13:58:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-09-02 13:58:11 -0400 |
commit | e77295dc9e6b52281ae85af4068f13752524e9f4 (patch) | |
tree | fca6b723f6c91f2af79b28f05c05e114720fbe66 /net | |
parent | 1136cf11066a32d4ac2a476dac302858d763703d (diff) | |
parent | 91b80969ba466ba4b915a4a1d03add8c297add3f (diff) |
Merge branch 'for-2.6.27' of git://linux-nfs.org/~bfields/linux
* 'for-2.6.27' of git://linux-nfs.org/~bfields/linux:
nfsd: fix buffer overrun decoding NFSv4 acl
sunrpc: fix possible overrun on read of /proc/sys/sunrpc/transports
nfsd: fix compound state allocation error handling
svcrdma: Fix race between svc_rdma_recvfrom thread and the dto_tasklet
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/sysctl.c | 18 | ||||
-rw-r--r-- | net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 8 | ||||
-rw-r--r-- | net/sunrpc/xprtrdma/svc_rdma_transport.c | 5 |
3 files changed, 10 insertions, 21 deletions
diff --git a/net/sunrpc/sysctl.c b/net/sunrpc/sysctl.c index 0f8c439b848a..5231f7aaac0e 100644 --- a/net/sunrpc/sysctl.c +++ b/net/sunrpc/sysctl.c | |||
@@ -60,24 +60,14 @@ static int proc_do_xprt(ctl_table *table, int write, struct file *file, | |||
60 | void __user *buffer, size_t *lenp, loff_t *ppos) | 60 | void __user *buffer, size_t *lenp, loff_t *ppos) |
61 | { | 61 | { |
62 | char tmpbuf[256]; | 62 | char tmpbuf[256]; |
63 | int len; | 63 | size_t len; |
64 | |||
64 | if ((*ppos && !write) || !*lenp) { | 65 | if ((*ppos && !write) || !*lenp) { |
65 | *lenp = 0; | 66 | *lenp = 0; |
66 | return 0; | 67 | return 0; |
67 | } | 68 | } |
68 | if (write) | 69 | len = svc_print_xprts(tmpbuf, sizeof(tmpbuf)); |
69 | return -EINVAL; | 70 | return simple_read_from_buffer(buffer, *lenp, ppos, tmpbuf, len); |
70 | else { | ||
71 | len = svc_print_xprts(tmpbuf, sizeof(tmpbuf)); | ||
72 | if (!access_ok(VERIFY_WRITE, buffer, len)) | ||
73 | return -EFAULT; | ||
74 | |||
75 | if (__copy_to_user(buffer, tmpbuf, len)) | ||
76 | return -EFAULT; | ||
77 | } | ||
78 | *lenp -= len; | ||
79 | *ppos += len; | ||
80 | return 0; | ||
81 | } | 71 | } |
82 | 72 | ||
83 | static int | 73 | static int |
diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c index b4b17f44cb29..74de31a06616 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | |||
@@ -443,18 +443,18 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp) | |||
443 | 443 | ||
444 | dprintk("svcrdma: rqstp=%p\n", rqstp); | 444 | dprintk("svcrdma: rqstp=%p\n", rqstp); |
445 | 445 | ||
446 | spin_lock_bh(&rdma_xprt->sc_read_complete_lock); | 446 | spin_lock_bh(&rdma_xprt->sc_rq_dto_lock); |
447 | if (!list_empty(&rdma_xprt->sc_read_complete_q)) { | 447 | if (!list_empty(&rdma_xprt->sc_read_complete_q)) { |
448 | ctxt = list_entry(rdma_xprt->sc_read_complete_q.next, | 448 | ctxt = list_entry(rdma_xprt->sc_read_complete_q.next, |
449 | struct svc_rdma_op_ctxt, | 449 | struct svc_rdma_op_ctxt, |
450 | dto_q); | 450 | dto_q); |
451 | list_del_init(&ctxt->dto_q); | 451 | list_del_init(&ctxt->dto_q); |
452 | } | 452 | } |
453 | spin_unlock_bh(&rdma_xprt->sc_read_complete_lock); | 453 | if (ctxt) { |
454 | if (ctxt) | 454 | spin_unlock_bh(&rdma_xprt->sc_rq_dto_lock); |
455 | return rdma_read_complete(rqstp, ctxt); | 455 | return rdma_read_complete(rqstp, ctxt); |
456 | } | ||
456 | 457 | ||
457 | spin_lock_bh(&rdma_xprt->sc_rq_dto_lock); | ||
458 | if (!list_empty(&rdma_xprt->sc_rq_dto_q)) { | 458 | if (!list_empty(&rdma_xprt->sc_rq_dto_q)) { |
459 | ctxt = list_entry(rdma_xprt->sc_rq_dto_q.next, | 459 | ctxt = list_entry(rdma_xprt->sc_rq_dto_q.next, |
460 | struct svc_rdma_op_ctxt, | 460 | struct svc_rdma_op_ctxt, |
diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c index 19ddc382b777..900cb69728c6 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c | |||
@@ -359,11 +359,11 @@ static void sq_cq_reap(struct svcxprt_rdma *xprt) | |||
359 | if (test_bit(RDMACTXT_F_LAST_CTXT, &ctxt->flags)) { | 359 | if (test_bit(RDMACTXT_F_LAST_CTXT, &ctxt->flags)) { |
360 | struct svc_rdma_op_ctxt *read_hdr = ctxt->read_hdr; | 360 | struct svc_rdma_op_ctxt *read_hdr = ctxt->read_hdr; |
361 | BUG_ON(!read_hdr); | 361 | BUG_ON(!read_hdr); |
362 | spin_lock_bh(&xprt->sc_rq_dto_lock); | ||
362 | set_bit(XPT_DATA, &xprt->sc_xprt.xpt_flags); | 363 | set_bit(XPT_DATA, &xprt->sc_xprt.xpt_flags); |
363 | spin_lock_bh(&xprt->sc_read_complete_lock); | ||
364 | list_add_tail(&read_hdr->dto_q, | 364 | list_add_tail(&read_hdr->dto_q, |
365 | &xprt->sc_read_complete_q); | 365 | &xprt->sc_read_complete_q); |
366 | spin_unlock_bh(&xprt->sc_read_complete_lock); | 366 | spin_unlock_bh(&xprt->sc_rq_dto_lock); |
367 | svc_xprt_enqueue(&xprt->sc_xprt); | 367 | svc_xprt_enqueue(&xprt->sc_xprt); |
368 | } | 368 | } |
369 | svc_rdma_put_context(ctxt, 0); | 369 | svc_rdma_put_context(ctxt, 0); |
@@ -428,7 +428,6 @@ static struct svcxprt_rdma *rdma_create_xprt(struct svc_serv *serv, | |||
428 | init_waitqueue_head(&cma_xprt->sc_send_wait); | 428 | init_waitqueue_head(&cma_xprt->sc_send_wait); |
429 | 429 | ||
430 | spin_lock_init(&cma_xprt->sc_lock); | 430 | spin_lock_init(&cma_xprt->sc_lock); |
431 | spin_lock_init(&cma_xprt->sc_read_complete_lock); | ||
432 | spin_lock_init(&cma_xprt->sc_rq_dto_lock); | 431 | spin_lock_init(&cma_xprt->sc_rq_dto_lock); |
433 | 432 | ||
434 | cma_xprt->sc_ord = svcrdma_ord; | 433 | cma_xprt->sc_ord = svcrdma_ord; |