123456789101112131415161718192021222324252627282930 |
- From 7ec4cdb321738d44ae5d405e7b6ac73dfbf99caa Mon Sep 17 00:00:00 2001
- From: Tetsuo Handa <[email protected]>
- Date: Mon, 25 Jul 2022 22:49:25 +0900
- Subject: [PATCH] mtd: core: check partition before dereference
- syzbot is reporting NULL pointer dereference at mtd_check_of_node() [1],
- for mtdram test device (CONFIG_MTD_MTDRAM) is not partition.
- Link: https://syzkaller.appspot.com/bug?extid=fe013f55a2814a9e8cfd [1]
- Reported-by: syzbot <[email protected]>
- Reported-by: kernel test robot <[email protected]>
- Fixes: ad9b10d1eaada169 ("mtd: core: introduce of support for dynamic partitions")
- Signed-off-by: Tetsuo Handa <[email protected]>
- CC: [email protected]
- Signed-off-by: Richard Weinberger <[email protected]>
- ---
- drivers/mtd/mtdcore.c | 2 ++
- 1 file changed, 2 insertions(+)
- --- a/drivers/mtd/mtdcore.c
- +++ b/drivers/mtd/mtdcore.c
- @@ -577,6 +577,8 @@ static void mtd_check_of_node(struct mtd
- return;
-
- /* Check if a partitions node exist */
- + if (!mtd_is_partition(mtd))
- + return;
- parent = mtd->parent;
- parent_dn = dev_of_node(&parent->dev);
- if (!parent_dn)
|