Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6712cc9c authored by Stephen Hemminger's avatar Stephen Hemminger Committed by Greg Kroah-Hartman
Browse files

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: c2e5df61 ("vmbus: add per-channel sysfs info")

Signed-off-by: default avatarStephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Cc: <stable@vger.kernel.org> # 4.15
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 029d727b
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -1291,6 +1291,9 @@ static ssize_t vmbus_chan_attr_show(struct kobject *kobj,
	if (!attribute->show)
	if (!attribute->show)
		return -EIO;
		return -EIO;


	if (chan->state != CHANNEL_OPENED_STATE)
		return -EINVAL;

	return attribute->show(chan, buf);
	return attribute->show(chan, buf);
}
}