From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3EFBC30DEA6; Sat, 12 Sep 2026 12:42:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789216940; cv=none; b=Aud+HIKXulImTV1mpnwpHRAfb5cHqu/ppnJZkOYicNZZXtksfj6a3dsf+Es3A2lsu/KiFSIDUAW26oKabJ56OOd9MhLFxEg5EIh4ngY2FA/8NOUlIJj96gL6k8Gsy4KfXhUv0BkqZoM1R6m/UBOXu8KI15HSJFLYC5oojRy3bLs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789216940; c=relaxed/simple; bh=vJb4JEG1qhfGRGgaagzVgGdRXcCEBZolBRM2zCxn8Cc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kuve917hjWZHqpJYAcCa7L2CfxddwKoWoVO2DmLE7RCbdRiWVF7U0taoNvRI2F6oFIi4WL04eTrcvvo5zqH3u3PRX88W+ci5GwCEBPe3YJaYvRUpN4+7a2qhv0P23BCQH09FlFQ2uSx8jPUZLa6OqKKQqPDzw8Jdn0wEnjytX6w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=sTQHMWnL; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="sTQHMWnL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 103EA1F000FF; Sat, 12 Sep 2026 12:42:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789216939; bh=yqe9afIIS3hx8ri3flR12s4ivXoE+lQavtQpWEBQYjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=sTQHMWnLOidOcjLdAqg6k1OYnNf6iM+kjGUfcszOLZr39ce0dsNLrm1Ck+LERQA4r uMb6VS9mD6qOGBjfFTYuBi0NvHiWtIgKzwYJFC03Xx2tSkotzWQgZv42lUy3uSmOyB rpbKMzdSOQuarFIO0BAyTEGxZqhXZTTlQMoyuuBs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Abdun Nihaal , Vishnu Dasa , Sasha Levin Subject: [PATCH 6.12 0796/1376] misc: vmc_vmci: Fix potential memory leak in vmci_event_subscribe() Date: Sat, 12 Sep 2026 08:53:42 +0200 Message-ID: <20260912065625.276630609@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065607.535295758@linuxfoundation.org> References: <20260912065607.535295758@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Abdun Nihaal [ Upstream commit 210854a96ef18b09b45a2a59ff14ca06dfe5ad4d ] The memory allocated for struct vmci_subscription (sub) is not freed in the error path when have_new_id is false. Fix that by adding a kfree() call, and moving the read of sub->id to a point before freeing. Fixes: 1d990201f9bb ("VMCI: event handling implementation.") Signed-off-by: Abdun Nihaal Acked-by: Vishnu Dasa Link: https://patch.msgid.link/20260722101215.76680-1-nihaal@cse.iitm.ac.in Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/misc/vmw_vmci/vmci_event.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/misc/vmw_vmci/vmci_event.c b/drivers/misc/vmw_vmci/vmci_event.c index 9a41ab65378de..89ab9f05b88c5 100644 --- a/drivers/misc/vmw_vmci/vmci_event.c +++ b/drivers/misc/vmw_vmci/vmci_event.c @@ -179,16 +179,16 @@ int vmci_event_subscribe(u32 event, } } + *new_subscription_id = sub->id; if (have_new_id) { list_add_rcu(&sub->node, &subscriber_array[event]); retval = VMCI_SUCCESS; } else { + kfree(sub); retval = VMCI_ERROR_NO_RESOURCES; } mutex_unlock(&subscriber_mutex); - - *new_subscription_id = sub->id; return retval; } EXPORT_SYMBOL_GPL(vmci_event_subscribe); -- 2.53.0