]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
virtio-balloon: Destroy mutex before freeing virtio_balloon
authorMaurice Hieronymus <mhi@mailbox.org>
Sun, 23 Nov 2025 17:57:48 +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
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>

drivers/virtio/virtio_balloon.c

index f6c2dff33f8af0431da6001ace333eb5d0a5ee21..088b3a0e6ce6cc776ea144edd53fa73dc785bb91 100644 (file)
@@ -1075,6 +1075,7 @@ out_del_balloon_wq:
 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);
 }