Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1880490pxu; Sun, 6 Dec 2020 10:23:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJwqw4Q4NmUU4aPXgVg5ITQKYwCl+idI+XS2xx9ql8tdSOgZ2sCGPkEw+csiRc+AoV665pCO X-Received: by 2002:a17:906:4982:: with SMTP id p2mr15794066eju.416.1607278983039; Sun, 06 Dec 2020 10:23:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607278983; cv=none; d=google.com; s=arc-20160816; b=oHIIORMUZ0ed5CZda0vYpvX0rpBihlkMu9/giALNFSn39WaiLwkhxssrBhbYO2FUvE UQeCTomzi5DB6nIiv7enh8oc3vP1NAAjH1C6cwbKeuNpZSSZanNmMomZb/dtQPHUUwbm Hexb5dWe0oPr+whOaIH4gjlwdOZ9PzK15053ItXA05Pw//efF70Rrk8kqWfnoPhA5PRy RTorQkGVhTxhWMMr7Pdty2hpwaRZYnnDJXbQWbpTN2Tk4IBtGwPtv6xhLKYhEyAjm83B lPtLNrf2XAvKGZHW+bo/CDlmAOSWfNYaRpJv1cou0w1/l0IfO/ZNUTW7t7vQcwaQjhDe zNxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=IBlcf7ksAuEvCZLcbkUIbzhFbCOYIpwbh1pRZSUCoh8=; b=r5wBg2NqPXD4CvxVpZcqn7Wn2GSgJ5XBx25ILeyTqFUDv8VSmCWP8R44eQrzigvPos MrZ50d0KiZo4zLygYTN6X7hrLUDB+/6xAmtbdrhZpB4RPwHZrdwrutx3H2qj6LC0sEfb ciCZciV4rNs14GE20E+zJpkcgPh17jPGO443fOUPMhwP4T3ZEHeODRbYQSUCUIVE3AhM 12noclazOsRfptQ+qmAXaC89w/2RfwTWt3evr/a4dzCDzVAbWppJkwqRjIiwAlRaziu2 91JWtQXZ8ynvp/1IzDbYUqg3tbDXILIQx0/xuDZ4IRjJcc+VaxUW5/x8/OtXye+Ch/yk jyWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CcQXNj1w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i59si6733787edd.308.2020.12.06.10.22.40; Sun, 06 Dec 2020 10:23:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CcQXNj1w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726757AbgLFSVX (ORCPT + 99 others); Sun, 6 Dec 2020 13:21:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726318AbgLFSVX (ORCPT ); Sun, 6 Dec 2020 13:21:23 -0500 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEBA6C0613D1; Sun, 6 Dec 2020 10:20:42 -0800 (PST) Received: by mail-wm1-x342.google.com with SMTP id c198so9675951wmd.0; Sun, 06 Dec 2020 10:20:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=IBlcf7ksAuEvCZLcbkUIbzhFbCOYIpwbh1pRZSUCoh8=; b=CcQXNj1wsGNheX+8oj+t/QWoZ/AuEQVIzeh8fal/2XbOaP/cXtrWyZ44uOgkd+/J6M gf1UyIRJLPXax2V62Qz9zcfaSTSmJ6lojyCAjN8EF3q1o8dax769eMwMcjSDBs2BOBAQ YJEr3lQBSuXZznBZ7hik1M8i/+1YIF1hwLB6azAppGHP0boatQ9RqLa7YiAl+p584kGN eWt2FS47kLC3t+0gLXnil+Y3PM49XK1pSE6FBl35nXrYiMyGvA6iJMW7RUEi/uKdW+mM L0QgFtBZS7YGhMeA2XL+/N9avd0XezpTJLKhiRixIbRJ71ol7I6x4RtO0il7CFjRJG6u U5MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=IBlcf7ksAuEvCZLcbkUIbzhFbCOYIpwbh1pRZSUCoh8=; b=EatOL2ZbKTQZpYy/LVV+VJ8PpKOzZS8fu+8x++Bq8cGUGYrmpE4341Tw7Lq1V4NzPO YVrG2fxBWKMwTVhktXr2hC700BmkQuio0mglWtj1yZkE85MeOWwAv8xdvi2l28NysOSl J1+6nEBHGOnG+Oz8Dt5PIMCA9z8vcyWFsmFDuwdWrdiNnl3r+BFAvJYaDD+HeR8xsQF8 9bRT6gwMQV37VRFGWFDN8cTaRSDSYe7OktS/2PKElMmYJ7rKIV753YSQaR7SKOLrq5Fg X/iwXDcKfMiZyM3XFifOhxD091XxarQQdDzyX8bjDWfKgfMyTg+DlRG/aU3hvkFwj8Lc 316A== X-Gm-Message-State: AOAM530Xht/PZk3kBilVnvseL9Fko9GS403hZCCxcCz2CsRnilRO11Ku ZZs57Q/uVFI5BCQno9l0Q1XEWKj9mcBqsQ== X-Received: by 2002:a7b:c8da:: with SMTP id f26mr15235508wml.155.1607278841449; Sun, 06 Dec 2020 10:20:41 -0800 (PST) Received: from andrea (host-95-239-64-30.retail.telecomitalia.it. [95.239.64.30]) by smtp.gmail.com with ESMTPSA id b200sm11369891wmb.10.2020.12.06.10.20.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Dec 2020 10:20:41 -0800 (PST) Date: Sun, 6 Dec 2020 19:20:38 +0100 From: Andrea Parri To: Michael Kelley Cc: "linux-kernel@vger.kernel.org" , KY Srinivasan , Haiyang Zhang , Stephen Hemminger , Wei Liu , "linux-hyperv@vger.kernel.org" , Juan Vazquez , Saruhan Karademir Subject: Re: [PATCH 3/6] Drivers: hv: vmbus: Avoid double fetch of payload_size in vmbus_on_msg_dpc() Message-ID: <20201206182038.GC3256@andrea> References: <20201118143649.108465-1-parri.andrea@gmail.com> <20201118143649.108465-4-parri.andrea@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Dec 06, 2020 at 05:14:18PM +0000, Michael Kelley wrote: > From: Andrea Parri (Microsoft) Sent: Wednesday, November 18, 2020 6:37 AM > > > > vmbus_on_msg_dpc() double fetches from payload_size. The double fetch > > can lead to a buffer overflow when (mem)copying the hv_message object. > > Avoid the double fetch by saving the value of payload_size into a local > > variable. > > Similar comment here about providing some brief context in the commit > message on the problem that we are guarding against by removing the > double fetch. Will expand. > > I could see combining this patch with the previous one since the > motivation and pattern of the changes are exactly the same, just for > two different fields. Will consider this suggestion for v3. Please see v2 for a related discussion. Andrea