The patch titled SUNRPC: fix race in in-kernel RPC portmapper client has been added to the -mm tree. Its filename is sunrpc-fix-race-in-in-kernel-rpc-portmapper-client.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: SUNRPC: fix race in in-kernel RPC portmapper client From: Chuck Lever <chuck.lever@xxxxxxxxxx> When submitting a request to a fast portmapper (such as the local rpcbind daemon), the request can complete before the parent task is even queued up on xprt->binding. Fix this by queuing before submitting the rpcbind request. Test plan: Connectathon locking test with UDP. Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx> Signed-off-by: Trond Myklebust <Trond.Myklebust@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- net/sunrpc/pmap_clnt.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff -puN net/sunrpc/pmap_clnt.c~sunrpc-fix-race-in-in-kernel-rpc-portmapper-client net/sunrpc/pmap_clnt.c --- a/net/sunrpc/pmap_clnt.c~sunrpc-fix-race-in-in-kernel-rpc-portmapper-client +++ a/net/sunrpc/pmap_clnt.c @@ -101,11 +101,13 @@ void rpc_getport(struct rpc_task *task) /* Autobind on cloned rpc clients is discouraged */ BUG_ON(clnt->cl_parent != clnt); - if (xprt_test_and_set_binding(xprt)) { - task->tk_status = -EACCES; /* tell caller to check again */ - rpc_sleep_on(&xprt->binding, task, NULL, NULL); - return; - } + /* Put self on queue before sending rpcbind request, in case + * pmap_getport_done completes before we return from rpc_run_task */ + rpc_sleep_on(&xprt->binding, task, NULL, NULL); + + status = -EACCES; /* tell caller to check again */ + if (xprt_test_and_set_binding(xprt)) + goto bailout_nofree; /* Someone else may have bound if we slept */ status = 0; @@ -134,8 +136,6 @@ void rpc_getport(struct rpc_task *task) goto bailout; rpc_release_task(child); - rpc_sleep_on(&xprt->binding, task, NULL, NULL); - task->tk_xprt->stat.bind_count++; return; _ Patches currently in -mm which might be from chuck.lever@xxxxxxxxxx are origin.patch nfs-fix-minor-bug-in-new-nfs-symlink-code.patch nfs-__nfs_revalidate_inode-can-use-inode-before.patch nfs-remove-unused-check-in-nfs4_open_revalidate.patch sunrpc-fix-race-in-in-kernel-rpc-portmapper-client.patch sunrpc-fix-a-typo.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html