]> git.proxmox.com Git - mirror_ubuntu-bionic-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)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 1 Oct 2018 12:58:15 +0000 (14:58 +0200)
commit62e631470564d19b62a15c471dee5ffec501aeff
tree8f3fc14a58ce683fa52ad380bdc142564eb7125b
parent9de0b1ed5e5231119ad155945e4f66e2dd92e25a
afs: Fix refcounting in callback registration

BugLink: http://bugs.launchpad.net/bugs/1794889
[ Upstream commit d4a96bec7a7362834ef5c31d7b2cc9bf36eb0570 ]

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>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
fs/afs/callback.c
fs/afs/internal.h
fs/afs/rotate.c
fs/afs/server_list.c