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
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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git