SUNRPC: Fix a race in rpc_info_open
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Sun, 12 Sep 2010 23:55:25 +0000 (19:55 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Sun, 12 Sep 2010 23:55:25 +0000 (19:55 -0400)
commit006abe887c5e637d059c44310de6c92f36aded3b
tree542ab0f1d56b4d9681c8d61fbf77c9a46062e661
parent5a67657a2e90c9e4a48518f95d4ba7777aa20fbb
SUNRPC: Fix a race in rpc_info_open

There is a race between rpc_info_open and rpc_release_client()
in that nothing stops a process from opening the file after
the clnt->cl_kref goes to zero.

Fix this by using atomic_inc_unless_zero()...

Reported-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: stable@kernel.org
include/linux/sunrpc/clnt.h
net/sunrpc/clnt.c
net/sunrpc/rpc_pipe.c