Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp871659pxu; Wed, 2 Dec 2020 05:42:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJyN0tubg2lLf9qELIjj79NHRj5/LxPdXY/Z4skYWqATsRqhFayFZb0uqjqeJ6VpSmvpTMuk X-Received: by 2002:a17:906:b003:: with SMTP id v3mr2368527ejy.290.1606916577959; Wed, 02 Dec 2020 05:42:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606916577; cv=none; d=google.com; s=arc-20160816; b=nPpA/Jb12KiWvIPKNPODNsu7cRzTWtWppVqeHp/AoPfGPK168I1rM2vPwzTZRw4jk7 WZij6VOeShE5gIXocSKE92+1/ObB4km2K/IeGvIj/H33ThSVw1NfKuf3I9ydE1ONjGbk i6yqIoZ/qgKjw/VPb9ePDXQW7Szn3N//5EN5fqyq/xqUEDmln866eesd1oBbL45qMoRM 5tUMTCfy/PL4m07JNSPiTZR8RoEqhwB725/PHfi/jB8jeaDC4IY7WDleJzgYSvI6cdCa g91X4IWZIVwO0rx9IaxpFZmhf/eL30cUq8cD6GDyKORymptirWfn08tnTAvLBpzdbNlf 4yEA== 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=l/C90f3+rH95i4xGnwc1KHGWZKMjt7nbaW6VsSOdvrc=; b=kvOiJAVW5vZeo3fRq/fwPtrCgKpjHeW/+8kDlhNwriLmkqa9aCYO/+0Ill/JWZNNCU dmymRxxJojwQifcAOY5pPUXcpJhyhxFpruu0nyY061XJi3t3dB5J0gdkCgPPJMb9lq6S Psn/RMsgOWlAhZjWeEr6m395QmdB6hDfiSNB9bl6tiK9LkAPgmRpPqvJsLy2YwBVyhwC o5I0dCb6srxCfKBBuBWuRSUXrJ8urSg8WMLYmwNfLvMiJGyAWRC6Vu57IEyCS1aiPWR6 HyPUNGJSB/furLJAaAD0WXgK81TGcVc7cU9GXk7xrVb3wzdQ3u0qS9TZhH5MGKTSupcS 7sew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=u12vLg7+; 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 f20si1153362edy.12.2020.12.02.05.42.34; Wed, 02 Dec 2020 05:42:57 -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=u12vLg7+; 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 S1728022AbgLBNiG (ORCPT + 99 others); Wed, 2 Dec 2020 08:38:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727861AbgLBNiF (ORCPT ); Wed, 2 Dec 2020 08:38:05 -0500 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0421FC0613CF; Wed, 2 Dec 2020 05:37:25 -0800 (PST) Received: by mail-wr1-x444.google.com with SMTP id 23so3952285wrc.8; Wed, 02 Dec 2020 05:37:24 -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=l/C90f3+rH95i4xGnwc1KHGWZKMjt7nbaW6VsSOdvrc=; b=u12vLg7+aWh9JsuOUB9vDnzS/ivy4SZwBk6Dil6rEpUw+6qqlzJ1tN5h15TNpe60AI FQM8O+u2hfu6Aaxvqi/oi8m39en3wd9fxk//keg5t4Hl/lZ4gnEjM131JIgEsu8yE5GL m8LO4Uw/eBaDRexUzrtM6YqtjT7K6E4ySHmosJRu4lYRM0NnwzRdkZpu2qHXoOwWTgSu lF4LhWR1HaxuUuOhORv1uiBB64b2zUEpN18ZtE2gpKnDamfQv74fO5H1DclKf98Wr6UE bwhMAlVEFOOFC/ePVcpmsuyd731OR7BvEgvN53X1pKFkWFDkE7oUj4/xWN5CXm35XPA1 Db9A== 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=l/C90f3+rH95i4xGnwc1KHGWZKMjt7nbaW6VsSOdvrc=; b=kyR8usRZ49xGD6cqp/Jzdy5G+kO6SfmtDl+kcIZxjDqRu/aEi20UU5imMFwMepxr4I qk9J8oClLGKL6z1vtGVhFw6PwhPi2Ji6zaFzs/97XSjDz63TkHNuMcI3tBNvc6hZjTJG gmskgUOxA21UtIl5ID66+tPiEVVQVEAayoQr95s1YX/58X6CkI7Bn3dTqmI1J47ZZviy fSTRkN2Vl/F5IBufjxRD5MXBzLYelRT4Yv2xNe/hsKsNmsihY4Gzl+2FlC41V1tW5GOL kq5AavJppcgA5ppSjJukwWdDU3ku8i522RUiq0wv2acLMMCAetV5ZSEjfFMhEBDIBq5/ 9q3Q== X-Gm-Message-State: AOAM530aF7NtcyU6zy0StCqNzPIPWHFbdudK7Wb0M1odpHVSRjOZKdgu beDefbYAWbOZjsItLr5X5MVmNgpZeQsz7Q== X-Received: by 2002:adf:e80b:: with SMTP id o11mr3626633wrm.409.1606916243505; Wed, 02 Dec 2020 05:37:23 -0800 (PST) Received: from andrea (host-95-239-64-30.retail.telecomitalia.it. [95.239.64.30]) by smtp.gmail.com with ESMTPSA id q12sm2051316wrx.86.2020.12.02.05.37.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 05:37:23 -0800 (PST) Date: Wed, 2 Dec 2020 14:37:16 +0100 From: Andrea Parri To: Wei Liu Cc: linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, "K . Y . Srinivasan" , Haiyang Zhang , Stephen Hemminger , Michael Kelley , Juan Vazquez , Saruhan Karademir Subject: Re: [PATCH v2 2/7] Drivers: hv: vmbus: Avoid double fetch of msgtype in vmbus_on_msg_dpc() Message-ID: <20201202133716.GA22763@andrea> References: <20201202092214.13520-1-parri.andrea@gmail.com> <20201202092214.13520-3-parri.andrea@gmail.com> <20201202122254.zjhu3cfcq3zwvmvu@liuwe-devbox-debian-v2> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201202122254.zjhu3cfcq3zwvmvu@liuwe-devbox-debian-v2> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > @@ -1072,12 +1073,19 @@ void vmbus_on_msg_dpc(unsigned long data) > > /* no msg */ > > return; > > > > + /* > > + * The hv_message object is in memory shared with the host. The host > > + * could erroneously or maliciously modify such object. Make sure to > > + * validate its fields and avoid double fetches whenever feasible. > > + */ > > + > > hdr = (struct vmbus_channel_message_header *)msg->u.payload; > > + msgtype = hdr->msgtype; > > Should READ_ONCE be used here? I think it should. Thank you for pointing this out. Andrea