From: Baokun Li <libaokun1@huawei.com>
To: Jingbo Xu <jefflexu@linux.alibaba.com>, <linux-erofs@lists.ozlabs.org>
Cc: <xiang@kernel.org>, <chao@kernel.org>, <huyue2@coolpad.com>,
<viro@zeniv.linux.org.uk>, <brauner@kernel.org>,
<linux-kernel@vger.kernel.org>, <yangerkun@huawei.com>,
<houtao1@huawei.com>, Baokun Li <libaokun1@huawei.com>
Subject: Re: [PATCH -next v3 1/2] erofs: get rid of erofs_fs_context
Date: Mon, 22 Apr 2024 19:31:47 +0800 [thread overview]
Message-ID: <4e8dd4f5-29dc-9459-6ba2-f399258952dc@huawei.com> (raw)
In-Reply-To: <8d751a33-af11-4aa8-8fad-cc24e825bde7@linux.alibaba.com>
Hi Jingbo,
On 2024/4/22 18:25, Jingbo Xu wrote:
>
> On 4/19/24 8:36 PM, Baokun Li wrote:
>
>> @@ -761,12 +747,15 @@ static void erofs_free_dev_context(struct erofs_dev_context *devs)
>>
>> static void erofs_fc_free(struct fs_context *fc)
>> {
>> - struct erofs_fs_context *ctx = fc->fs_private;
>> + struct erofs_sb_info *sbi = fc->s_fs_info;
>> +
>> + if (!sbi)
>> + return;
>
> This is the only difference comparing to the original code literally.
> Is there any chance that fc->s_fs_info can be NULL when erofs_fc_free()
> is called?
>
> Otherwise looks good to me.
>
When sget_fc() executes successfully, fc->s_fs_info is set to NULL,
so the following NULL pointer dereference may occur:
do_new_mount
vfs_get_tree
erofs_fc_get_tree
get_tree_bdev
sget_dev
sget_fc
s = alloc_super
s->s_fs_info = fc->s_fs_info;
fc->s_fs_info = NULL;
fill_super
// return error
deactivate_locked_super
kfree(sbi);
put_fs_context
sbi = fc->s_fs_info
kfree(sbi->fsid)
Thank you very much for the review!
--
With Best Regards,
Baokun Li
next prev parent reply other threads:[~2024-04-22 11:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-19 12:36 [PATCH -next v3 0/2] erofs: reliably distinguish block based and fscache mode Baokun Li
2024-04-19 12:36 ` [PATCH -next v3 1/2] erofs: get rid of erofs_fs_context Baokun Li
2024-04-22 10:25 ` Jingbo Xu
2024-04-22 11:31 ` Baokun Li [this message]
2024-04-22 11:39 ` Jingbo Xu
2024-04-23 10:37 ` Gao Xiang
2024-04-28 7:10 ` Gao Xiang
2024-04-28 10:00 ` Chao Yu
2024-04-19 12:36 ` [PATCH -next v3 2/2] erofs: reliably distinguish block based and fscache mode Baokun Li
2024-04-22 11:52 ` Jingbo Xu
2024-04-28 7:17 ` Gao Xiang
2024-04-28 10:03 ` Chao Yu
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=4e8dd4f5-29dc-9459-6ba2-f399258952dc@huawei.com \
--to=libaokun1@huawei.com \
--cc=brauner@kernel.org \
--cc=chao@kernel.org \
--cc=houtao1@huawei.com \
--cc=huyue2@coolpad.com \
--cc=jefflexu@linux.alibaba.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=xiang@kernel.org \
--cc=yangerkun@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
all inboxes | Powered by JetHome®