[bionic/linux-azure][PATCH] UBUNTU: SAUCE: vmbus: don't return values for uninitalized channels
Marcelo Henrique Cerri
marcelo.cerri at canonical.com
Fri Aug 31 12:52:43 UTC 2018
From: Stephen Hemminger <stephen at networkplumber.org>
BugLink: http://bugs.launchpad.net/bugs/1789638
For unsupported device types, the vmbus channel ringbuffer is never
initialized, and therefore reading the sysfs files will return garbage
or cause a kernel OOPS.
Fixes: c2e5df616e1a ("vmbus: add per-channel sysfs info")
Signed-off-by: Stephen Hemminger <sthemmin at microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys at microsoft.com>
Cc: <stable at vger.kernel.org> # 4.15
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri at canonical.com>
---
drivers/hv/vmbus_drv.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 610223f0e945..4652990f0298 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -1180,6 +1180,9 @@ static ssize_t vmbus_chan_attr_show(struct kobject *kobj,
if (!attribute->show)
return -EIO;
+ if (chan->state != CHANNEL_OPENED_STATE)
+ return -EINVAL;
+
return attribute->show(chan, buf);
}
--
2.17.1
More information about the kernel-team
mailing list