DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Dumitrescu, Cristian" <cristian.dumitrescu@intel.com>
To: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>,
	 "stable@dpdk.org" <stable@dpdk.org>,
	Andy Moreton <amoreton@xilinx.com>
Subject: Re: [dpdk-dev] [PATCH v2] bitmap: fix buffer overrun in bitmap init function
Date: Tue, 8 Jun 2021 10:25:59 +0000	[thread overview]
Message-ID: <DM6PR11MB27967AB99F240BB9D8FC4B95EB379@DM6PR11MB2796.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210602094922.3507384-1-andrew.rybchenko@oktetlabs.ru>



> -----Original Message-----
> From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Sent: Wednesday, June 2, 2021 10:49 AM
> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> Cc: dev@dpdk.org; Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>;
> stable@dpdk.org; Andy Moreton <amoreton@xilinx.com>
> Subject: [PATCH v2] bitmap: fix buffer overrun in bitmap init function
> 
> From: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
> 
> Bitmap initialization function is allowed to memset()
> caller-provided buffer with number of bytes exceeded
> this buffer size. This happens due to wrong comparison
> sign between buffer size and number of bytes required
> to initialize bitmap.
> 
> Fixes: 602c9ca33a4 ("sched: bitmap is now dynamically allocated")
> Cc: stable@dpdk.org
> 
> Reported-by: Andy Moreton <amoreton@xilinx.com>
> Signed-off-by: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
> Reviewed-by: Andy Moreton <amoreton@xilinx.com>
> Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> ---
>  lib/eal/include/rte_bitmap.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/lib/eal/include/rte_bitmap.h b/lib/eal/include/rte_bitmap.h
> index 9e2b8f2cbf..e4623bb176 100644
> --- a/lib/eal/include/rte_bitmap.h
> +++ b/lib/eal/include/rte_bitmap.h
> @@ -185,9 +185,8 @@ rte_bitmap_init(uint32_t n_bits, uint8_t *mem,
> uint32_t mem_size)
>  	size = __rte_bitmap_get_memory_footprint(n_bits,
>  		&array1_byte_offset, &array1_slabs,
>  		&array2_byte_offset, &array2_slabs);
> -	if (size < mem_size) {
> +	if (size > mem_size)
>  		return NULL;
> -	}
> 
>  	/* Setup bitmap */
>  	memset(mem, 0, size);
> --
> 2.30.2

Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>


  reply	other threads:[~2021-06-08 10:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-02  9:06 [dpdk-dev] [PATCH] " Andrew Rybchenko
2021-06-02  9:47 ` Andrew Rybchenko
2021-06-02  9:49 ` [dpdk-dev] [PATCH v2] " Andrew Rybchenko
2021-06-08 10:25   ` Dumitrescu, Cristian [this message]
2021-06-11  9:13     ` [dpdk-dev] [dpdk-stable] " David Marchand

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=DM6PR11MB27967AB99F240BB9D8FC4B95EB379@DM6PR11MB2796.namprd11.prod.outlook.com \
    --to=cristian.dumitrescu@intel.com \
    --cc=amoreton@xilinx.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ivan.ilchenko@oktetlabs.ru \
    --cc=stable@dpdk.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;
as well as URLs for NNTP newsgroup(s).