diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2015-01-12 09:23:37 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2015-01-21 00:58:45 -0500 |
commit | 7754f53e944122fa95ef36039d3a5009910ce6fc (patch) | |
tree | 71b287d6c4585270ce40b22764577a9c8afbace0 /net | |
parent | 7f870c81a068fd1e69fe556f7fe85a5ece144b0c (diff) |
virtio/9p: verify device has config space
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 <mst@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'net')
-rw-r--r-- | net/9p/trans_virtio.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index daa749c8b3fb..d8e376a5f0f1 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c | |||
@@ -524,6 +524,12 @@ static int p9_virtio_probe(struct virtio_device *vdev) | |||
524 | int err; | 524 | int err; |
525 | struct virtio_chan *chan; | 525 | struct virtio_chan *chan; |
526 | 526 | ||
527 | if (!vdev->config->get) { | ||
528 | dev_err(&vdev->dev, "%s failure: config access disabled\n", | ||
529 | __func__); | ||
530 | return -EINVAL; | ||
531 | } | ||
532 | |||
527 | chan = kmalloc(sizeof(struct virtio_chan), GFP_KERNEL); | 533 | chan = kmalloc(sizeof(struct virtio_chan), GFP_KERNEL); |
528 | if (!chan) { | 534 | if (!chan) { |
529 | pr_err("Failed to allocate virtio 9P channel\n"); | 535 | pr_err("Failed to allocate virtio 9P channel\n"); |