Received: by 2002:a05:6a10:144:0:0:0:0 with SMTP id 4csp711830pxw; Fri, 8 Apr 2022 20:40:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMWQmTsEaxxWGsypv6hGVIz3NhB5tiO38qD55mPJIboPmokwkUbm00B4LLDTFzoueHLl6H X-Received: by 2002:a17:902:cf02:b0:14f:e0c2:1514 with SMTP id i2-20020a170902cf0200b0014fe0c21514mr22324206plg.90.1649475609427; Fri, 08 Apr 2022 20:40:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649475609; cv=none; d=google.com; s=arc-20160816; b=P3Yz3AHDEYACIIODfGDiIE+blQz4VXsNcExLBzHVCn/C8V1NmThe7cbpA+TNU0zL5A DklK/KRDgQt9HWbKP0S7Erm/RYmW0Vo1Sgsby5GMtnUQVWPD9DV7n5P4UTX75eHgCMfA 64hiGa7PdQveg57G4vMZArFuPbprMqeRI+TJW/gjJhdbNbDECQb6KIfABKUq95HNt0Sz rjB1nm0uaHC4UDKgbOcVoPsCw3KPxGvHLskOxt34iunUPUlMLL4IKsCOTPayRFxHJu8F eKKjUDEZjGwMuBTO/dTt/Ki5byXvl9MgsIVGMwTrIz45iSgrLVip7OixxajW2Gz3Zk6O 5cpg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=8ui5G5YmvpVyo/qNaU234emJeJJPUcDvQ43uN4dCjQw=; b=EZ6Hu+STfKMclUK6OqTbvxWIpa8ADvQZ4c4V90wvN5sIg1FsEhihrzDYGb6M5y8VZT g976yGdKl+ZvDi+y7yEA2dDuL6wto1ctLXSv4lgZ0STONShxT5sSgpZXaNYjmChB1DcW Ug+XZBj7Zqn41UEgsiN9MBn1cC6IW/RAQczOSUwHYCyG64BRHJVtk+aZ+vhsYoEjZMZ/ gprENEGGiqv+cxSHwE6KDs9iD69oju/301s6IUYru5TMb2FakCU4QweW7qKyT4KJcykp acDVPykNOukUHXNlRxyENe2x9WD6r9lvz6wdxp5T6b6Ymi+x2Bl5kYVdPLsq4M3PuM2l Ohrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=6wind.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lx6-20020a17090b4b0600b001caa6143ea5si7059712pjb.10.2022.04.08.20.39.55; Fri, 08 Apr 2022 20:40:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=6wind.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236716AbiDHOM5 (ORCPT + 99 others); Fri, 8 Apr 2022 10:12:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233821AbiDHOMz (ORCPT ); Fri, 8 Apr 2022 10:12:55 -0400 X-Greylist: delayed 419 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 08 Apr 2022 07:10:52 PDT Received: from smtpservice.6wind.com (unknown [185.13.181.2]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 65A85345477 for ; Fri, 8 Apr 2022 07:10:52 -0700 (PDT) Received: from bretzel (bretzel.dev.6wind.com [10.17.1.57]) by smtpservice.6wind.com (Postfix) with ESMTPS id 7D7E0600DD; Fri, 8 Apr 2022 16:03:52 +0200 (CEST) Received: from dichtel by bretzel with local (Exim 4.92) (envelope-from ) id 1ncpDM-00051l-De; Fri, 08 Apr 2022 16:03:52 +0200 From: Nicolas Dichtel To: Eric Dumazet , kongweibin Cc: David Miller , Jakub Kicinski , Willem de Bruijn , Pavel Begunkov , David Ahern , Vasily Averin , Martin KaFai Lau , LKML , netdev , rose.chen@huawei.com, liaichun@huawei.com, Nicolas Dichtel , stable@vger.kernel.org Subject: [PATCH net] ipv6: fix panic when forwarding a pkt with no in6 dev Date: Fri, 8 Apr 2022 16:03:42 +0200 Message-Id: <20220408140342.19311-1-nicolas.dichtel@6wind.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <59150cd5-9950-2479-a992-94dcdaa5e63c@6wind.com> References: <59150cd5-9950-2479-a992-94dcdaa5e63c@6wind.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,RDNS_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org kongweibin reported a kernel panic in ip6_forward() when input interface has no in6 dev associated. The following tc commands were used to reproduce this panic: tc qdisc del dev vxlan100 root tc qdisc add dev vxlan100 root netem corrupt 5% CC: stable@vger.kernel.org Fixes: ccd27f05ae7b ("ipv6: fix 'disable_policy' for fwd packets") Reported-by: kongweibin Signed-off-by: Nicolas Dichtel --- kongweibin, could you test this patch with your setup? Thanks, Nicolas net/ipv6/ip6_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index e23f058166af..fa63ef2bd99c 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -485,7 +485,7 @@ int ip6_forward(struct sk_buff *skb) goto drop; if (!net->ipv6.devconf_all->disable_policy && - !idev->cnf.disable_policy && + (!idev || !idev->cnf.disable_policy) && !xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) { __IP6_INC_STATS(net, idev, IPSTATS_MIB_INDISCARDS); goto drop; -- 2.33.0