diff options
author | Bryan O'Donoghue <bryan.odonoghue@linaro.org> | 2015-12-11 13:46:51 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2015-12-11 16:16:01 -0800 |
commit | c7aae4e613ef471f9f785e4b85de4d46d552c86b (patch) | |
tree | 96d44aa7a724e51b736ae7eaf26c24cb5dbc5771 /drivers | |
parent | 578a0ab8dd02f1de4b3b0e7b227ff78ae54fa4e1 (diff) | |
download | linux-c7aae4e613ef471f9f785e4b85de4d46d552c86b.tar.bz2 |
greybus: loopback: Retrun -ENOMEM if operation allocation fails
If operation allocation fails we should return -ENOMEM in the asynchronous
operation send routine. If we don't return here then the
gb_loopback_async_operation_put() later can dereference a NULL pointer if
the previous gb_operation_create() failed.
Reported-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/greybus/loopback.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c index 0828772fc901..eb6a0138fb1d 100644 --- a/drivers/staging/greybus/loopback.c +++ b/drivers/staging/greybus/loopback.c @@ -580,8 +580,8 @@ static int gb_loopback_async_operation(struct gb_loopback *gb, int type, operation = gb_operation_create(gb->connection, type, request_size, response_size, GFP_KERNEL); if (!operation) { - ret = -ENOMEM; - goto error; + kfree(op_async); + return -ENOMEM; } if (request_size) |