diff options
Diffstat (limited to 'drivers/vhost/vhost.c')
-rw-r--r-- | drivers/vhost/vhost.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index ae66278e4dcf..385d8ee0d2d1 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -405,7 +405,7 @@ long vhost_dev_reset_owner(struct vhost_dev *dev) | |||
405 | if (!memory) | 405 | if (!memory) |
406 | return -ENOMEM; | 406 | return -ENOMEM; |
407 | 407 | ||
408 | vhost_dev_cleanup(dev); | 408 | vhost_dev_cleanup(dev, true); |
409 | 409 | ||
410 | memory->nregions = 0; | 410 | memory->nregions = 0; |
411 | RCU_INIT_POINTER(dev->memory, memory); | 411 | RCU_INIT_POINTER(dev->memory, memory); |
@@ -436,8 +436,8 @@ int vhost_zerocopy_signal_used(struct vhost_virtqueue *vq) | |||
436 | return j; | 436 | return j; |
437 | } | 437 | } |
438 | 438 | ||
439 | /* Caller should have device mutex */ | 439 | /* Caller should have device mutex if and only if locked is set */ |
440 | void vhost_dev_cleanup(struct vhost_dev *dev) | 440 | void vhost_dev_cleanup(struct vhost_dev *dev, bool locked) |
441 | { | 441 | { |
442 | int i; | 442 | int i; |
443 | 443 | ||
@@ -474,7 +474,8 @@ void vhost_dev_cleanup(struct vhost_dev *dev) | |||
474 | dev->log_file = NULL; | 474 | dev->log_file = NULL; |
475 | /* No one will access memory at this point */ | 475 | /* No one will access memory at this point */ |
476 | kfree(rcu_dereference_protected(dev->memory, | 476 | kfree(rcu_dereference_protected(dev->memory, |
477 | lockdep_is_held(&dev->mutex))); | 477 | locked == |
478 | lockdep_is_held(&dev->mutex))); | ||
478 | RCU_INIT_POINTER(dev->memory, NULL); | 479 | RCU_INIT_POINTER(dev->memory, NULL); |
479 | WARN_ON(!list_empty(&dev->work_list)); | 480 | WARN_ON(!list_empty(&dev->work_list)); |
480 | if (dev->worker) { | 481 | if (dev->worker) { |