All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: core: check partition before dereference
@ 2022-07-25 13:49 Tetsuo Handa
  2022-07-25 14:36 ` Christian Marangi
  0 siblings, 1 reply; 3+ messages in thread
From: Tetsuo Handa @ 2022-07-25 13:49 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Christian Marangi
  Cc: linux-mtd

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 <syzbot+fe013f55a2814a9e8cfd@syzkaller.appspotmail.com>
Reported-by: kernel test robot <oliver.sang@intel.com>
Fixes: ad9b10d1eaada169 ("mtd: core: introduce of support for dynamic partitions")
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
---
 drivers/mtd/mtdcore.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 6fafea80fd98..a9b8be9f40dc 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -559,6 +559,8 @@ static void mtd_check_of_node(struct mtd_info *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)
-- 
2.34.1

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH] mtd: core: check partition before dereference
  2022-07-25 13:49 [PATCH] mtd: core: check partition before dereference Tetsuo Handa
@ 2022-07-25 14:36 ` Christian Marangi
  2022-07-25 16:15   ` Vanessa Page
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Marangi @ 2022-07-25 14:36 UTC (permalink / raw)
  To: Tetsuo Handa
  Cc: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra, linux-mtd

On Mon, Jul 25, 2022 at 10:49:25PM +0900, Tetsuo Handa wrote:
> 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 <syzbot+fe013f55a2814a9e8cfd@syzkaller.appspotmail.com>
> Reported-by: kernel test robot <oliver.sang@intel.com>
> Fixes: ad9b10d1eaada169 ("mtd: core: introduce of support for dynamic partitions")
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> ---
>  drivers/mtd/mtdcore.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
> index 6fafea80fd98..a9b8be9f40dc 100644
> --- a/drivers/mtd/mtdcore.c
> +++ b/drivers/mtd/mtdcore.c
> @@ -559,6 +559,8 @@ static void mtd_check_of_node(struct mtd_info *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)
> --

Thanks for sorting this out. LGTM.

-- 
	Ansuel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH] mtd: core: check partition before dereference
  2022-07-25 14:36 ` Christian Marangi
@ 2022-07-25 16:15   ` Vanessa Page
  0 siblings, 0 replies; 3+ messages in thread
From: Vanessa Page @ 2022-07-25 16:15 UTC (permalink / raw)
  To: Christian Marangi
  Cc: Tetsuo Handa, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, linux-mtd

I’m going to say this one last time. Stop fucking emailing me. 


> On Jul 25, 2022, at 10:38 AM, Christian Marangi <ansuelsmth@gmail.com> wrote:
> YOU DELUSIONAL SICK FUCK.
> On Mon, Jul 25, 2022 at 10:49:25PM +0900, Tetsuo Handa wrote:
>> 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 <syzbot+fe013f55a2814a9e8cfd@syzkaller.appspotmail.com>
>> Reported-by: kernel test robot <oliver.sang@intel.com>
>> Fixes: ad9b10d1eaada169 ("mtd: core: introduce of support for dynamic partitions")
>> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
>> ---
>> drivers/mtd/mtdcore.c | 2 ++
>> 1 file changed, 2 insertions(+)
>> 
>> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
>> index 6fafea80fd98..a9b8be9f40dc 100644
>> --- a/drivers/mtd/mtdcore.c
>> +++ b/drivers/mtd/mtdcore.c
>> @@ -559,6 +559,8 @@ static void mtd_check_of_node(struct mtd_info *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)
>> --
> 
> Thanks for sorting this out. LGTM.
> 
> -- 
>    Ansuel
> 
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

end of thread, other threads:[~2022-07-25 16:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-25 13:49 [PATCH] mtd: core: check partition before dereference Tetsuo Handa
2022-07-25 14:36 ` Christian Marangi
2022-07-25 16:15   ` Vanessa Page

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.