diff options
author | David Howells <dhowells@redhat.com> | 2021-08-28 00:22:02 +0200 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2021-09-10 23:14:51 +0200 |
commit | 345e1ae0c6ba54f6a4d32154e80cadc2ee2ef1af (patch) | |
tree | 0f194be69364ad276a754d1a8ad3b9809545d755 /fs/afs/write.c | |
parent | Merge tag 'for-5.15/io_uring-vfs-2021-08-30' of git://git.kernel.dk/linux-block (diff) | |
download | linux-345e1ae0c6ba54f6a4d32154e80cadc2ee2ef1af.tar.xz linux-345e1ae0c6ba54f6a4d32154e80cadc2ee2ef1af.zip |
afs: Fix missing put on afs_read objects and missing get on the key therein
The afs_read objects created by afs_req_issue_op() get leaked because
afs_alloc_read() returns a ref and then afs_fetch_data() gets its own ref
which is released when the operation completes, but the initial ref is
never released.
Fix this by discarding the initial ref at the end of afs_req_issue_op().
This leak also covered another bug whereby a ref isn't got on the key
attached to the read record by afs_req_issue_op(). This isn't a problem as
long as the afs_read req never goes away...
Fix this by calling key_get() in afs_req_issue_op().
This was found by the generic/074 test. It leaks a bunch of kmalloc-192
objects each time it is run, which can be observed by watching
/proc/slabinfo.
Fixes: f7605fa869cf ("afs: Fix leak of afs_read objects")
Reported-by: Marc Dionne <marc.dionne@auristor.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-and-tested-by: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Link: https://lore.kernel.org/r/163010394740.3035676.8516846193899793357.stgit@warthog.procyon.org.uk/
Link: https://lore.kernel.org/r/163111665914.283156.3038561975681836591.stgit@warthog.procyon.org.uk/
Diffstat (limited to 'fs/afs/write.c')
0 files changed, 0 insertions, 0 deletions