linux/fs/afs
David Howells f0a7d1883d afs: Fix clearance of reply
The recent patch to fix the afs_server struct leak didn't actually fix the
bug, but rather fixed some of the symptoms.  The problem is that an
asynchronous call that holds a resource pointed to by call->reply[0] will
find the pointer cleared in the call destructor, thereby preventing the
resource from being cleaned up.

In the case of the server record leak, the afs_fs_get_capabilities()
function in devel code sets up a call with reply[0] pointing at the server
record that should be altered when the result is obtained, but this was
being cleared before the destructor was called, so the put in the
destructor does nothing and the record is leaked.

Commit f014ffb025 removed the additional ref obtained by
afs_install_server(), but the removal of this ref is actually used by the
garbage collector to mark a server record as being defunct after the record
has expired through lack of use.

The offending clearance of call->reply[0] upon completion in
afs_process_async_call() has been there from the origin of the code, but
none of the asynchronous calls actually use that pointer currently, so it
should be safe to remove (note that synchronous calls don't involve this
function).

Fix this by the following means:

 (1) Revert commit f014ffb025.

 (2) Remove the clearance of reply[0] from afs_process_async_call().

Without this, afs_manage_servers() will suffer an assertion failure if it
sees a server record that didn't get used because the usage count is not 1.

Fixes: f014ffb025 ("afs: Fix afs_server struct leak")
Fixes: 08e0e7c82e ("[AF_RXRPC]: Make the in-kernel AFS filesystem use AF_RXRPC.")
Signed-off-by: David Howells <dhowells@redhat.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-15 15:31:47 +02:00
..
addr_list.c Merge branch 'afs-proc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-06-16 16:32:04 +09:00
afs_cm.h
afs_fs.h
afs_vl.h
afs.h
cache.c
callback.c afs: Optimise callback breaking by not repeating volume lookup 2018-06-15 15:27:09 +01:00
cell.c afs: Fix cell proc list 2018-10-12 13:18:57 +02:00
cmservice.c Merge branch 'afs-proc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-06-16 16:32:04 +09:00
dir_edit.c
dir.c afs_try_auto_mntpt(): return NULL instead of ERR_PTR(-ENOENT) 2018-08-05 15:50:59 -04:00
dynroot.c afs: Fix cell proc list 2018-10-12 13:18:57 +02:00
file.c
flock.c
fsclient.c Merge branch 'afs-proc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-06-16 16:32:04 +09:00
inode.c
internal.h afs: Fix cell proc list 2018-10-12 13:18:57 +02:00
Kconfig
main.c afs: Fix cell proc list 2018-10-12 13:18:57 +02:00
Makefile afs: Handle CONFIG_PROC_FS=n 2018-06-15 00:52:55 -04:00
misc.c
mntpt.c
netdevices.c
proc.c afs: Fix cell proc list 2018-10-12 13:18:57 +02:00
rotate.c
rxrpc.c afs: Fix clearance of reply 2018-10-15 15:31:47 +02:00
security.c
server_list.c
server.c afs: Fix clearance of reply 2018-10-15 15:31:47 +02:00
super.c afs: Display manually added cells in dynamic root mount 2018-06-15 15:27:09 +01:00
vlclient.c
volume.c
write.c fs/afs: use new return type vm_fault_t 2018-08-23 18:48:43 -07:00
xattr.c
xdr_fs.h