Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3876587rwb; Sat, 3 Dec 2022 12:41:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf7FVYYW4NoZh/aT6+gHI5cquNx4goLGTJvNqBMXrcFILMsHSeKAlmBV5c94Y9LDETI4hkYI X-Received: by 2002:a05:6402:396:b0:46b:9c63:fa87 with SMTP id o22-20020a056402039600b0046b9c63fa87mr17742367edv.100.1670100059747; Sat, 03 Dec 2022 12:40:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670100059; cv=none; d=google.com; s=arc-20160816; b=W+MMuky83U+uSIqwWdt27xOZiRkhT3zky00JCS6DVwtV+m8cGU6qK0pw8uthTz4u4B 3K49XXbvjN0wzViInB7rStH1rZ6M8jAN/cGgDVl8rYKZOCNEeqkZUXCb+NBm6tGyk2fm n3xN2B7SfFqOHOvJr9AcM92R5DO6YsJVPKidqcwEDQ3AVlqUQA2TJyb/3rDa1C3VRvH7 IX03993xm+OQEgHeSjBbJLSZqrncQcvDMCAliEq5+RnS1/missAxThwqLlJnpHhYy2vT nSNhUa9Cw7vWfR692RT9nkuvw+ZKUq7qXzjLz05iAL5JhEfO4OExS9uCqMv8zfbSqhEq v82g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Kw32GtcdYT+/3M7KAcFKseRuBAPGHWVZRfO1RmOAVrQ=; b=hAjK6NpnQy9o/0OpJEtYPaoPPQGWkVXfNYgQ57GHQTsKOEUeULS9EDr6X3osuqJS+V pE+BGa1PZl480SxSnU0zXUICg0JLOuzrL3/J5ieYT/PmrUt4JdQgmaUsBi+Jod1DHSgw t1Evvy0CooWZgVShhr3P58sh8xgc3i45x/BlVblYCkvxDmTFr1kxUNQ4CpSRjtsyf82T iQ1LemdL8qTut7Er+mXM2TDbLvYbYZeGLOw+fEYw/MyZ5Ay8k9WZYOApQZg4gFSUqb2Y GYkaaETk52OlpJq3XQ/AFbCl4IPsHgruXKSQ/6gVT160YrYye8lqwTxjTfXzLBf3lbgV 8IuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=MO9oOOjX; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sc3-20020a1709078a0300b007ae8b1704d0si5231842ejc.68.2022.12.03.12.40.39; Sat, 03 Dec 2022 12:40:59 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=MO9oOOjX; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229893AbiLCTqX (ORCPT + 83 others); Sat, 3 Dec 2022 14:46:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbiLCTqW (ORCPT ); Sat, 3 Dec 2022 14:46:22 -0500 Received: from mail-qv1-xf34.google.com (mail-qv1-xf34.google.com [IPv6:2607:f8b0:4864:20::f34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9548A1DDF6; Sat, 3 Dec 2022 11:46:21 -0800 (PST) Received: by mail-qv1-xf34.google.com with SMTP id o12so5653389qvn.3; Sat, 03 Dec 2022 11:46:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Kw32GtcdYT+/3M7KAcFKseRuBAPGHWVZRfO1RmOAVrQ=; b=MO9oOOjXlvvcYCfPnHhSUGW0EpetHuljZlJeTFNtKf7/VMKhCGvr0dK83AK2jFZzth PpUNjqw8QftBwQPhYZ9NJXlyJcZiEpVQVfYBR+X3qTp4ejBnQrkji2mfimV4Ht5Sw7JK hezMzwkwHdLPmEvKw+THShCMfnJMTyJwD+9LjJ8S7sX01mKcfNoaUjukiU2bbYO6EwJD hzs8K3ATKDKd5JG8cDF40BMPHXWGJmD3344iCK+HPtrOaVq6c9FDKfNRtHykrvEzaDFY klZM1JkNXo2AabLdSOUus3loArrrPBNtTOULXLj9ZRiZqrb7ukRULpdowWm815nRdw+E JqOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Kw32GtcdYT+/3M7KAcFKseRuBAPGHWVZRfO1RmOAVrQ=; b=vSeelhDWpb1FES4mOx6RYX/5Y9SyxV7IgdqQgFYngGSeQQ9em8ohGmV7hrx9ln06xI DhEUE6PVSBViIHscnTw3aAmbpfztjOlTXZfLrwS20EyAsRLXMViS5P4kFkyGlQ0nxQ1y qDPuAGb769Nfs/RATWlOkIp2aQ2knv+mBrZNZXSc3ZDyn9jZVtWighg0j51QoCqJoPrO tXY2XXrbKA97hYSuv7ZA6fgGZgZjFDJHZlnKKfIZPuyecL7IOlasckY0GlH6qI5rfqf3 YZIWxT77FMFI/lFbd5khQX55Bbk0rYZo5NH7nLr2BSLEw/n1R1tTve0P4+HMnNlw7ZkD Z1NQ== X-Gm-Message-State: ANoB5pkfZgLJLOydXc7zWLKUGtGo0j0qGGirhBgX0MeO7Pc+eUZLtXW0 ThB1CczkVKDQAvSX0J6zhA4= X-Received: by 2002:a0c:f911:0:b0:4c7:4cb1:6754 with SMTP id v17-20020a0cf911000000b004c74cb16754mr6125691qvn.71.1670096780745; Sat, 03 Dec 2022 11:46:20 -0800 (PST) Received: from localhost ([2600:1700:65a0:ab60:150b:cfdc:d3ab:f038]) by smtp.gmail.com with ESMTPSA id b11-20020ac812cb000000b003a530a32f67sm24656qtj.65.2022.12.03.11.46.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Dec 2022 11:46:19 -0800 (PST) Date: Sat, 3 Dec 2022 11:46:18 -0800 From: Cong Wang To: Li Qiong Cc: Jamal Hadi Salim , Jiri Pirko , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Yu Zhe Subject: Re: [PATCH] net: sched: fix a error path in fw_change() Message-ID: References: <20221201151532.25433-1-liqiong@nfschina.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221201151532.25433-1-liqiong@nfschina.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 On Thu, Dec 01, 2022 at 11:15:32PM +0800, Li Qiong wrote: > The 'pfp' pointer could be null if can't find the target filter. > Check 'pfp' pointer and fix this error path. Did you see any actual kernel crash? And do you have a reproducer too? Please include them if you do. > > Signed-off-by: Li Qiong > --- > net/sched/cls_fw.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c > index a32351da968c..b898e4a81146 100644 > --- a/net/sched/cls_fw.c > +++ b/net/sched/cls_fw.c > @@ -289,6 +289,12 @@ static int fw_change(struct net *net, struct sk_buff *in_skb, > if (pfp == f) > break; > > + if (!pfp) { > + tcf_exts_destroy(&fnew->exts); > + kfree(fnew); > + return err; BTW, err is 0 here, you have to set some error here. Thanks.