Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3863504pxb; Tue, 17 Nov 2020 05:41:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJwYgNUn0VisXcxqwWz69fi3trAsnYuL3jDb8cqZ/3SmO+5g+n0PFkFR606pz3cPY8nKzoY2 X-Received: by 2002:aa7:df89:: with SMTP id b9mr21190366edy.335.1605620460095; Tue, 17 Nov 2020 05:41:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605620460; cv=none; d=google.com; s=arc-20160816; b=Z8BrAi52EbQ0Eex8OQMoxQ3s1EQPchnC1oe1/4F0mxn545vzd+lDpG/akrgCdJHGT0 EDlYBZVRr9WD/B7HAi30+XlI2rb+dBbGCYp0CvErkYjEKstCq/Dv9WLZ0d8J1MAXxpn7 YvMV2zxg5R0lHvmGm2OflFga9b64UFV4KSceqE+V6g88V8j8coQVnnI8mraIOJok3DKk oBh5VYHCGvhE8pOslV+FCgSs+lLyAWlYQZRQJIaZhuZKnumTE6JCeRftbLlOs44Ttlk0 bsveAn0Sdka4+LTTbHVfw6ANgTi2eSgMkAmG6VdcERkAwUEH0zD3V4TqWyZ1TIphTm0L AZuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Zht1mecZOXq+42VttRdbwtv/ZJy9t8nRtxh93/+eX9A=; b=OsisW7UzX+wX5LPoWKwwEe89PUePR7KVsh1qj6up33nxFm35eAT0iCUPtCRiATwHNi 5vKxpQDxZfxaBBvevWA0J6/1K7mBprvlSpvjPAqdI45/vrSzqTkD9ZVRYTg3ctvKA6BT 8/9LisAe7z1cAELnJx/xoJSlAKxn0Bl8UdEh623iUDUh7Vdw9rKtLCVLK9YByDAC+8i9 dct9cpzUMR9TwqNraFO3g8JfF8KVVDUq8WQREBsZPl512lhf34KhjhubrBuJDRyck5fy 1ivdLydZ694Lc+cHOnUYXUxIFZJnfESZEp4pz+6blkWXOs391GOyw3cwzXD4GcCIthyK mHdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rKqYI5NG; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e7si13782214edu.277.2020.11.17.05.40.36; Tue, 17 Nov 2020 05:41:00 -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=@kernel.org header.s=default header.b=rKqYI5NG; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732362AbgKQNhT (ORCPT + 99 others); Tue, 17 Nov 2020 08:37:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:47850 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732769AbgKQNgv (ORCPT ); Tue, 17 Nov 2020 08:36:51 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EE2AA20780; Tue, 17 Nov 2020 13:36:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605620209; bh=mQX95/B3tG3dh3kShX3/qtKjgZqmD8wMl6ZXIekotiE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rKqYI5NG1GLkbLYMCnwNhaaqCnM0qW3M7+8eLYtW68tTTlN5g+JGSnHeyDbP+Wl5G izGiS9Bwl5JAYB6fyygfzaR2MPMT/UIJaRTHJnSn7jrpaAfGTdMWUfzrzgkhL1cTLc 3jovP1q+N2/niUCn2C446iKDnrvnzK8Y0wgj5C2c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Mikityanskiy , Tariq Toukan , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.9 142/255] net/mlx5e: Fix incorrect access of RCU-protected xdp_prog Date: Tue, 17 Nov 2020 14:04:42 +0100 Message-Id: <20201117122145.858705277@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122138.925150709@linuxfoundation.org> References: <20201117122138.925150709@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maxim Mikityanskiy [ Upstream commit 1a50cf9a67ff2241c2949d30bc11c8dd4280eef8 ] rq->xdp_prog is RCU-protected and should be accessed only with rcu_access_pointer for the NULL check in mlx5e_poll_rx_cq. rq->xdp_prog may change on the fly only from one non-NULL value to another non-NULL value, so the checks in mlx5e_xdp_handle and mlx5e_poll_rx_cq will have the same result during one NAPI cycle, meaning that no additional synchronization is needed. Fixes: fe45386a2082 ("net/mlx5e: Use RCU to protect rq->xdp_prog") Signed-off-by: Maxim Mikityanskiy Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c index 64c8ac5eabf6a..a0a4398408b85 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c @@ -1566,7 +1566,7 @@ int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget) } while ((++work_done < budget) && (cqe = mlx5_cqwq_get_cqe(cqwq))); out: - if (rq->xdp_prog) + if (rcu_access_pointer(rq->xdp_prog)) mlx5e_xdp_rx_poll_complete(rq); mlx5_cqwq_update_db_record(cqwq); -- 2.27.0