[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230420175952.1114302-1-ivecera@redhat.com>
Date: Thu, 20 Apr 2023 19:59:52 +0200
From: Ivan Vecera <ivecera@...hat.com>
To: netdev@...r.kernel.org
Cc: 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>,
Paul Blakey <paulb@...dia.com>,
Marcelo Ricardo Leitner <marcelo.leitner@...il.com>,
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH net] net/sched: cls_api: Initialize miss_cookie_node when action miss is not used
Function tcf_exts_init_ex() sets exts->miss_cookie_node ptr only
when use_action_miss is true so it assumes in other case that
the field is set to NULL by the caller. If not then the field
contains garbage and subsequent tcf_exts_destroy() call results
in a crash.
Initialize .miss_cookie_node pointer to NULL when use_action_miss
parameter is false to avoid this potential scenario.
Fixes: 80cd22c35c90 ("net/sched: cls_api: Support hardware miss to tc action")
Signed-off-by: Ivan Vecera <ivecera@...hat.com>
---
net/sched/cls_api.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 35785a36c80298..8bc5b9d6a2916e 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -3224,8 +3224,12 @@ int tcf_exts_init_ex(struct tcf_exts *exts, struct net *net, int action,
exts->action = action;
exts->police = police;
- if (!use_action_miss)
+ if (!use_action_miss) {
+#ifdef CONFIG_NET_CLS_ACT
+ exts->miss_cookie_node = NULL;
+#endif
return 0;
+ }
err = tcf_exts_miss_cookie_base_alloc(exts, tp, handle);
if (err)
--
2.39.2
Powered by blists - more mailing lists