Skip to content

Commit

Permalink
virtio/9p: verify device has config space
Browse files Browse the repository at this point in the history
Some devices might not implement config space access
(e.g. remoteproc used not to - before 3.9).
virtio/9p needs config space access so make it
fail gracefully if not there.

Signed-off-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
mstsirkin authored and rustyrussell committed Jan 21, 2015
1 parent 7f870c8 commit 7754f53
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions net/9p/trans_virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,12 @@ static int p9_virtio_probe(struct virtio_device *vdev)
int err;
struct virtio_chan *chan;

if (!vdev->config->get) {
dev_err(&vdev->dev, "%s failure: config access disabled\n",
__func__);
return -EINVAL;
}

chan = kmalloc(sizeof(struct virtio_chan), GFP_KERNEL);
if (!chan) {
pr_err("Failed to allocate virtio 9P channel\n");
Expand Down

0 comments on commit 7754f53

Please sign in to comment.