[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221201151532.25433-1-liqiong@nfschina.com>
Date: Thu, 1 Dec 2022 23:15:32 +0800
From: Li Qiong <liqiong@...china.com>
To: Jamal Hadi Salim <jhs@...atatu.com>,
Cong Wang <xiyou.wangcong@...il.com>,
Jiri Pirko <jiri@...nulli.us>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Yu Zhe <yuzhe@...china.com>, Li Qiong <liqiong@...china.com>
Subject: [PATCH] net: sched: fix a error path in fw_change()
The 'pfp' pointer could be null if can't find the target filter.
Check 'pfp' pointer and fix this error path.
Signed-off-by: Li Qiong <liqiong@...china.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;
+ }
+
RCU_INIT_POINTER(fnew->next, rtnl_dereference(pfp->next));
rcu_assign_pointer(*fp, fnew);
tcf_unbind_filter(tp, &f->res);
--
2.11.0
Powered by blists - more mailing lists