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
This commit is contained in:
@@ -30,7 +30,7 @@ struct rpc_inode;
|
||||
* The high-level client handle
|
||||
*/
|
||||
struct rpc_clnt {
|
||||
struct kref cl_kref; /* Number of references */
|
||||
atomic_t cl_count; /* Number of references */
|
||||
struct list_head cl_clients; /* Global list of clients */
|
||||
struct list_head cl_tasks; /* List of tasks */
|
||||
spinlock_t cl_lock; /* spinlock */
|
||||
|
Reference in New Issue
Block a user