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 E350229D288; Sat, 12 Sep 2026 19:54:24 +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=1789242866; cv=none; b=vBX5SyATcLdrklnBEt79Z7OjWfKqdSF/Z/9P3hMne6XvKyFBQ+g6CwuObE/mTz3w16vb8iXX1cBoW1i32t5HivNNk2pqkzjaDwAOecy3cUE073LeXfLwpbQcQE1Lv5nj++nsZ7PGUPu+ufQEOQ0dRiZgkYuHmzMKQm4NJxovZfQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789242866; c=relaxed/simple; bh=7WvdhJ1W+vu0oecNV34IzoqAlCu+UbSy6VOt8+h7l0k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=p0gidXglsIuxN3+QNBkwIABY834t6GGe2LpmZt3zT2Rib7XdwvsGCV72yj6DFcrJEEDWzD9jSpUrLQyBUOM0swYsV3ei8eMSXbHeJ9vNr5+PL+urboI4un/deVFtvOrXJo/U4D/AMzN8DhhQOqcpQQZpSwrqzP6Zz08S5evvJjE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=hK/21N6G; 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="hK/21N6G" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A3001F000FF; Sat, 12 Sep 2026 19:54:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789242864; bh=U4rs5dWLePvuyiPaDHcusJd/tLXpxqSSHb8bCGhBgSs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=hK/21N6GknX2E9ZSLB5QWdCAYMT4z0RPuBUlw9JhfVr9hWjsJXHYzN/bFibmLFDF9 36VPu9qdHP1Cq0KIHgWQGaDLib0G8kAg87yG2UfzwyRw9J0rG6ktggTokBsFdL+NZb c7CQlzgu4P65JgtM8524Feqc/BPZvQ/EEzld6uAA= 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 5.10 553/798] misc: vmc_vmci: Fix potential memory leak in vmci_event_subscribe() Date: Sat, 12 Sep 2026 09:03:01 +0200 Message-ID: <20260912065529.804669887@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065516.948645775@linuxfoundation.org> References: <20260912065516.948645775@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 5.10-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 5b7ef47f4c118..a9456c552c2f8 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