Skip to content

Commit 46dc284

Browse files
shemmingermerwick
authored andcommitted
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: c2e5df6 ("vmbus: add per-channel sysfs info") Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: K. Y. Srinivasan <[email protected]> Cc: <[email protected]> # 4.15 Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit 6712cc9) Orabug: 28671425 Signed-off-by: Liam Merwick <[email protected]> Reviewed-by: Darren Kenny <[email protected]> Reviewed-by: Alejandro Jimenez <[email protected]> Tested-by: Vijay Balakrishna <[email protected]>
1 parent fbad4a4 commit 46dc284

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/hv/vmbus_drv.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,6 +1291,9 @@ static ssize_t vmbus_chan_attr_show(struct kobject *kobj,
12911291
if (!attribute->show)
12921292
return -EIO;
12931293

1294+
if (chan->state != CHANNEL_OPENED_STATE)
1295+
return -EINVAL;
1296+
12941297
return attribute->show(chan, buf);
12951298
}
12961299

0 commit comments

Comments
 (0)