From: Greg KH <gregkh@linuxfoundation.org>
To: libaokun@huaweicloud.com
Cc: stable@vger.kernel.org, sashal@kernel.org, tytso@mit.edu,
jack@suse.cz, patches@lists.linux.dev, yi.zhang@huawei.com,
yangerkun@huawei.com, Baokun Li <libaokun1@huawei.com>
Subject: Re: [PATCH 6.6/6.9] ext4: avoid ptr null pointer dereference
Date: Tue, 16 Jul 2024 16:07:30 +0200 [thread overview]
Message-ID: <2024071624-ascent-breeding-7fb1@gregkh> (raw)
In-Reply-To: <20240716092929.864207-1-libaokun@huaweicloud.com>
On Tue, Jul 16, 2024 at 05:29:29PM +0800, libaokun@huaweicloud.com wrote:
> From: Baokun Li <libaokun1@huawei.com>
>
> When commit 13df4d44a3aa ("ext4: fix slab-out-of-bounds in
> ext4_mb_find_good_group_avg_frag_lists()") was backported to stable, the
> commit f536808adcc3 ("ext4: refactor out ext4_generic_attr_store()") that
> uniformly determines if the ptr is null is not merged in, so it needs to
> be judged whether ptr is null or not in each case of the switch, otherwise
> null pointer dereferencing may occur.
>
> Signed-off-by: Baokun Li <libaokun1@huawei.com>
> ---
> fs/ext4/sysfs.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c
> index 63cbda3700ea..d65dccb44ed5 100644
> --- a/fs/ext4/sysfs.c
> +++ b/fs/ext4/sysfs.c
> @@ -473,6 +473,8 @@ static ssize_t ext4_attr_store(struct kobject *kobj,
> *((unsigned int *) ptr) = t;
> return len;
> case attr_clusters_in_group:
> + if (!ptr)
> + return 0;
> ret = kstrtouint(skip_spaces(buf), 0, &t);
> if (ret)
> return ret;
> --
> 2.39.2
>
>
Now queued up, thanks for the fix!
greg k-h
next prev parent reply other threads:[~2024-07-16 14:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-16 9:29 [PATCH 6.6/6.9] ext4: avoid ptr null pointer dereference libaokun
2024-07-16 13:15 ` Patch "ext4: avoid ptr null pointer dereference" has been added to the 6.9-stable tree gregkh
2024-07-16 13:29 ` Patch "ext4: avoid ptr null pointer dereference" has been added to the 5.4-stable tree gregkh
2024-07-16 13:30 ` Patch "ext4: avoid ptr null pointer dereference" has been added to the 6.6-stable tree gregkh
2024-07-16 14:07 ` Greg KH [this message]
2024-07-16 14:18 ` [PATCH 6.6/6.9] ext4: avoid ptr null pointer dereference Baokun Li
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=2024071624-ascent-breeding-7fb1@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=jack@suse.cz \
--cc=libaokun1@huawei.com \
--cc=libaokun@huaweicloud.com \
--cc=patches@lists.linux.dev \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@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