Skip to contentSkip to conversation

event/dlb: fix potential NULL dereference

PATCH Applied Timothy McDaniel 3 participants 3 messages Nov 16, 2020 – Nov 20, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 event/dlb: fix potential NULL dereference

Add NULL check before using t->mbuf_pool.

Coverity issue: 363719
Fixes: 83326 ("event/dlb: add PMD self-tests")

---
 drivers/event/dlb/dlb_selftest.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/event/dlb/dlb_selftest.c +6 -1
index b9ef778c1..8ab00ba87 100644
@@ -202,7 +202,12 @@ test_stop_flush(struct test *t) /* test to check we can properly flush events */
 		goto err;
 	}
 
-	count = rte_mempool_avail_count(t->mbuf_pool);
+	if (t->mbuf_pool)
+		count = rte_mempool_avail_count(t->mbuf_pool);
+	else {
+		printf("%d: mbuf_pool is NULL\n", __LINE__);
+		goto err;
+	}
 
 	if (rte_event_port_attr_get(evdev,
 				    0,
Signature · 1 line
2.23.0
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Timothy McDaniel
Sent: Monday, November 16, 2020 5:41 PM
Cc: [email protected]; Carrillo, Erik G <[email protected]>; Eads, Gage <[email protected]>; Van Haaren, Harry <[email protected]>; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH] event/dlb: fix potential NULL dereference

Quoted 4 lines

Add NULL check before using t->mbuf_pool.

Coverity issue: 363719
Fixes: 83326 ("event/dlb: add PMD self-tests")

This is similar to a fix on the dlb2 driver which fixed a similar Coverity defect (according to the last Coverity run). So, on that basis, I'll ack this patch.

Jerin, could you try merge this for RC5 if possible.

Applied
#2 lore raw
Quoted 11 lines · John
Quoted 11 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Timothy McDaniel
Sent: Monday, November 16, 2020 5:41 PM
Cc: [email protected]; Carrillo, Erik G <[email protected]>; Eads, Gage <[email protected]>; Van Haaren, Harry <[email protected]>; [email protected]; [email protected]
Subject: [dpdk-dev] [PATCH] event/dlb: fix potential NULL dereference

Quoted 9 lines
Quoted 4 lines

Add NULL check before using t->mbuf_pool.

Coverity issue: 363719
Fixes: 83326 ("event/dlb: add PMD self-tests")

This is similar to a fix on the dlb2 driver which fixed a similar Coverity defect (according to the last Coverity run). So, on that basis, I'll ack this patch.

Jerin, could you try merge this for RC5 if possible.

Applied to dpdk-next-net-eventdev/for-main. Thanks

Quoted 4 lines