linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: wanghonghui <wanghonghui@ucloud.cn>
To: miklos@szeredi.hu
Cc: linux-fsdevel@vger.kernel.org, wanghonghui <wanghonghui@ucloud.cn>
Subject: [PATCH 1/1] fuse: fix memleak in fuse_writepage_locked
Date: Tue,  4 Jan 2022 21:34:04 +0800	[thread overview]
Message-ID: <20220104133404.69073-1-wanghonghui@ucloud.cn> (raw)

In function fuse_writepage_args_alloc, both wpa's memory and
wpa->ia.ap->pages's memory were allocated,but when failed
it only free wpa's memory

We need free wpa->ia.ap->pages's memory before free wpa

Signed-off-by: Wang Honghui <wanghonghui@ucloud.cn>
---
 fs/fuse/file.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 829094451774..c89966d7dbcc 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1949,6 +1949,7 @@ static int fuse_writepage_locked(struct page *page)
 err_nofile:
 	__free_page(tmp_page);
 err_free:
+	kfree(ap->pages);
 	kfree(wpa);
 err:
 	mapping_set_error(page->mapping, error);
-- 
2.25.1


                 reply	other threads:[~2022-01-04 13:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220104133404.69073-1-wanghonghui@ucloud.cn \
    --to=wanghonghui@ucloud.cn \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).