[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] xen: fix memory leak on error in vcpu_create


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Date: Mon, 28 Jul 2025 15:52:44 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yBzOoW8r1k77r3Pka0LshNPmTSwghiAK8xr8qcTkfBc=; b=yK7YM8SqMuUxZibifGhVkK3DgIOE5pYTgO1WpRYHFzukmd686Ra9DnfQkrwsiXLahIZbkKOiELI9ACfZK7LzIyNf1ON0xZH37Co4c7sABhQIJnnMlG1XrV/+GZe5JZ3wzsRXnVMv70u/fP4tlKcOx9TvtVnXhFLBhkNlCL7wakiQg3EdKwpQ5SF53Rd3Mkho4ApOzA5a0xzIAy4ImZKTcdKlKGVOXzXBWj4HK5jb6oCTYwtHVxsGkfFolGjVJKhGxYF2O7rjhzNBka70ePilaOVqlMoNkBI+HlQKzQLA9YxaQ2tn7cK/3/7Q2tW31hCDqQU7uXcVGIodkm0KzXhAEA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YhBIpfklX6Kyi452qvZFUDiPHVFkiOHWbT3U4/PYVWCe2oLMDsGBI2+HqHGV3zCAV+LA+dPAwY39QyAbNti6q55kwwBtwVwwaGYn9dUGkIa6G3vJnD7hCTZLZkkoTxh5rGt31Xt30JEnaGmfkhPQu40sDpnnhTHu7VRJQATHKdyVFI6k031Ev3OIXf4hioXHz0+4AHst1SsUZXRofZySxrF5r9E3JOrP2ERqm2VTS8UOlKYjmTHb1YTsieaJjBNwgMexVHBigXIiMyJUcsRU/HRZYcZhudMQShrLQtLHJABf1MbAKvWYNtC0PJdfwGNJfFBHdG+p0AKsWXdzjdPR0A==
  • Cc: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, "Julien Grall" <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Mon, 28 Jul 2025 19:53:10 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

In vcpu_create after scheduler data is allocated, if
vmtrace_alloc_buffer fails, it will jump to the wrong cleanup label
resulting in a memory leak. Correct the label.

Fixes: 217dd79ee292 ("xen/domain: Add vmtrace_size domain creation parameter")
Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
---
 xen/common/domain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 3c65cca5b0ff..b1e2709d3d82 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -451,7 +451,7 @@ struct vcpu *vcpu_create(struct domain *d, unsigned int 
vcpu_id)
         goto fail_wq;
 
     if ( vmtrace_alloc_buffer(v) != 0 )
-        goto fail_wq;
+        goto fail_sched;
 
     if ( arch_vcpu_create(v) != 0 )
         goto fail_sched;

base-commit: a845b50c12f3ec3a14255f5eb3062d0c9801a356
-- 
2.50.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.