]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
virtio-mem: Destroy mutex before freeing virtio_mem
authorMaurice Hieronymus <mhi@mailbox.org>
Sun, 23 Nov 2025 17:57:49 +0000 (18:57 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 10 Jun 2026 06:16:59 +0000 (02:16 -0400)
Add a call to mutex_destroy in the error code path as well as in the
virtio_mem_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-3-mhi@mailbox.org>

drivers/virtio/virtio_mem.c

index 48051e9e98abf7b8259126261be75abc572f46a7..11c4415015829d5803e66201a73ade6dc9a46579 100644 (file)
@@ -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;
 }