Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1085577pxk; Fri, 25 Sep 2020 06:00:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGbCEG4JIgk140XVkPBdpEI5MOdYjW5DDD2Faa6TtxpVyzZCddCg8CeSmTosZB08hyQZkb X-Received: by 2002:a05:651c:555:: with SMTP id q21mr1310082ljp.203.1601038855046; Fri, 25 Sep 2020 06:00:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601038854; cv=none; d=google.com; s=arc-20160816; b=fncIW+cttGfli0pOi+EJQoysmdSSc+6JyxdUswlJiRFiWB8gruPyRdGYr2r/JwNUVq mfETm3PT548fc92g2ydmkOYQMaFwObBMykcOcPFspB31sbFgalySbKCcGD562/wfrHDY /ZFk++4Odu8CJzv5AdsVtc00CybQq3p8n9SuyxNksAwT4F1IGOG7Eb2BbDLpfMK4JGyW NhhO0bc3T5g+0QXg83C/wE3F9/LfW3/f0M75keaxPcp2tbq/rOwcO0vJ0whw54apCXrK vuj+N6XWfpWLJJAJNW9Mjm69iFuGS29h590UvioDGa9/aP1LHMzN9UU0EpcZMbhtu396 Oj5w== 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=OKDddAZpGEefcO+iUwe1N11lZMSuMDwpX+JSnrAPsUQ=; b=GG9+XWyL9IJh5FMfyRZtVCvN/kh1cYJGe2GV7A6g3XV71ZE8yYLTxSu30XTrIDZnA+ pr15TWfHQWbRVqOVYTWrMXphZuvsNcSYKKjjUqdQPm3TwDNLzAQXJJDo4ZG30Cd77TQs 4EzWVimQMsx1BkmDlJLK3DJrHrq23bfRxZKDFEvgxYow1uQXPlWqpMGlWW2wLOQPQBTo JHVsciwqeONnFU512c+Y0L06UZU/vAFeXAXFjwxB/n8KW63GkYi3duIr850gFCStfzz+ Hjwrtf826HRja85acc7G0HJTY/M3IcocbWAqCpq2rWqlDsbeJsL623WBByqiwCTFxfiz pbIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DhaYIqky; 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 mb8si1744190ejb.518.2020.09.25.06.00.31; Fri, 25 Sep 2020 06:00:54 -0700 (PDT) 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=DhaYIqky; 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 S1729415AbgIYM41 (ORCPT + 99 others); Fri, 25 Sep 2020 08:56:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:58240 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729378AbgIYMxH (ORCPT ); Fri, 25 Sep 2020 08:53:07 -0400 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 AA40E206DB; Fri, 25 Sep 2020 12:53:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601038387; bh=A9J3qAOL+rX83hba1deH54ozsA7l50g5CSqGu5IA7FE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DhaYIqkyUCW+EwYQPnf2Lrbrr3D7wDdYTFGtu2Jkht1cQwisqits6bpvfOrAbGLEV W/6urwUbkHoXybgZyC3QSvgWvuka4Izko14esGXcYaBuTZdb/ngbiDRrIeit/Olkbp 4KRz08EekGBXgvcC5klNulTtignkR42lewWeqREA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Ahern , wenxu , "David S. Miller" Subject: [PATCH 5.4 14/43] ipv4: Initialize flowi4_multipath_hash in data path Date: Fri, 25 Sep 2020 14:48:26 +0200 Message-Id: <20200925124725.711828973@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200925124723.575329814@linuxfoundation.org> References: <20200925124723.575329814@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: David Ahern [ Upstream commit 1869e226a7b3ef75b4f70ede2f1b7229f7157fa4 ] flowi4_multipath_hash was added by the commit referenced below for tunnels. Unfortunately, the patch did not initialize the new field for several fast path lookups that do not initialize the entire flow struct to 0. Fix those locations. Currently, flowi4_multipath_hash is random garbage and affects the hash value computed by fib_multipath_hash for multipath selection. Fixes: 24ba14406c5c ("route: Add multipath_hash in flowi_common to make user-define hash") Signed-off-by: David Ahern Cc: wenxu Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- include/net/flow.h | 1 + net/core/filter.c | 1 + net/ipv4/fib_frontend.c | 1 + net/ipv4/route.c | 1 + 4 files changed, 4 insertions(+) --- a/include/net/flow.h +++ b/include/net/flow.h @@ -116,6 +116,7 @@ static inline void flowi4_init_output(st fl4->saddr = saddr; fl4->fl4_dport = dport; fl4->fl4_sport = sport; + fl4->flowi4_multipath_hash = 0; } /* Reset some input parameters after previous lookup */ --- a/net/core/filter.c +++ b/net/core/filter.c @@ -4650,6 +4650,7 @@ static int bpf_ipv4_fib_lookup(struct ne fl4.saddr = params->ipv4_src; fl4.fl4_sport = params->sport; fl4.fl4_dport = params->dport; + fl4.flowi4_multipath_hash = 0; if (flags & BPF_FIB_LOOKUP_DIRECT) { u32 tbid = l3mdev_fib_table_rcu(dev) ? : RT_TABLE_MAIN; --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -372,6 +372,7 @@ static int __fib_validate_source(struct fl4.flowi4_tun_key.tun_id = 0; fl4.flowi4_flags = 0; fl4.flowi4_uid = sock_net_uid(net, NULL); + fl4.flowi4_multipath_hash = 0; no_addr = idev->ifa_list == NULL; --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -2104,6 +2104,7 @@ static int ip_route_input_slow(struct sk fl4.daddr = daddr; fl4.saddr = saddr; fl4.flowi4_uid = sock_net_uid(net, NULL); + fl4.flowi4_multipath_hash = 0; if (fib4_rules_early_flow_dissect(net, skb, &fl4, &_flkeys)) { flkeys = &_flkeys;