diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2013-06-06 14:20:39 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-06-11 11:46:21 +0200 |
commit | 05c05351943cc03bf5c77e86953b24ae6fb21368 (patch) | |
tree | 51274c86eeca2cd5040979d1fdebd81fe0518a19 /drivers/vhost/vhost.c | |
parent | qmi_wwan/cdc_ether: let qmi_wwan handle the Huawei E1820 (diff) | |
download | linux-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/vhost.c')
-rw-r--r-- | drivers/vhost/vhost.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index beee7f5787e6..60aa5ad09a2f 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -344,13 +344,19 @@ static int vhost_attach_cgroups(struct vhost_dev *dev) } /* Caller should have device mutex */ +bool vhost_dev_has_owner(struct vhost_dev *dev) +{ + return dev->mm; +} + +/* Caller should have device mutex */ long vhost_dev_set_owner(struct vhost_dev *dev) { struct task_struct *worker; int err; /* Is there an owner already? */ - if (dev->mm) { + if (vhost_dev_has_owner(dev)) { err = -EBUSY; goto err_mm; } |