Archive-only list for patches
 help / color / mirror / Atom feed
* [PATCH 6.6/6.9] ext4: avoid ptr null pointer dereference
@ 2024-07-16  9:29 libaokun
  2024-07-16 13:15 ` Patch "ext4: avoid ptr null pointer dereference" has been added to the 6.9-stable tree gregkh
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: libaokun @ 2024-07-16  9:29 UTC (permalink / raw)
  To: stable, gregkh
  Cc: sashal, tytso, jack, patches, yi.zhang, yangerkun, libaokun,
	Baokun Li

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-07-16 14:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 6.6/6.9] ext4: avoid ptr null pointer dereference Greg KH
2024-07-16 14:18   ` Baokun Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox