netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cong Wang <xiyou.wangcong@gmail.com>
To: Li Qiong <liqiong@nfschina.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>,
	Jiri Pirko <jiri@resnulli.us>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Yu Zhe <yuzhe@nfschina.com>
Subject: Re: [PATCH] net: sched: fix a error path in fw_change()
Date: Sat, 3 Dec 2022 11:46:18 -0800	[thread overview]
Message-ID: <Y4unik6y8a0MuoFt@pop-os.localdomain> (raw)
In-Reply-To: <20221201151532.25433-1-liqiong@nfschina.com>

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 <liqiong@nfschina.com>
> ---
>  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.

  parent reply	other threads:[~2022-12-03 19:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-01 15:15 [PATCH] net: sched: fix a error path in fw_change() Li Qiong
2022-12-03  4:59 ` Jakub Kicinski
2022-12-03 19:46 ` Cong Wang [this message]
2022-12-05  2:36   ` liqiong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y4unik6y8a0MuoFt@pop-os.localdomain \
    --to=xiyou.wangcong@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liqiong@nfschina.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=yuzhe@nfschina.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).