From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A410EC433E0 for ; Wed, 24 Feb 2021 13:50:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6358664E2B for ; Wed, 24 Feb 2021 13:50:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235697AbhBXNpP (ORCPT ); Wed, 24 Feb 2021 08:45:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:54798 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234414AbhBXNB0 (ORCPT ); Wed, 24 Feb 2021 08:01:26 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id C9C2564F48; Wed, 24 Feb 2021 12:53:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614171185; bh=SDaAoKhN4M1rL5X4X8nRSY9FAt8oFdpyzhohOMA9ZZQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CWJz3VtzEyfmOi9ia3zbouNmAzcRxV5CUDF/poWImnqCxVhx5NKpJ1utKoyBWmKME NEWBg22bxg0TK4wZ5t3HikrBqMMJN1hE6bsPf5kqmUJTBOL3MviGtfNUc0acyyqcww JkkazSt9ruBoYL4aYR0M/ZGeRXiwyusMYxEXEwhDjzvRX48uCAH+1p2wP6IamajiM2 pQIIfRwzgGW2Y6W2RnDoebKUYBY8/kdBtalDF9NwNXSlvo0A6C1QDk7HDoEkjXarCE HYMp7lUNVJX/jz1WgOcAWvWxCI4HJiXlyE2FKDqKtSD8MP8hfY56DEp0/oaawjUxdQ Ix9lLlGBpRm5A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: "Andrea Parri (Microsoft)" , Juan Vazquez , Michael Kelley , Wei Liu , Sasha Levin , linux-hyperv@vger.kernel.org Subject: [PATCH AUTOSEL 5.10 40/56] Drivers: hv: vmbus: Initialize memory to be sent to the host Date: Wed, 24 Feb 2021 07:51:56 -0500 Message-Id: <20210224125212.482485-40-sashal@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210224125212.482485-1-sashal@kernel.org> References: <20210224125212.482485-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-hyperv@vger.kernel.org From: "Andrea Parri (Microsoft)" [ Upstream commit e99c4afbee07e9323e9191a20b24d74dbf815bdf ] __vmbus_open() and vmbus_teardown_gpadl() do not inizialite the memory for the vmbus_channel_open_channel and the vmbus_channel_gpadl_teardown objects they allocate respectively. These objects contain padding bytes and fields that are left uninitialized and that are later sent to the host, potentially leaking guest data. Zero initialize such fields to avoid leaking sensitive information to the host. Reported-by: Juan Vazquez Signed-off-by: Andrea Parri (Microsoft) Reviewed-by: Michael Kelley Link: https://lore.kernel.org/r/20201209070827.29335-2-parri.andrea@gmail.com Signed-off-by: Wei Liu Signed-off-by: Sasha Levin --- drivers/hv/channel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index fbdda9938039a..f9f04b5cd303f 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c @@ -548,7 +548,7 @@ static int __vmbus_open(struct vmbus_channel *newchannel, goto error_clean_ring; /* Create and init the channel open message */ - open_info = kmalloc(sizeof(*open_info) + + open_info = kzalloc(sizeof(*open_info) + sizeof(struct vmbus_channel_open_channel), GFP_KERNEL); if (!open_info) { @@ -674,7 +674,7 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle) unsigned long flags; int ret; - info = kmalloc(sizeof(*info) + + info = kzalloc(sizeof(*info) + sizeof(struct vmbus_channel_gpadl_teardown), GFP_KERNEL); if (!info) return -ENOMEM; -- 2.27.0