Commit ea2c2ee8 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

greybus: operation: fix memory leak in request_send error path

Make sure to drop the operation reference when sending the request fails
to avoid leaking the operation structures.
Signed-off-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Reviewed-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 0fb5acc4
...@@ -643,6 +643,7 @@ int gb_operation_request_send(struct gb_operation *operation, ...@@ -643,6 +643,7 @@ int gb_operation_request_send(struct gb_operation *operation,
struct gb_connection *connection = operation->connection; struct gb_connection *connection = operation->connection;
struct gb_operation_msg_hdr *header; struct gb_operation_msg_hdr *header;
unsigned int cycle; unsigned int cycle;
int ret;
if (!callback) if (!callback)
return -EINVAL; return -EINVAL;
...@@ -675,7 +676,11 @@ int gb_operation_request_send(struct gb_operation *operation, ...@@ -675,7 +676,11 @@ int gb_operation_request_send(struct gb_operation *operation,
/* All set, send the request */ /* All set, send the request */
gb_operation_result_set(operation, -EINPROGRESS); gb_operation_result_set(operation, -EINPROGRESS);
return gb_message_send(operation->request); ret = gb_message_send(operation->request);
if (ret)
gb_operation_put(operation);
return ret;
} }
EXPORT_SYMBOL_GPL(gb_operation_request_send); EXPORT_SYMBOL_GPL(gb_operation_request_send);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment