]> git.ipfire.org Git - people/ms/linux.git/commit - fs/cifs/file.c
cifs: Fix memory leak when using fscache
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 18 Jul 2022 19:06:24 +0000 (20:06 +0100)
committerSteve French <stfrench@microsoft.com>
Mon, 1 Aug 2022 06:34:44 +0000 (01:34 -0500)
commitc6f62f81b488d00afaa86bae26c6ce9ab12c709e
treecc6c26751f0ce276a15e4e79a165689be7cbb440
parent89e42f49ef58bf5601ce452683aad1cb1088878f
cifs: Fix memory leak when using fscache

If we hit the 'index == next_cached' case, we leak a refcount on the
struct page.  Fix this by using readahead_folio() which takes care of
the refcount for you.

Fixes: 0174ee9947bd ("cifs: Implement cache I/O by accessing the cache directly")
Cc: David Howells <dhowells@redhat.com>
Cc: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/file.c