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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0374BC5AD4C for ; Wed, 15 Nov 2023 20:53:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234884AbjKOUx3 (ORCPT ); Wed, 15 Nov 2023 15:53:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234898AbjKOUx1 (ORCPT ); Wed, 15 Nov 2023 15:53:27 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE121B7 for ; Wed, 15 Nov 2023 12:53:24 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3300BC4E779; Wed, 15 Nov 2023 20:53:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1700081604; bh=pOoNoAbUeKvvdmUUGogP6x2c8L200QxAVwzI3mQfzvY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IT/dpcE286Gr6t4Mx4nwFzZWs4ZT8jP09MZDDh5NjFDXh6h6TG3yhcvW/gcxaa7dN pcwxutbnKsCa2KC7ScNqk4kwtK5aKpNQjHOdkz+0JXi4deit53wKp8lFlAQoOn2TO+ fXShW2E2GxJnO+ZBDMlpp2FEbuII5TP78Q7Iwc1g= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Eric Dumazet , Willem de Bruijn , Paolo Abeni , Sasha Levin Subject: [PATCH 5.10 011/191] udp: add missing WRITE_ONCE() around up->encap_rcv Date: Wed, 15 Nov 2023 15:44:46 -0500 Message-ID: <20231115204645.188652078@linuxfoundation.org> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231115204644.490636297@linuxfoundation.org> References: <20231115204644.490636297@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet [ Upstream commit 6d5a12eb91224d707f8691dccb40a5719fe5466d ] UDP_ENCAP_ESPINUDP_NON_IKE setsockopt() writes over up->encap_rcv while other cpus read it. Fixes: 067b207b281d ("[UDP]: Cleanup UDP encapsulation code") Signed-off-by: Eric Dumazet Reviewed-by: Willem de Bruijn Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/ipv4/udp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 913966e7703fc..476f79f1563a8 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -2645,10 +2645,12 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname, case UDP_ENCAP_ESPINUDP_NON_IKE: #if IS_ENABLED(CONFIG_IPV6) if (sk->sk_family == AF_INET6) - up->encap_rcv = ipv6_stub->xfrm6_udp_encap_rcv; + WRITE_ONCE(up->encap_rcv, + ipv6_stub->xfrm6_udp_encap_rcv); else #endif - up->encap_rcv = xfrm4_udp_encap_rcv; + WRITE_ONCE(up->encap_rcv, + xfrm4_udp_encap_rcv); #endif fallthrough; case UDP_ENCAP_L2TPINUDP: -- 2.42.0