Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp337093yba; Sat, 4 May 2019 03:30:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqwmU/f0/EkFM4jsBqeX0FGXgXvFGX1aZu+NL/OxO5ORos8Nbh6zfwKL/Uu7m/toSdCunD03 X-Received: by 2002:a63:e52:: with SMTP id 18mr18016318pgo.3.1556965844029; Sat, 04 May 2019 03:30:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556965844; cv=none; d=google.com; s=arc-20160816; b=JGi1nyTl8TMEr6On+uwccAdry5mfb/C3o7xXBel9w+tIdW+Ida+379FkRH4tn3mBOH b5q2c3vIhUFJOxltVHm4kRevqtDtvVZYfttb09/L7O6ite5Rbf5vfjRge2Nvd4mMzuhZ lx8nrDZkKv/jSesNgJZ4IYrmSvCexAhBvWKkihyAKDxMvsmb7rSc1PawnpUELxax18U4 RdgQCmtwvH3af+hWZs/kogLtkCd2F81jN3znE4xZA/mtxsWPt0LyM2Jtmha3GBjTQjz5 cqHetZ/qo+GPqjYI2H0tipT2zPD7zJfyaHwozrnjzU8v23URArAV6Dzv31NcFdxrhSL7 ZoWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nPqR8M02lPoGiFK7HF1FtIzTHwBwDGMUDTxiRe6ro3I=; b=hPp+j87RK+Mgt5b7fw+1Jn9LrqwQp+qnfHEfDWv7sqwfRnc91NZwlWyZOGg5HBjUMI 7W2Loly2ZRfv+a19eRTTCzBATBXNrCCzMDd4inSe7lSG7champV+c4HhNME6jYO8Aozy GuVDaDqtwZQAypx2bAgBrSfZH8ZiCWb9a919ckzladKXqSsp5Fbob9s1iHRxXtigtZG7 uD2teP1Mdohy8Dc04ya1qrHGIOtoKlpZugrselXZlGDx9UNVeVluve8BpGpTQSdd4ML+ kgDGBPDSD59udDsEGGMSqyDt1JilOY13TbF7XKEelj/5Hqm27UBrbYSbvetqdzO9Vh/g Kjzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XzuTuAd9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y19si6516102plr.236.2019.05.04.03.30.29; Sat, 04 May 2019 03:30:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XzuTuAd9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728349AbfEDK15 (ORCPT + 99 others); Sat, 4 May 2019 06:27:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:38548 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727430AbfEDK1y (ORCPT ); Sat, 4 May 2019 06:27:54 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 D37EA20862; Sat, 4 May 2019 10:27:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556965674; bh=e1o4mFFNofXkPR/ecgVDEav2/lkN45hLVFmaojZ77Vw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XzuTuAd9iICmfswOV5dO0zECeAB0YgZZ8ZKv/7wFjK0UomXR4dZ64F0Wflpnw0+DY RhCoxNnXFn5/eqBc32e3gr+DRJKmY7IBSd0v3JwWkL3prjkOLvFQ81o9XbIraaFPRK /6NiTcgCWsf7LpWtaODIWeYrhKLeuyUEsKKe91Ac= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , James Chapman , "David S. Miller" Subject: [PATCH 4.19 07/23] l2tp: use rcu_dereference_sk_user_data() in l2tp_udp_encap_recv() Date: Sat, 4 May 2019 12:25:09 +0200 Message-Id: <20190504102451.803770039@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190504102451.512405835@linuxfoundation.org> References: <20190504102451.512405835@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Dumazet [ Upstream commit c1c477217882c610a2ba0268f5faf36c9c092528 ] Canonical way to fetch sk_user_data from an encap_rcv() handler called from UDP stack in rcu protected section is to use rcu_dereference_sk_user_data(), otherwise compiler might read it multiple times. Fixes: d00fa9adc528 ("il2tp: fix races with tunnel socket close") Signed-off-by: Eric Dumazet Cc: James Chapman Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/l2tp/l2tp_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c @@ -909,7 +909,7 @@ int l2tp_udp_encap_recv(struct sock *sk, { struct l2tp_tunnel *tunnel; - tunnel = l2tp_tunnel(sk); + tunnel = rcu_dereference_sk_user_data(sk); if (tunnel == NULL) goto pass_up;