Skip to content

Commit

Permalink
Drivers: hv: don't leak memory in vmbus_establish_gpadl()
Browse files Browse the repository at this point in the history
In some cases create_gpadl_header() allocates submessages but we never
free them.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
vittyvk authored and gregkh committed Aug 31, 2016
1 parent 4d63763 commit 7cc80c9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/hv/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
struct vmbus_channel_gpadl_header *gpadlmsg;
struct vmbus_channel_gpadl_body *gpadl_body;
struct vmbus_channel_msginfo *msginfo = NULL;
struct vmbus_channel_msginfo *submsginfo;
struct vmbus_channel_msginfo *submsginfo, *tmp;
struct list_head *curr;
u32 next_gpadl_handle;
unsigned long flags;
Expand Down Expand Up @@ -445,6 +445,10 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_del(&msginfo->msglistentry);
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
list_for_each_entry_safe(submsginfo, tmp, &msginfo->submsglist,
msglistentry) {
kfree(submsginfo);
}

kfree(msginfo);
return ret;
Expand Down

0 comments on commit 7cc80c9

Please sign in to comment.