diff mbox

linux-generic: queue: fix potential queue leak

Message ID 1426514281-29774-1-git-send-email-stuart.haslam@linaro.org
State Accepted
Commit 6f88db2611ee9be6a8dcc80b0c446968e5342ecf
Headers show

Commit Message

Stuart Haslam March 16, 2015, 1:58 p.m. UTC
If schedule buffer allocation fails during odp_queue_create(), a
scheduled or pktin queue may be incorrectly left in an allocated
state.

Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
---
 platform/linux-generic/odp_queue.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Bill Fischofer March 17, 2015, 1:40 a.m. UTC | #1
On Mon, Mar 16, 2015 at 8:58 AM, Stuart Haslam <stuart.haslam@linaro.org>
wrote:

> If schedule buffer allocation fails during odp_queue_create(), a
> scheduled or pktin queue may be incorrectly left in an allocated
> state.
>
> Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
>

Reviewed-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 477b5e3..4bb8b9b 100644
> --- a/platform/linux-generic/odp_queue.c
> +++ b/platform/linux-generic/odp_queue.c
> @@ -226,6 +226,7 @@ odp_queue_t odp_queue_create(const char *name,
> odp_queue_type_t type,
>
>                 buf = odp_schedule_buffer_alloc(handle);
>                 if (buf == ODP_BUFFER_INVALID) {
> +                       queue->s.status = QUEUE_STATUS_FREE;
>                         ODP_ERR("queue_init: sched buf alloc failed\n");
>                         return ODP_QUEUE_INVALID;
>                 }
> --
> 2.1.1
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Maxim Uvarov March 17, 2015, 10:19 a.m. UTC | #2
Merged,
Maxim.

On 03/17/15 04:40, Bill Fischofer wrote:
>
>
> On Mon, Mar 16, 2015 at 8:58 AM, Stuart Haslam 
> <stuart.haslam@linaro.org <mailto:stuart.haslam@linaro.org>> wrote:
>
>     If schedule buffer allocation fails during odp_queue_create(), a
>     scheduled or pktin queue may be incorrectly left in an allocated
>     state.
>
>     Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org
>     <mailto:stuart.haslam@linaro.org>>
>
>
> Reviewed-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 477b5e3..4bb8b9b 100644
>     --- a/platform/linux-generic/odp_queue.c
>     +++ b/platform/linux-generic/odp_queue.c
>     @@ -226,6 +226,7 @@ odp_queue_t odp_queue_create(const char *name,
>     odp_queue_type_t type,
>
>                     buf = odp_schedule_buffer_alloc(handle);
>                     if (buf == ODP_BUFFER_INVALID) {
>     +                       queue->s.status = QUEUE_STATUS_FREE;
>                             ODP_ERR("queue_init: sched buf alloc
>     failed\n");
>                             return ODP_QUEUE_INVALID;
>                     }
>     --
>     2.1.1
>
>
>     _______________________________________________
>     lng-odp mailing list
>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>     http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://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 477b5e3..4bb8b9b 100644
--- a/platform/linux-generic/odp_queue.c
+++ b/platform/linux-generic/odp_queue.c
@@ -226,6 +226,7 @@  odp_queue_t odp_queue_create(const char *name, odp_queue_type_t type,
 
 		buf = odp_schedule_buffer_alloc(handle);
 		if (buf == ODP_BUFFER_INVALID) {
+			queue->s.status = QUEUE_STATUS_FREE;
 			ODP_ERR("queue_init: sched buf alloc failed\n");
 			return ODP_QUEUE_INVALID;
 		}