aboutsummaryrefslogtreecommitdiffstats
path: root/fs/afs/rotate.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2018-05-10 03:43:04 -0400
committerDavid Howells <dhowells@redhat.com>2018-05-14 08:17:35 -0400
commitd4a96bec7a7362834ef5c31d7b2cc9bf36eb0570 (patch)
tree003ec92ab854c87f1ebbdbb4ee38e7b8a99e870a /fs/afs/rotate.c
parentf2686b09269ec1a6f23028b5675d87c3b4579a4c (diff)
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: c435ee34551e ("afs: Overhaul the callback handling") Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/afs/rotate.c')
-rw-r--r--fs/afs/rotate.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/afs/rotate.c b/fs/afs/rotate.c
index ac0feac9d746..4a26d51b2968 100644
--- a/fs/afs/rotate.c
+++ b/fs/afs/rotate.c
@@ -350,8 +350,8 @@ use_server:
350 * break request before we've finished decoding the reply and 350 * break request before we've finished decoding the reply and
351 * installing the vnode. 351 * installing the vnode.
352 */ 352 */
353 fc->ac.error = afs_register_server_cb_interest( 353 fc->ac.error = afs_register_server_cb_interest(vnode, fc->server_list,
354 vnode, &fc->server_list->servers[fc->index]); 354 fc->index);
355 if (fc->ac.error < 0) 355 if (fc->ac.error < 0)
356 goto failed; 356 goto failed;
357 357