[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180820211640.5837-1-kys@linuxonhyperv.com>
Date: Mon, 20 Aug 2018 21:16:40 +0000
From: kys@...uxonhyperv.com
To: gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
devel@...uxdriverproject.org, olaf@...fle.de, apw@...onical.com,
jasowang@...hat.com, sthemmin@...rosoft.com,
Michael.H.Kelley@...rosoft.com, vkuznets@...hat.com
Cc: Stephen Hemminger <stephen@...workplumber.org>,
"K . Y . Srinivasan" <kys@...rosoft.com>, stable@...r.kernel.org
Subject: [PATCH] vmbus: don't return values for uninitalized channels
From: Stephen Hemminger <stephen@...workplumber.org>
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@...rosoft.com>
Signed-off-by: K. Y. Srinivasan <kys@...rosoft.com>
Cc: <stable@...r.kernel.org> # 4.15
---
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 e6d8fdac6d8b..4bbc420d1213 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -1368,6 +1368,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.18.0
Powered by blists - more mailing lists