Message ID | 20180831125243.10245-1-marcelo.cerri@canonical.com |
---|---|
State | New |
Headers | show |
Series | [bionic/linux-azure] UBUNTU: SAUCE: vmbus: don't return values for uninitalized channels | expand |
On 31/08/18 13:52, Marcelo Henrique Cerri wrote: > From: Stephen Hemminger <stephen@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@microsoft.com> > Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> > Cc: <stable@vger.kernel.org> # 4.15 > Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@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); > } > > Just wondering, should this be in all bionic kernels too? I debugged the original issue so I understand the bug well enough to confirm this is a good fix + it passes the tests and fixes the issue. Acked-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
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); }