public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: gregkh@linuxfoundation.org, kys@linuxonhyperv.com
Cc: linux-kernel@vger.kernel.org, devel@linuxdriverproject.org,
	olaf@aepfle.de, apw@canonical.com, jasowang@redhat.com,
	sthemmin@microsoft.com, Michael.H.Kelley@microsoft.com,
	kys@microsoft.com, stable@vger.kernel.org
Subject: Re: [PATCH] vmbus: don't return values for uninitalized channels
Date: Thu, 30 Aug 2018 13:59:11 +0200	[thread overview]
Message-ID: <874lfcgj5c.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <20180820211640.5837-1-kys@linuxonhyperv.com> (kys@linuxonhyperv.com's message of "Mon, 20 Aug 2018 21:16:40 +0000")

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

      reply	other threads:[~2018-08-30 11:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-20 21:16 [PATCH] vmbus: don't return values for uninitalized channels kys
2018-08-30 11:59 ` Vitaly Kuznetsov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874lfcgj5c.fsf@vitty.brq.redhat.com \
    --to=vkuznets@redhat.com \
    --cc=Michael.H.Kelley@microsoft.com \
    --cc=apw@canonical.com \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jasowang@redhat.com \
    --cc=kys@linuxonhyperv.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olaf@aepfle.de \
    --cc=stable@vger.kernel.org \
    --cc=sthemmin@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox