mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maurice Hieronymus <mhi@mailbox.org>
To: david@kernel.org, mst@redhat.com, jasowang@redhat.com
Cc: virtualization@lists.linux.dev, linux-kernel@vger.kernel.org,
	Maurice Hieronymus <mhi@mailbox.org>
Subject: [PATCH 1/2] virtio-balloon: Destroy mutex before freeing virtio_balloon
Date: Sun, 23 Nov 2025 18:57:48 +0100	[thread overview]
Message-ID: <20251123175750.445461-2-mhi@mailbox.org> (raw)
In-Reply-To: <20251123175750.445461-1-mhi@mailbox.org>

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


  reply	other threads:[~2025-11-23 17:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-23 17:57 [PATCH 0/2] Add calls to mutex_destroy in virtio_balloon and virtio_mem Maurice Hieronymus
2025-11-23 17:57 ` Maurice Hieronymus [this message]
2025-11-24  9:43   ` [PATCH 1/2] virtio-balloon: Destroy mutex before freeing virtio_balloon David Hildenbrand (Red Hat)
2025-11-23 17:57 ` [PATCH 2/2] virtio-mem: Destroy mutex before freeing virtio_mem Maurice Hieronymus
2025-11-24  9:43   ` David Hildenbrand (Red Hat)
2025-11-24  9:42 ` [PATCH 0/2] Add calls to mutex_destroy in virtio_balloon and virtio_mem David Hildenbrand (Red Hat)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251123175750.445461-2-mhi@mailbox.org \
    --to=mhi@mailbox.org \
    --cc=david@kernel.org \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®