diff mbox

[1/2] linux-generic: pool: catch duplicate free errors in debug builds

Message ID 1446746528-25786-1-git-send-email-bill.fischofer@linaro.org
State Accepted
Commit 5cd017d1bd21df76b35b16edbb959ce6bec3cc87
Headers show

Commit Message

Bill Fischofer Nov. 5, 2015, 6:02 p.m. UTC
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 platform/linux-generic/odp_pool.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Bill Fischofer Jan. 25, 2016, 12:54 a.m. UTC | #1
ping

On Thu, Nov 5, 2015 at 12:02 PM, Bill Fischofer <bill.fischofer@linaro.org>
wrote:

> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

> ---

>  platform/linux-generic/odp_pool.c | 2 ++

>  1 file changed, 2 insertions(+)

>

> diff --git a/platform/linux-generic/odp_pool.c

> b/platform/linux-generic/odp_pool.c

> index 76a4aa5..9fd64d6 100644

> --- a/platform/linux-generic/odp_pool.c

> +++ b/platform/linux-generic/odp_pool.c

> @@ -540,6 +540,8 @@ void odp_buffer_free(odp_buffer_t buf)

>         odp_buffer_hdr_t *buf_hdr = odp_buf_to_hdr(buf);

>         pool_entry_t *pool = odp_buf_to_pool(buf_hdr);

>

> +       ODP_ASSERT(buf_hdr->allocator != ODP_FREEBUF);

> +

>         if (odp_unlikely(pool->s.low_wm_assert))

>                 ret_buf(&pool->s, buf_hdr);

>         else

> --

> 2.1.4

>

>
Balasubramanian Manoharan Jan. 25, 2016, 5:26 a.m. UTC | #2
Just curious does this issue not happen in production build?

Regards,
Bala


On 5 November 2015 at 23:32, Bill Fischofer <bill.fischofer@linaro.org> wrote:
> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
> ---
>  platform/linux-generic/odp_pool.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c
> index 76a4aa5..9fd64d6 100644
> --- a/platform/linux-generic/odp_pool.c
> +++ b/platform/linux-generic/odp_pool.c
> @@ -540,6 +540,8 @@ void odp_buffer_free(odp_buffer_t buf)
>         odp_buffer_hdr_t *buf_hdr = odp_buf_to_hdr(buf);
>         pool_entry_t *pool = odp_buf_to_pool(buf_hdr);
>
> +       ODP_ASSERT(buf_hdr->allocator != ODP_FREEBUF);
> +
>         if (odp_unlikely(pool->s.low_wm_assert))
>                 ret_buf(&pool->s, buf_hdr);
>         else
> --
> 2.1.4
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
Balasubramanian Manoharan Jan. 25, 2016, 5:34 a.m. UTC | #3
Just read the discussion in other thread. Seems reasonable

For the series:
Reviewed-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
Regards,
Bala


On 25 January 2016 at 10:56, Bala Manoharan <bala.manoharan@linaro.org> wrote:
> Just curious does this issue not happen in production build?
>
> Regards,
> Bala
>
>
> On 5 November 2015 at 23:32, Bill Fischofer <bill.fischofer@linaro.org> wrote:
>> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
>> ---
>>  platform/linux-generic/odp_pool.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c
>> index 76a4aa5..9fd64d6 100644
>> --- a/platform/linux-generic/odp_pool.c
>> +++ b/platform/linux-generic/odp_pool.c
>> @@ -540,6 +540,8 @@ void odp_buffer_free(odp_buffer_t buf)
>>         odp_buffer_hdr_t *buf_hdr = odp_buf_to_hdr(buf);
>>         pool_entry_t *pool = odp_buf_to_pool(buf_hdr);
>>
>> +       ODP_ASSERT(buf_hdr->allocator != ODP_FREEBUF);
>> +
>>         if (odp_unlikely(pool->s.low_wm_assert))
>>                 ret_buf(&pool->s, buf_hdr);
>>         else
>> --
>> 2.1.4
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
Maxim Uvarov Jan. 25, 2016, 11:11 a.m. UTC | #4
Merged,
Maxim.

On 01/25/2016 08:34, Bala Manoharan wrote:
> Just read the discussion in other thread. Seems reasonable
>
> For the series:
> Reviewed-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
> Regards,
> Bala
>
>
> On 25 January 2016 at 10:56, Bala Manoharan <bala.manoharan@linaro.org> wrote:
>> Just curious does this issue not happen in production build?
>>
>> Regards,
>> Bala
>>
>>
>> On 5 November 2015 at 23:32, Bill Fischofer <bill.fischofer@linaro.org> wrote:
>>> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
>>> ---
>>>   platform/linux-generic/odp_pool.c | 2 ++
>>>   1 file changed, 2 insertions(+)
>>>
>>> diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c
>>> index 76a4aa5..9fd64d6 100644
>>> --- a/platform/linux-generic/odp_pool.c
>>> +++ b/platform/linux-generic/odp_pool.c
>>> @@ -540,6 +540,8 @@ void odp_buffer_free(odp_buffer_t buf)
>>>          odp_buffer_hdr_t *buf_hdr = odp_buf_to_hdr(buf);
>>>          pool_entry_t *pool = odp_buf_to_pool(buf_hdr);
>>>
>>> +       ODP_ASSERT(buf_hdr->allocator != ODP_FREEBUF);
>>> +
>>>          if (odp_unlikely(pool->s.low_wm_assert))
>>>                  ret_buf(&pool->s, buf_hdr);
>>>          else
>>> --
>>> 2.1.4
>>>
>>> _______________________________________________
>>> lng-odp mailing list
>>> lng-odp@lists.linaro.org
>>> https://lists.linaro.org/mailman/listinfo/lng-odp
> _______________________________________________
> 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/odp_pool.c b/platform/linux-generic/odp_pool.c
index 76a4aa5..9fd64d6 100644
--- a/platform/linux-generic/odp_pool.c
+++ b/platform/linux-generic/odp_pool.c
@@ -540,6 +540,8 @@  void odp_buffer_free(odp_buffer_t buf)
 	odp_buffer_hdr_t *buf_hdr = odp_buf_to_hdr(buf);
 	pool_entry_t *pool = odp_buf_to_pool(buf_hdr);
 
+	ODP_ASSERT(buf_hdr->allocator != ODP_FREEBUF);
+
 	if (odp_unlikely(pool->s.low_wm_assert))
 		ret_buf(&pool->s, buf_hdr);
 	else