diff mbox

[PATCHv2] linux-generic: queue: avoid leakage on queue create

Message ID 1460830893-22902-1-git-send-email-bill.fischofer@linaro.org
State Accepted
Commit 8559cbd2ef8c7f53319640e5b63f87d501f683fa
Headers show

Commit Message

Bill Fischofer April 16, 2016, 6:21 p.m. UTC
If a scheduled queue is created via odp_queue_create() but is unable
to be added to the scheduler queues, free it rather than leaking
resources.

This resolves Bug https://bugs.linaro.org/show_bug.cgi?id=2186

Reported-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 platform/linux-generic/odp_queue.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Mike Holmes May 5, 2016, 1:02 p.m. UTC | #1
Does this need a review ?

On 16 April 2016 at 14:21, Bill Fischofer <bill.fischofer@linaro.org> wrote:

> If a scheduled queue is created via odp_queue_create() but is unable

> to be added to the scheduler queues, free it rather than leaking

> resources.

>

> This resolves Bug https://bugs.linaro.org/show_bug.cgi?id=2186

>

> Reported-by: Maxim Uvarov <maxim.uvarov@linaro.org>

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

> ---

>  platform/linux-generic/odp_queue.c | 1 +

>  1 file changed, 1 insertion(+)

>

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

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

> index 5963057..3ddbc72 100644

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

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

> @@ -274,6 +274,7 @@ odp_queue_t odp_queue_create(const char *name, const

> odp_queue_param_t *param)

>

>         if (handle != ODP_QUEUE_INVALID && type == ODP_QUEUE_TYPE_SCHED) {

>                 if (schedule_queue_init(queue)) {

> +                       queue->s.status = QUEUE_STATUS_FREE;

>                         ODP_ERR("schedule queue init failed\n");

>                         return ODP_QUEUE_INVALID;

>                 }

> --

> 2.5.0

>

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org

> https://lists.linaro.org/mailman/listinfo/lng-odp

>




-- 
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs
"Work should be fun and collaborative, the rest follows"
Bill Fischofer May 5, 2016, 1:19 p.m. UTC | #2
I believe Maxim reviewed it, however perhaps not in this thread.

On Thu, May 5, 2016 at 8:02 AM, Mike Holmes <mike.holmes@linaro.org> wrote:

> Does this need a review ?

>

> On 16 April 2016 at 14:21, Bill Fischofer <bill.fischofer@linaro.org>

> wrote:

>

>> If a scheduled queue is created via odp_queue_create() but is unable

>> to be added to the scheduler queues, free it rather than leaking

>> resources.

>>

>> This resolves Bug https://bugs.linaro.org/show_bug.cgi?id=2186

>>

>> Reported-by: Maxim Uvarov <maxim.uvarov@linaro.org>

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

>> ---

>>  platform/linux-generic/odp_queue.c | 1 +

>>  1 file changed, 1 insertion(+)

>>

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

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

>> index 5963057..3ddbc72 100644

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

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

>> @@ -274,6 +274,7 @@ odp_queue_t odp_queue_create(const char *name, const

>> odp_queue_param_t *param)

>>

>>         if (handle != ODP_QUEUE_INVALID && type == ODP_QUEUE_TYPE_SCHED) {

>>                 if (schedule_queue_init(queue)) {

>> +                       queue->s.status = QUEUE_STATUS_FREE;

>>                         ODP_ERR("schedule queue init failed\n");

>>                         return ODP_QUEUE_INVALID;

>>                 }

>> --

>> 2.5.0

>>

>> _______________________________________________

>> lng-odp mailing list

>> lng-odp@lists.linaro.org

>> https://lists.linaro.org/mailman/listinfo/lng-odp

>>

>

>

>

> --

> Mike Holmes

> Technical Manager - Linaro Networking Group

> Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs

> "Work should be fun and collaborative, the rest follows"

>

>

>
Maxim Uvarov May 10, 2016, 6:12 p.m. UTC | #3
Merged,
Maxim.

On 05/05/16 16:19, Bill Fischofer wrote:
> I believe Maxim reviewed it, however perhaps not in this thread.
>
> On Thu, May 5, 2016 at 8:02 AM, Mike Holmes <mike.holmes@linaro.org 
> <mailto:mike.holmes@linaro.org>> wrote:
>
>     Does this need a review ?
>
>     On 16 April 2016 at 14:21, Bill Fischofer
>     <bill.fischofer@linaro.org <mailto:bill.fischofer@linaro.org>> wrote:
>
>         If a scheduled queue is created via odp_queue_create() but is
>         unable
>         to be added to the scheduler queues, free it rather than leaking
>         resources.
>
>         This resolves Bug https://bugs.linaro.org/show_bug.cgi?id=2186
>
>         Reported-by: Maxim Uvarov <maxim.uvarov@linaro.org
>         <mailto:maxim.uvarov@linaro.org>>
>         Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org
>         <mailto:bill.fischofer@linaro.org>>
>         ---
>          platform/linux-generic/odp_queue.c | 1 +
>          1 file changed, 1 insertion(+)
>
>         diff --git a/platform/linux-generic/odp_queue.c
>         b/platform/linux-generic/odp_queue.c
>         index 5963057..3ddbc72 100644
>         --- a/platform/linux-generic/odp_queue.c
>         +++ b/platform/linux-generic/odp_queue.c
>         @@ -274,6 +274,7 @@ odp_queue_t odp_queue_create(const char
>         *name, const odp_queue_param_t *param)
>
>                 if (handle != ODP_QUEUE_INVALID && type ==
>         ODP_QUEUE_TYPE_SCHED) {
>                         if (schedule_queue_init(queue)) {
>         +                       queue->s.status = QUEUE_STATUS_FREE;
>         ODP_ERR("schedule queue init failed\n");
>                                 return ODP_QUEUE_INVALID;
>                         }
>         --
>         2.5.0
>
>         _______________________________________________
>         lng-odp mailing list
>         lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>         https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>
>     -- 
>     Mike Holmes
>     Technical Manager - Linaro Networking Group
>     Linaro.org <http://www.linaro.org/>***│ *Open source software for
>     ARM SoCs
>     "Work should be fun and collaborative, the rest follows"
>
>
>
>
> _______________________________________________
> 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_queue.c b/platform/linux-generic/odp_queue.c
index 5963057..3ddbc72 100644
--- a/platform/linux-generic/odp_queue.c
+++ b/platform/linux-generic/odp_queue.c
@@ -274,6 +274,7 @@  odp_queue_t odp_queue_create(const char *name, const odp_queue_param_t *param)
 
 	if (handle != ODP_QUEUE_INVALID && type == ODP_QUEUE_TYPE_SCHED) {
 		if (schedule_queue_init(queue)) {
+			queue->s.status = QUEUE_STATUS_FREE;
 			ODP_ERR("schedule queue init failed\n");
 			return ODP_QUEUE_INVALID;
 		}