From: Dexuan Cui Date: Fri, 27 Feb 2015 19:26:00 +0000 (-0800) Subject: hv: vmbus_open(): reset the channel state on ENOMEM X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ac0d12b7cee73b4b4b769ea58c62ec7042c6be13;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git hv: vmbus_open(): reset the channel state on ENOMEM Without this patch, the state is put to CHANNEL_OPENING_STATE, and when the driver is loaded next time, vmbus_open() will fail immediately due to newchannel->state != CHANNEL_OPEN_STATE. CC: "K. Y. Srinivasan" Signed-off-by: Dexuan Cui Reviewed-by: Jason Wang Signed-off-by: K. Y. Srinivasan Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index 2978f5ee8d2a..26dcf268b093 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c @@ -89,9 +89,10 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, out = (void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, get_order(send_ringbuffer_size + recv_ringbuffer_size)); - if (!out) - return -ENOMEM; - + if (!out) { + err = -ENOMEM; + goto error0; + } in = (void *)((unsigned long)out + send_ringbuffer_size); @@ -199,6 +200,7 @@ error0: free_pages((unsigned long)out, get_order(send_ringbuffer_size + recv_ringbuffer_size)); kfree(open_info); + newchannel->state = CHANNEL_OPEN_STATE; return err; } EXPORT_SYMBOL_GPL(vmbus_open);