]> git.baikalelectronics.ru Git - kernel.git/commit
afs: Fix refcounting in callback registration
authorDavid Howells <dhowells@redhat.com>
Thu, 10 May 2018 07:43:04 +0000 (08:43 +0100)
committerDavid Howells <dhowells@redhat.com>
Mon, 14 May 2018 12:17:35 +0000 (13:17 +0100)
commitc0ca408181baf7659e62c922f4ad05611e70d851
tree003ec92ab854c87f1ebbdbb4ee38e7b8a99e870a
parent8af1ad29f1d6a4d8ceca0f0821ed6d6eb6e8ae0c
afs: Fix refcounting in callback registration

The refcounting on afs_cb_interest struct objects in
afs_register_server_cb_interest() is wrong as it uses the server list
entry's call back interest pointer without regard for the fact that it
might be replaced at any time and the object thrown away.

Fix this by:

 (1) Put a lock on the afs_server_list struct that can be used to
     mediate access to the callback interest pointers in the servers array.

 (2) Keep a ref on the callback interest that we get from the entry.

 (3) Dropping the old reference held by vnode->cb_interest if we replace
     the pointer.

Fixes: f2ee1d2da2e8 ("afs: Overhaul the callback handling")
Signed-off-by: David Howells <dhowells@redhat.com>
fs/afs/callback.c
fs/afs/internal.h
fs/afs/rotate.c
fs/afs/server_list.c