diff mbox

[API-NEXT/PATCHv2] pktio: linux-generic: add null check for pool assigned to CoS

Message ID 1449825792-14038-1-git-send-email-bala.manoharan@linaro.org
State New
Headers show

Commit Message

Balasubramanian Manoharan Dec. 11, 2015, 9:23 a.m. UTC
Fixes a crash caused by pool not assigned to CoS.

Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
Reviewed-and-Tested-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
v2: patch subject updated to ODP format

 platform/linux-generic/pktio/pktio_common.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/platform/linux-generic/pktio/pktio_common.c b/platform/linux-generic/pktio/pktio_common.c
index 1fb10a0..1ed3260 100644
--- a/platform/linux-generic/pktio/pktio_common.c
+++ b/platform/linux-generic/pktio/pktio_common.c
@@ -26,12 +26,13 @@  int _odp_packet_cls_enq(pktio_entry_t *pktio_entry,
 
 	_odp_cls_parse(&pkt_hdr, base);
 	cos = pktio_select_cos(pktio_entry, (uint8_t *)base, &pkt_hdr);
-	pool = cos->s.pool->s.pool_hdl;
 
 	/* if No CoS found then drop the packet */
-	if (cos == NULL || cos->s.queue == NULL)
+	if (cos == NULL || cos->s.queue == NULL || cos->s.pool == NULL)
 		return 0;
 
+	pool = cos->s.pool->s.pool_hdl;
+
 	pkt = odp_packet_alloc(pool, buf_len);
 	if (odp_unlikely(pkt == ODP_PACKET_INVALID))
 		return 0;