Add calls to mutex_destroy in virtio_balloon and virtio_mem
Subsystems (3)
cover Add calls to mutex_destroy in virtio_balloon and virtio_mem
In [1] it is pointed out that each mutex_init call should have a corresponding call to mutex_destroy; otherwise, it is considered a bug.
This patch adds the calls to mutex_destroy in virtio_balloon as well as virtio_mem.
Maurice Hieronymus (2):
virtio-balloon: Destroy mutex before freeing virtio_balloon
virtio-mem: Destroy mutex before freeing virtio_mem
drivers/virtio/virtio_balloon.c | 2 ++ drivers/virtio/virtio_mem.c | 2 ++ 2 files changed, 4 insertions(+)
base-commit: d13f3ac64efb868d09cb2726b1e84929afe90235
Signature · 1 line
2.50.1
PATCH 1/2 virtio-balloon: Destroy mutex before freeing virtio_balloon
Add a call to mutex_destroy in the error code path as well as in the virtballoon_remove code path.
--- drivers/virtio/virtio_balloon.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/virtio/virtio_balloon.c +2 -0
@@ -1094,6 +1094,7 @@ static int virtballoon_probe(struct virtio_device *vdev) out_del_vqs: vdev->config->del_vqs (vdev); out_free_vb: +mutex_destroy (&vb->balloon_lock);kfree (vb); out:return err;
@@ -1138,6 +1139,7 @@ static void virtballoon_remove(struct virtio_device *vdev) }remove_common (vb); +mutex_destroy (&vb->balloon_lock);kfree (vb); }
Signature · 1 line
2.50.1
Re: [PATCH 1/2] virtio-balloon: Destroy mutex before freeing virtio_balloon
Quoted 4 lines · Maurice Hieronymus
Add a call to
mutex_destroyin the error code path as well as in thevirtballoon_removecode path.Signed-off-by Maurice Hieronymus <[email protected]>
Signature · 3 lines
Cheers David
PATCH 2/2 virtio-mem: Destroy mutex before freeing virtio_mem
In reply to Maurice HieronymusAdd a call to mutex_destroy in the error code path as well as in the virtio_mem_remove code path.
--- drivers/virtio/virtio_mem.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/virtio/virtio_mem.c +2 -0
@@ -2975,6 +2975,7 @@ static int virtio_mem_probe(struct virtio_device *vdev) out_del_vq: vdev->config->del_vqs (vdev); out_free_vm: +mutex_destroy (&vm->hotplug_mutex);kfree (vm); vdev->priv =NULL ;
@@ -3067,6 +3068,7 @@ static void virtio_mem_remove(struct virtio_device *vdev)virtio_reset_device (vdev); vdev->config->del_vqs (vdev); +mutex_destroy (&vm->hotplug_mutex);kfree (vm); vdev->priv =NULL ; }
Signature · 1 line
2.50.1
Re: [PATCH 2/2] virtio-mem: Destroy mutex before freeing virtio_mem
Quoted 5 lines · Maurice Hieronymus
Add a call to
mutex_destroyin the error code path as well as in thevirtio_mem_removecode path.Signed-off-by Maurice Hieronymus <[email protected]>---
Signature · 3 lines
Cheers David
David Hildenbrand (Red Hat)
maintainerQuoted 2 lines · Maurice Hieronymus
In [1] it is pointed out that each
mutex_initcall should have a corresponding call tomutex_destroy; otherwise, it is considered a bug.
IIUC, mutex_destroy() only ever does something during with CONFIG_DEBUG_MUTEXES. And there, it performs mostly sanity checks (so it's not some missed memory freeing etc).
I wonder whether we should still ad Fixes tags.
Signature · 3 lines
Cheers David