From: Johan Hovold Date: Fri, 27 Mar 2015 11:41:14 +0000 (+0100) Subject: greybus: operation: fix memory leak in request_send error path X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ea2c2ee80571388ef4641597c00ca10da3728127;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Reviewed-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c index ad45dee19a5a..dcf987fb103d 100644 --- a/drivers/staging/greybus/operation.c +++ b/drivers/staging/greybus/operation.c @@ -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);