[bionic/linux-azure][PATCH] UBUNTU: SAUCE: vmbus: don't return values for uninitalized channels

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[bionic/linux-azure][PATCH] UBUNTU: SAUCE: vmbus: don't return values for uninitalized channels

Marcelo Henrique Cerri
From: Stephen Hemminger <[hidden email]>

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 <[hidden email]>
Signed-off-by: K. Y. Srinivasan <[hidden email]>
Cc: <[hidden email]> # 4.15
Signed-off-by: Marcelo Henrique Cerri <[hidden email]>
---
 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


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [bionic/linux-azure][PATCH] UBUNTU: SAUCE: vmbus: don't return values for uninitalized channels

Colin Ian King-2
On 31/08/18 13:52, Marcelo Henrique Cerri wrote:

> From: Stephen Hemminger <[hidden email]>
>
> 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 <[hidden email]>
> Signed-off-by: K. Y. Srinivasan <[hidden email]>
> Cc: <[hidden email]> # 4.15
> Signed-off-by: Marcelo Henrique Cerri <[hidden email]>
> ---
>  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 <[hidden email]>

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [bionic/linux-azure][PATCH] UBUNTU: SAUCE: vmbus: don't return values for uninitalized channels

Po-Hsu Lin (Sam)
In reply to this post by Marcelo Henrique Cerri
Acked-by: Po-Hsu Lin <[hidden email]>

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

APPLIED: [bionic/linux-azure][PATCH] UBUNTU: SAUCE: vmbus: don't return values for uninitalized channels

Marcelo Henrique Cerri
In reply to this post by Marcelo Henrique Cerri