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.

Signed-off-by: Maurice Hieronymus <mhi@mailbox.org>
Acked-by: David Hildenbrand (Red Hat) <david@kernel.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20251123175750.445461-2-mhi@mailbox.org>
This commit is contained in:
Maurice Hieronymus 2025-11-23 18:57:48 +01:00 committed by Michael S. Tsirkin
parent 3afcb36309
commit 7c59cc9cf7

View File

@ -1075,6 +1075,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;
@ -1119,6 +1120,7 @@ static void virtballoon_remove(struct virtio_device *vdev)
}
remove_common(vb);
mutex_destroy(&vb->balloon_lock);
kfree(vb);
}