aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <stephen@networkplumber.org>2018-08-20 17:16:40 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-12 03:31:00 -0400
commit6712cc9c22117a8af9f3df272b4a44fd2e4201cd (patch)
treea611d54ecc7834995fc5f3371d8ccdb1ba652a79
parent029d727b4f5d7c82f78e0395a0d220271c2f92b8 (diff)
vmbus: don't return values for uninitalized channels
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/hv/vmbus_drv.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index b1b548a21f91..c71cc857b649 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -1291,6 +1291,9 @@ static ssize_t vmbus_chan_attr_show(struct kobject *kobj,
1291 if (!attribute->show) 1291 if (!attribute->show)
1292 return -EIO; 1292 return -EIO;
1293 1293
1294 if (chan->state != CHANNEL_OPENED_STATE)
1295 return -EINVAL;
1296
1294 return attribute->show(chan, buf); 1297 return attribute->show(chan, buf);
1295} 1298}
1296 1299