summaryrefslogtreecommitdiffstats
path: root/drivers/vhost/net.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2013-06-06 14:20:39 +0200
committerDavid S. Miller <davem@davemloft.net>2013-06-11 11:46:21 +0200
commit05c05351943cc03bf5c77e86953b24ae6fb21368 (patch)
tree51274c86eeca2cd5040979d1fdebd81fe0518a19 /drivers/vhost/net.c
parentqmi_wwan/cdc_ether: let qmi_wwan handle the Huawei E1820 (diff)
downloadlinux-05c05351943cc03bf5c77e86953b24ae6fb21368.tar.xz
linux-05c05351943cc03bf5c77e86953b24ae6fb21368.zip
vhost: check owner before we overwrite ubuf_info
If device has an owner, we shouldn't touch ubuf_info since it might be in use. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/vhost/net.c')
-rw-r--r--drivers/vhost/net.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index b07d96b8c0d1..8cf5aece8c84 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -1054,6 +1054,10 @@ static long vhost_net_set_owner(struct vhost_net *n)
int r;
mutex_lock(&n->dev.mutex);
+ if (vhost_dev_has_owner(&n->dev)) {
+ r = -EBUSY;
+ goto out;
+ }
r = vhost_net_set_ubuf_info(n);
if (r)
goto out;