mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-05 16:37:50 +00:00
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: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
This commit is contained in:
parent
0fb5acc401
commit
ea2c2ee805
1 changed files with 6 additions and 1 deletions
|
@ -643,6 +643,7 @@ int gb_operation_request_send(struct gb_operation *operation,
|
|||
struct gb_connection *connection = operation->connection;
|
||||
struct gb_operation_msg_hdr *header;
|
||||
unsigned int cycle;
|
||||
int ret;
|
||||
|
||||
if (!callback)
|
||||
return -EINVAL;
|
||||
|
@ -675,7 +676,11 @@ int gb_operation_request_send(struct gb_operation *operation,
|
|||
/* All set, send the request */
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue