OSDN Git Service

afs: Fix key leak in afs_release() and afs_evict_inode()
authorDavid Howells <dhowells@redhat.com>
Wed, 15 May 2019 11:09:17 +0000 (12:09 +0100)
committerDavid Howells <dhowells@redhat.com>
Wed, 15 May 2019 11:32:34 +0000 (12:32 +0100)
commita1b879eefc2b34cd3f17187ef6fc1cf3960e9518
tree749a872254c15ad9de5a0e17a895d7d553321e99
parent80f232121b69cc69a31ccb2b38c1665d770b0710
afs: Fix key leak in afs_release() and afs_evict_inode()

Fix afs_release() to go through the cleanup part of the function if
FMODE_WRITE is set rather than exiting through vfs_fsync() (which skips the
cleanup).  The cleanup involves discarding the refs on the key used for
file ops and the writeback key record.

Also fix afs_evict_inode() to clean up any left over wb keys attached to
the inode/vnode when it is removed.

Fixes: 5a8132761609 ("afs: Do better accretion of small writes on newly created content")
Signed-off-by: David Howells <dhowells@redhat.com>
fs/afs/file.c
fs/afs/inode.c