diff mbox

[API-NEXT/PATCH] fix: classification: add null check for pool assigned to CoS

Message ID 1449822870-20147-1-git-send-email-bala.manoharan@linaro.org
State Accepted
Commit 32198b0a76079c57e3bdd124a8b253d581c71127
Headers show

Commit Message

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

Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
---
 platform/linux-generic/pktio/pktio_common.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Maxim Uvarov Dec. 11, 2015, 8:37 a.m. UTC | #1
Reviewed-and-Tested-by: Maxim Uvarov <maxim.uvarov@linaro.org>

On 12/11/2015 11:34, Balasubramanian Manoharan wrote:
> Fixes a crash caused by pool not assigned to CoS.
>
> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
> ---
>   platform/linux-generic/pktio/pktio_common.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> 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;
Balasubramanian Manoharan Dec. 17, 2015, 2:54 p.m. UTC | #2
Ping.

On 11 December 2015 at 14:07, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
>
> Reviewed-and-Tested-by: Maxim Uvarov <maxim.uvarov@linaro.org>
>
> On 12/11/2015 11:34, Balasubramanian Manoharan wrote:
>>
>> Fixes a crash caused by pool not assigned to CoS.
>>
>> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
>> ---
>>   platform/linux-generic/pktio/pktio_common.c | 5 +++--
>>   1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> 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;
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
Maxim Uvarov Dec. 19, 2015, 11:21 a.m. UTC | #3
Merged,
Maxim.

On 12/17/2015 17:54, Bala Manoharan wrote:
> Ping.
>
> On 11 December 2015 at 14:07, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
>> Reviewed-and-Tested-by: Maxim Uvarov <maxim.uvarov@linaro.org>
>>
>> On 12/11/2015 11:34, Balasubramanian Manoharan wrote:
>>> Fixes a crash caused by pool not assigned to CoS.
>>>
>>> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
>>> ---
>>>    platform/linux-generic/pktio/pktio_common.c | 5 +++--
>>>    1 file changed, 3 insertions(+), 2 deletions(-)
>>>
>>> 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;
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
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;