Files
linuxkit/alpine/kernel/patches/0019-Drivers-hv-vmbus-do-sanity-check-of-channel-state-in.patch
Rolf Neugebauer de993ec0d9 linux: update kernel to 4.4.21
- removed some Hyper-V patches which were picked up
  between 4.4.20 and 4.4.21
- udate aufs

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2016-09-19 18:20:28 +01:00

43 lines
1.5 KiB
Diff

From a9c4320f47b5a2d2ef7600c5f61f3d4256de2ba5 Mon Sep 17 00:00:00 2001
From: Dexuan Cui <decui@microsoft.com>
Date: Mon, 14 Dec 2015 16:01:48 -0800
Subject: [PATCH 19/42] Drivers: hv: vmbus: do sanity check of channel state in
vmbus_close_internal()
This fixes an incorrect assumption of channel state in the function.
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 64b7faf903dae2df94d89edf2c688b16751800e4)
---
drivers/hv/channel.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 1ef37c7..2889d97 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -512,6 +512,18 @@ static int vmbus_close_internal(struct vmbus_channel *channel)
tasklet = hv_context.event_dpc[channel->target_cpu];
tasklet_disable(tasklet);
+ /*
+ * In case a device driver's probe() fails (e.g.,
+ * util_probe() -> vmbus_open() returns -ENOMEM) and the device is
+ * rescinded later (e.g., we dynamically disble an Integrated Service
+ * in Hyper-V Manager), the driver's remove() invokes vmbus_close():
+ * here we should skip most of the below cleanup work.
+ */
+ if (channel->state != CHANNEL_OPENED_STATE) {
+ ret = -EINVAL;
+ goto out;
+ }
+
channel->state = CHANNEL_OPEN_STATE;
channel->sc_creation_callback = NULL;
/* Stop callback and cancel the timer asap */
--
2.10.0