Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2383606ybi; Sun, 9 Jun 2019 10:22:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqwRGQuR+zGDakOxx2/j0IoZZdSPLpEYkRyKgoa8ZLVMR7XQ5mGKQoXjEKvjzME9Sc2A3Ccn X-Received: by 2002:a17:90a:2305:: with SMTP id f5mr17873201pje.128.1560100925269; Sun, 09 Jun 2019 10:22:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560100925; cv=none; d=google.com; s=arc-20160816; b=xiS4HBRza5zWEfO0ZbARtyOG9h7Toeyg9zNDFIfz2QJEQkQWno2SrEpz0v/Dmf97lJ ZD/MEMgLdsQcNCUWjxsOyx6WEZTq3GTuty8AhxJAu7vCbiZlOANLgTR/dMdwJy2WG4pp 6kxvfXtLeu+81TvhID9ewbP/ABzIhMUBfqgo7d56jmmrHnwIKvOoUk1k7FYN5qd1yhwY LERrpX8xahnmmZnz4pkd3juKbJzyZvrcCwIBxfcuMw+zx42+QHTI7bn2rts4qW07zByM vGs3W6AbNGrDwhdYc5pHw/ZhZgHvoSh1MLlGVm/itoMsoILMDYJgQvCUE0BUpJ9R2+Ax bJyQ== 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=eerx01Z5ZQ9LzapppT1h6bSbB7ToSch345gUYdxKIIo=; b=iPkdCu5lsv7z8rKiR+YsBOfnfrEMQ6bIuUBYK/bAl2lMNVCNdf3Ueplcko4McAoOIy iToJGySm06CtWney9U9YPNnzBwi0eDD1FOPkXCjWgFQ6K/ig75dcD19Kfj8MGJEzGhX5 TEwkbzYfWdnCagDyefBi2s0wdzt/RcDpSuZ2oZF64DxvZrPV+JIdN0FFKfqwPh0OvOFZ e+JQoKJEMRa2Chibxej4vxWvlWWTNI+XktEixf6gew/ybAxXrUzKTnC5JRMq+iUfJsCr ekfM27eXEGioFFPOU+zBaffGqtmExaVOdZmHhfYgagUqJaf+eY/ZfJp3HR2t6cVbmMjG E9rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sLDef88f; 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 s14si2869560pji.28.2019.06.09.10.21.49; Sun, 09 Jun 2019 10:22:05 -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=sLDef88f; 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 S1731857AbfFIRUF (ORCPT + 99 others); Sun, 9 Jun 2019 13:20:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:46826 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729553AbfFIQr6 (ORCPT ); Sun, 9 Jun 2019 12:47:58 -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 4BD7F206C3; Sun, 9 Jun 2019 16:47:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560098877; bh=8oduMf+dBgb6kaS66Ozv83moSLTyUNtaMe1r0s2XBq4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sLDef88fAT4mCrbTVMNwyYD85x8x1sFKowrK3SspdHg546euUNTU4SygxRWdV0jzc fRbzZ6l3uQ+1HkGRMKPlBKiAyhk6QLsYLIcySN62JzxT7ygIzMdOE87egoA5Z35XSF IZZwBBNXBjD7u50VwTHdhHbuJ1HshNu7RRWCW9Po= 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 4.19 04/51] ipv6: fix the check before getting the cookie in rt6_get_cookie Date: Sun, 9 Jun 2019 18:41:45 +0200 Message-Id: <20190609164127.386795598@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190609164127.123076536@linuxfoundation.org> References: <20190609164127.123076536@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: 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 @@ -260,8 +260,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();