[PATCH 1/2] virtio-balloon: Destroy mutex before freeing virtio_balloon

Maurice Hieronymus posted 2 patches 1 week, 1 day ago
[PATCH 1/2] virtio-balloon: Destroy mutex before freeing virtio_balloon
Posted by Maurice Hieronymus 1 week, 1 day ago
Add a call to mutex_destroy in the error code path as well as in the
virtballoon_remove code path.

Signed-off-by: Maurice Hieronymus <mhi@mailbox.org>
---
 drivers/virtio/virtio_balloon.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 1b93d8c64361..078b87720a0d 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -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);
 }
 
-- 
2.50.1
Re: [PATCH 1/2] virtio-balloon: Destroy mutex before freeing virtio_balloon
Posted by David Hildenbrand (Red Hat) 1 week ago
On 11/23/25 18:57, Maurice Hieronymus wrote:
> Add a call to mutex_destroy in the error code path as well as in the
> virtballoon_remove code path.
> 
> Signed-off-by: Maurice Hieronymus <mhi@mailbox.org>

Acked-by: David Hildenbrand (Red Hat) <david@kernel.org>

-- 
Cheers

David