linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Yang Yingliang <yangyingliang@huawei.com>,
	linux-f2fs-devel@lists.sourceforge.net
Cc: jaegeuk@kernel.org
Subject: Re: [f2fs-dev] [PATCH] f2fs: fix possible memory leak in f2fs_init_sysfs()
Date: Thu, 20 Oct 2022 16:45:23 +0800	[thread overview]
Message-ID: <7908686b-9a7c-b754-d312-d689fc28366e@kernel.org> (raw)
In-Reply-To: <20221018073240.666374-1-yangyingliang@huawei.com>

On 2022/10/18 15:32, Yang Yingliang wrote:
> Inject fault while probing module, kset_register() may fail,
> if it fails, but the refcount of kobject is not decreased to
> 0, the name allocated in kobject_set_name() is leaked. Fix
> this by calling kset_put(), so that name can be freed in
> callback function kobject_cleanup().
> 
> unreferenced object 0xffff888101b7cc80 (size 8):
>    comm "modprobe", pid 252, jiffies 4294691378 (age 31.760s)
>    hex dump (first 8 bytes):
>      66 32 66 73 00 88 ff ff                          f2fs....
>    backtrace:
>      [<000000001db5b408>] __kmalloc_node_track_caller+0x44/0x1b0
>      [<000000002783a073>] kstrdup+0x3a/0x70
>      [<00000000ead2b281>] kstrdup_const+0x63/0x80
>      [<000000003e5cf8f7>] kvasprintf_const+0x149/0x180
>      [<00000000c4d949ff>] kobject_set_name_vargs+0x56/0x150
>      [<0000000044611660>] kobject_set_name+0xab/0xe0
> 
> Fixes: bf9e697ecd42 ("f2fs: expose features to sysfs entry")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  reply	other threads:[~2022-10-20  8:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18  7:32 [f2fs-dev] [PATCH] f2fs: fix possible memory leak in f2fs_init_sysfs() Yang Yingliang via Linux-f2fs-devel
2022-10-20  8:45 ` Chao Yu [this message]
2022-10-28  0:58   ` Chao Yu
2022-10-28  3:26     ` Jaegeuk Kim

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=7908686b-9a7c-b754-d312-d689fc28366e@kernel.org \
    --to=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=yangyingliang@huawei.com \
    /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).