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

greybus: operation: fix null-deref on operation destroy

Incoming operations are created without a response message. If a
protocol driver fails to send a response, or if the operation were to be
cancelled before it has been fully processed, we get a null-pointer
dereference when the operation is released.
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 772f3e90
...@@ -607,7 +607,8 @@ static void _gb_operation_destroy(struct kref *kref) ...@@ -607,7 +607,8 @@ static void _gb_operation_destroy(struct kref *kref)
list_del(&operation->links); list_del(&operation->links);
spin_unlock_irqrestore(&gb_operations_lock, flags); spin_unlock_irqrestore(&gb_operations_lock, flags);
gb_operation_message_free(operation->response); if (operation->response)
gb_operation_message_free(operation->response);
gb_operation_message_free(operation->request); gb_operation_message_free(operation->request);
kmem_cache_free(gb_operation_cache, operation); kmem_cache_free(gb_operation_cache, operation);
......
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