* [PATCH] vmbus: don't return values for uninitalized channels
@ 2018-08-20 21:16 kys
2018-08-30 11:59 ` Vitaly Kuznetsov
0 siblings, 1 reply; 2+ messages in thread
From: kys @ 2018-08-20 21:16 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, olaf, apw, jasowang, sthemmin,
Michael.H.Kelley, vkuznets
Cc: Stephen Hemminger, K . Y . Srinivasan, stable
From: Stephen Hemminger <stephen@networkplumber.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@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Cc: <stable@vger.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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] vmbus: don't return values for uninitalized channels
2018-08-20 21:16 [PATCH] vmbus: don't return values for uninitalized channels kys
@ 2018-08-30 11:59 ` Vitaly Kuznetsov
0 siblings, 0 replies; 2+ messages in thread
From: Vitaly Kuznetsov @ 2018-08-30 11:59 UTC (permalink / raw)
To: gregkh, kys
Cc: linux-kernel, devel, olaf, apw, jasowang, sthemmin,
Michael.H.Kelley, kys, stable
kys@linuxonhyperv.com writes:
> From: Stephen Hemminger <stephen@networkplumber.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@microsoft.com>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> Cc: <stable@vger.kernel.org> # 4.15
As this is also marked for stable, any chance we can get it in 4.19? Or
at least in char-misc-next?
> ---
> 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);
> }
Thanks,
--
Vitaly
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-08-30 11:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-20 21:16 [PATCH] vmbus: don't return values for uninitalized channels kys
2018-08-30 11:59 ` Vitaly Kuznetsov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.