From patchwork Tue Apr 12 06:30:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 560731 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 5F053C433F5 for ; Tue, 12 Apr 2022 06:46:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350650AbiDLGsy (ORCPT ); Tue, 12 Apr 2022 02:48:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350966AbiDLGsV (ORCPT ); Tue, 12 Apr 2022 02:48:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42DE126124; Mon, 11 Apr 2022 23:39:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2C1DAB81B4A; Tue, 12 Apr 2022 06:39:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DE4BC385A6; Tue, 12 Apr 2022 06:39:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649745575; bh=fausJmKvDnrkqf0mQXYYUri+fHjDbig+Q6Z80FZUyNc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZjtT33JNgY1YQLNuyJD8NRsXxhTEZYQhLvTHjMLZDwfrnR3p0lH4fHx+DKiK89/vP iS5VIeOTLCLxCEkmJl7a/v0c/5Hu7vDC/8hiju8CHqEw0uYdXDkyGXFk/hqB9OSgtU 9gv4HOYLbffB7v9LIs2p/MQ0ST2jabnsfowMz/yU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Pudak, Filip" , "Xiao, Jiguang" , David Ahern , Paolo Abeni , Sasha Levin , Pudak@vger.kernel.org, Xiao@vger.kernel.org Subject: [PATCH 5.10 116/171] ipv6: Fix stats accounting in ip6_pkt_drop Date: Tue, 12 Apr 2022 08:30:07 +0200 Message-Id: <20220412062931.241886142@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220412062927.870347203@linuxfoundation.org> References: <20220412062927.870347203@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: David Ahern [ Upstream commit 1158f79f82d437093aeed87d57df0548bdd68146 ] VRF devices are the loopbacks for VRFs, and a loopback can not be assigned to a VRF. Accordingly, the condition in ip6_pkt_drop should be '||' not '&&'. Fixes: 1d3fd8a10bed ("vrf: Use orig netdev to count Ip6InNoRoutes and a fresh route lookup when sending dest unreach") Reported-by: Pudak, Filip Reported-by: Xiao, Jiguang Signed-off-by: David Ahern Link: https://lore.kernel.org/r/20220404150908.2937-1-dsahern@kernel.org Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/ipv6/route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 352e645c546e..776b1b58c5dc 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -4398,7 +4398,7 @@ static int ip6_pkt_drop(struct sk_buff *skb, u8 code, int ipstats_mib_noroutes) struct inet6_dev *idev; int type; - if (netif_is_l3_master(skb->dev) && + if (netif_is_l3_master(skb->dev) || dst->dev == net->loopback_dev) idev = __in6_dev_get_safely(dev_get_by_index_rcu(net, IP6CB(skb)->iif)); else