All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Marangi <ansuelsmth@gmail.com>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-mtd@lists.infradead.org
Subject: Re: [PATCH] mtd: core: check partition before dereference
Date: Mon, 25 Jul 2022 16:36:35 +0200	[thread overview]
Message-ID: <62deaa73.1c69fb81.3bc99.8aef@mx.google.com> (raw)
In-Reply-To: <a262d332-662d-57b9-b746-8d3779f4e878@I-love.SAKURA.ne.jp>

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/

  reply	other threads:[~2022-07-25 14:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-25 13:49 [PATCH] mtd: core: check partition before dereference Tetsuo Handa
2022-07-25 14:36 ` Christian Marangi [this message]
2022-07-25 16:15   ` Vanessa Page

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=62deaa73.1c69fb81.3bc99.8aef@mx.google.com \
    --to=ansuelsmth@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.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 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.