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 X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,T_DKIMWL_WL_HIGH,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BC42C2BCA1 for ; Sun, 9 Jun 2019 16:45:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 47FF42081C for ; Sun, 9 Jun 2019 16:45:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560098722; bh=kP0Yut2/zuLHJBMavSITCKW027Z7R1PEPQXGNPspRks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=pRUr/Oz/unnlueROkDW5apeyrjb4iSKO0A37gBTI7Z5MhMAPqjN0XphCV9zxMAj8z qD4WdboObsJPAA7JzwIOABRsMP8ldrDqPjW855WCWCO80ooTwHP9vbEsxnNoAKBSyS Lf/c5cuHJC1G4AL7qDK6E7kn9axsH9T5rKgUPndY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729757AbfFIQpV (ORCPT ); Sun, 9 Jun 2019 12:45:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:43026 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729784AbfFIQpU (ORCPT ); Sun, 9 Jun 2019 12:45:20 -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 63C252084A; Sun, 9 Jun 2019 16:45:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560098719; bh=kP0Yut2/zuLHJBMavSITCKW027Z7R1PEPQXGNPspRks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZVM3Y0qW1kz5ChfCVFaxnTrcJ9IdpznLWUp1UduSdYoSL5k0eqTylVrWJb2g2y3QA xgwAd2Qh25z9/bZOpubJeUWcwaPbcYZ26PNsoFebLnxSUbTV/+LhUyiCzblqkeiD1c Ci0+550wfhN9s7uh8LN7IKA4d4VYNKiG1qvFD6A4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianlin Shi , Xin Long , "David S. Miller" Subject: [PATCH 5.1 04/70] ipv6: fix the check before getting the cookie in rt6_get_cookie Date: Sun, 9 Jun 2019 18:41:15 +0200 Message-Id: <20190609164127.773346412@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190609164127.541128197@linuxfoundation.org> References: <20190609164127.541128197@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Xin Long [ Upstream commit b7999b07726c16974ba9ca3bb9fe98ecbec5f81c ] In Jianlin's testing, netperf was broken with 'Connection reset by peer', as the cookie check failed in rt6_check() and ip6_dst_check() always returned NULL. It's caused by Commit 93531c674315 ("net/ipv6: separate handling of FIB entries from dst based routes"), where the cookie can be got only when 'c1'(see below) for setting dst_cookie whereas rt6_check() is called when !'c1' for checking dst_cookie, as we can see in ip6_dst_check(). Since in ip6_dst_check() both rt6_dst_from_check() (c1) and rt6_check() (!c1) will check the 'from' cookie, this patch is to remove the c1 check in rt6_get_cookie(), so that the dst_cookie can always be set properly. c1: (rt->rt6i_flags & RTF_PCPU || unlikely(!list_empty(&rt->rt6i_uncached))) Fixes: 93531c674315 ("net/ipv6: separate handling of FIB entries from dst based routes") Reported-by: Jianlin Shi Signed-off-by: Xin Long Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- include/net/ip6_fib.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h @@ -259,8 +259,7 @@ static inline u32 rt6_get_cookie(const s rcu_read_lock(); from = rcu_dereference(rt->from); - if (from && (rt->rt6i_flags & RTF_PCPU || - unlikely(!list_empty(&rt->rt6i_uncached)))) + if (from) fib6_get_cookie_safe(from, &cookie); rcu_read_unlock();