mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@gmail.com>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd/redboot: avoid null pointer deref
Date: Tue, 3 Jan 2017 03:22:28 +0100	[thread overview]
Message-ID: <8267e170-e3ae-06dd-c859-17712785071a@gmail.com> (raw)
In-Reply-To: <20161221232528.26534-1-Jason@zx2c4.com>

On 12/22/2016 12:25 AM, Jason A. Donenfeld wrote:
> By giving a bogus partition name, it's possible to trigger a null
> pointer dereference.
> 
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>

Nice catch. It'd be great to have the condition which can be used to
trigger this problem in the commit message. I presume this happens if
buf[i].name[0] = 0xff for all $i, right ?

So please expand the explanation and add my Ack for V2:
Acked-by: Marek Vasut <marek.vasut@gmail.com>

Thanks

> ---
>  drivers/mtd/redboot.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/mtd/redboot.c b/drivers/mtd/redboot.c
> index 7623ac5fc586..53949ef80d36 100644
> --- a/drivers/mtd/redboot.c
> +++ b/drivers/mtd/redboot.c
> @@ -212,6 +212,10 @@ static int parse_redboot_partitions(struct mtd_info *master,
>  
>  		nrparts++;
>  	}
> +	if (!fl) {
> +		ret = -EINVAL;
> +		goto out;
> +	}
>  #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
>  	if (fl->img->flash_base) {
>  		nrparts++;
> 


-- 
Best regards,
Marek Vasut

      reply	other threads:[~2017-01-03  2:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-21 23:25 Jason A. Donenfeld
2017-01-03  2:22 ` Marek Vasut [this message]

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=8267e170-e3ae-06dd-c859-17712785071a@gmail.com \
    --to=marek.vasut@gmail.com \
    --cc=Jason@zx2c4.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®