summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/loopback.c
diff options
context:
space:
mode:
authorBryan O'Donoghue2015-12-11 14:46:51 +0100
committerGreg Kroah-Hartman2015-12-12 01:16:01 +0100
commitc7aae4e613ef471f9f785e4b85de4d46d552c86b (patch)
tree96d44aa7a724e51b736ae7eaf26c24cb5dbc5771 /drivers/staging/greybus/loopback.c
parentgreybus: loopback: Drop NULL check on container_of pointer (diff)
downloadkernel-qcow2-linux-c7aae4e613ef471f9f785e4b85de4d46d552c86b.tar.gz
kernel-qcow2-linux-c7aae4e613ef471f9f785e4b85de4d46d552c86b.tar.xz
kernel-qcow2-linux-c7aae4e613ef471f9f785e4b85de4d46d552c86b.zip
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/staging/greybus/loopback.c')
-rw-r--r--drivers/staging/greybus/loopback.c4
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)