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;
Hi,
Thanks for your patch.
FYI: kernel test robot notices the stable kernel rule is not satisfied.
The check is based on https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html#opti...
Rule: The upstream commit ID must be specified with a separate line above the commit text. Subject: [PATCH 6.6/6.9] ext4: avoid ptr null pointer dereference Link: https://lore.kernel.org/stable/20240716092929.864207-1-libaokun%40huaweiclou...
Please ignore this mail if the patch is not relevant for upstream.
On 2024/7/16 18:11, kernel test robot wrote:
Hi,
Thanks for your patch.
FYI: kernel test robot notices the stable kernel rule is not satisfied.
The check is based on https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html#opti...
Rule: The upstream commit ID must be specified with a separate line above the commit text. Subject: [PATCH 6.6/6.9] ext4: avoid ptr null pointer dereference Link: https://lore.kernel.org/stable/20240716092929.864207-1-libaokun%40huaweiclou...
Please ignore this mail if the patch is not relevant for upstream.
This patch does have nothing to do with upstream, so please ignore it.
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)
ret = kstrtouint(skip_spaces(buf), 0, &t); if (ret) return ret;return 0;
-- 2.39.2
Now queued up, thanks for the fix!
greg k-h
On 2024/7/16 22:07, Greg KH wrote:
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)
ret = kstrtouint(skip_spaces(buf), 0, &t); if (ret) return ret;return 0;
-- 2.39.2
Now queued up, thanks for the fix!
greg k-h
Thanks for your consistent work. 😄
linux-stable-mirror@lists.linaro.org