From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
To: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Cc: dev@dpdk.org, Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>,
stable@dpdk.org, Andy Moreton <amoreton@xilinx.com>
Subject: [dpdk-dev] [PATCH] bitmap: fix buffer overrun in bitmap init function
Date: Wed, 2 Jun 2021 12:06:29 +0300 [thread overview]
Message-ID: <20210602090629.3495940-1-andrew.rybchenko@oktetlabs.ru> (raw)
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 comparision
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>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
---
lib/eal/include/rte_bitmap.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/eal/include/rte_bitmap.h b/lib/eal/include/rte_bitmap.h
index 9e2b8f2cbf..870aecc594 100644
--- a/lib/eal/include/rte_bitmap.h
+++ b/lib/eal/include/rte_bitmap.h
@@ -185,7 +185,7 @@ 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;
}
--
2.30.2
next reply other threads:[~2021-06-02 9:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-02 9:06 Andrew Rybchenko [this message]
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
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=20210602090629.3495940-1-andrew.rybchenko@oktetlabs.ru \
--to=andrew.rybchenko@oktetlabs.ru \
--cc=amoreton@xilinx.com \
--cc=cristian.dumitrescu@intel.com \
--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).