mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-27 06:34:11 +08:00
Staging: hv: vmbus: Properly handle memory allocation failure in channel.c
Properly handle memory allocation failure in channel.c. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: Abhishek Kane <v-abkane@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
40961de335
commit
f38cf9ccd6
@ -355,9 +355,24 @@ static int create_gpadl_header(void *kbuffer, u32 size,
|
|||||||
sizeof(struct vmbus_channel_gpadl_body) +
|
sizeof(struct vmbus_channel_gpadl_body) +
|
||||||
pfncurr * sizeof(u64);
|
pfncurr * sizeof(u64);
|
||||||
msgbody = kzalloc(msgsize, GFP_KERNEL);
|
msgbody = kzalloc(msgsize, GFP_KERNEL);
|
||||||
/* FIXME: we probably need to more if this fails */
|
|
||||||
if (!msgbody)
|
if (!msgbody) {
|
||||||
|
struct vmbus_channel_msginfo *pos = NULL;
|
||||||
|
struct vmbus_channel_msginfo *tmp = NULL;
|
||||||
|
/*
|
||||||
|
* Free up all the allocated messages.
|
||||||
|
*/
|
||||||
|
list_for_each_entry_safe(pos, tmp,
|
||||||
|
&msgheader->submsglist,
|
||||||
|
msglistentry) {
|
||||||
|
|
||||||
|
list_del(&pos->msglistentry);
|
||||||
|
kfree(pos);
|
||||||
|
}
|
||||||
|
|
||||||
goto nomem;
|
goto nomem;
|
||||||
|
}
|
||||||
|
|
||||||
msgbody->msgsize = msgsize;
|
msgbody->msgsize = msgsize;
|
||||||
(*messagecount)++;
|
(*messagecount)++;
|
||||||
gpadl_body =
|
gpadl_body =
|
||||||
|
Loading…
Reference in New Issue
Block a user