DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] bitmap: fix buffer overrun in bitmap init function
@ 2021-06-02  9:06 Andrew Rybchenko
  2021-06-02  9:47 ` Andrew Rybchenko
  2021-06-02  9:49 ` [dpdk-dev] [PATCH v2] " Andrew Rybchenko
  0 siblings, 2 replies; 5+ messages in thread
From: Andrew Rybchenko @ 2021-06-02  9:06 UTC (permalink / raw)
  To: Cristian Dumitrescu; +Cc: dev, Ivan Ilchenko, stable, Andy Moreton

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-11  9:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-02  9:06 [dpdk-dev] [PATCH] bitmap: fix buffer overrun in bitmap init function 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
2021-06-11  9:13     ` [dpdk-dev] [dpdk-stable] " David Marchand

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