public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Richard Weinberger <richard@nod.at>
Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, dedekind1@gmail.com
Subject: Re: [PATCH] ubi: Fix out of bounds write in volume update code
Date: Wed, 24 Feb 2016 15:03:14 +0100	[thread overview]
Message-ID: <20160224150314.3a35bdba@bbrezillon> (raw)
In-Reply-To: <1456048383-27344-1-git-send-email-richard@nod.at>

On Sun, 21 Feb 2016 10:53:03 +0100
Richard Weinberger <richard@nod.at> wrote:

> ubi_start_leb_change() alloctes too few bytes.
> ubi_more_leb_change_data() will write up to req->upd_bytes +
> ubi->min_io_size bytes.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Richard Weinberger <richard@nod.at>

Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>

> ---
>  drivers/mtd/ubi/upd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/ubi/upd.c b/drivers/mtd/ubi/upd.c
> index cfeaf0f..b7901ce 100644
> --- a/drivers/mtd/ubi/upd.c
> +++ b/drivers/mtd/ubi/upd.c
> @@ -193,7 +193,7 @@ int ubi_start_leb_change(struct ubi_device *ubi, struct ubi_volume *vol,
>  	vol->changing_leb = 1;
>  	vol->ch_lnum = req->lnum;
>  
> -	vol->upd_buf = vmalloc(req->bytes);
> +	vol->upd_buf = vmalloc(ALIGN((int)req->bytes, ubi->min_io_size));
>  	if (!vol->upd_buf)
>  		return -ENOMEM;
>  



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

      reply	other threads:[~2016-02-24 14:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-21  9:53 [PATCH] ubi: Fix out of bounds write in volume update code Richard Weinberger
2016-02-24 14:03 ` Boris Brezillon [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=20160224150314.3a35bdba@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=dedekind1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=stable@vger.kernel.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