[patch net] net: sched: fix p_filter_chain check in tcf_chain_flush

Subsystems: networking [general], tc subsystem, the rest

STALE3344d

3 messages, 3 authors, 2017-08-18 · open the first message on its own page

[patch net] net: sched: fix p_filter_chain check in tcf_chain_flush

From: Jiri Pirko <jiri@resnulli.us>
Date: 2017-08-18 08:10:47

From: Jiri Pirko <redacted>

The dereference before check is wrong and leads to an oops when
p_filter_chain is NULL. The check needs to be done on the pointer to
prevent NULL dereference.

Fixes: f93e1cdcf42c ("net/sched: fix filter flushing")
Signed-off-by: Jiri Pirko <redacted>
---
 net/sched/cls_api.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index ebeeb87..eef6b07 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -190,7 +190,7 @@ static void tcf_chain_flush(struct tcf_chain *chain)
 {
 	struct tcf_proto *tp;
 
-	if (*chain->p_filter_chain)
+	if (chain->p_filter_chain)
 		RCU_INIT_POINTER(*chain->p_filter_chain, NULL);
 	while ((tp = rtnl_dereference(chain->filter_chain)) != NULL) {
 		RCU_INIT_POINTER(chain->filter_chain, tp->next);
-- 
2.9.3

Re: [patch net] net: sched: fix p_filter_chain check in tcf_chain_flush

From: Cong Wang <hidden>
Date: 2017-08-18 17:00:12

On Fri, Aug 18, 2017 at 1:10 AM, Jiri Pirko [off-list ref] wrote:
From: Jiri Pirko <redacted>

The dereference before check is wrong and leads to an oops when
p_filter_chain is NULL. The check needs to be done on the pointer to
prevent NULL dereference.

Fixes: f93e1cdcf42c ("net/sched: fix filter flushing")
Signed-off-by: Jiri Pirko <redacted>
Acked-by: Cong Wang <redacted>

Re: [patch net] net: sched: fix p_filter_chain check in tcf_chain_flush

From: David Miller <davem@davemloft.net>
Date: 2017-08-18 17:19:42

From: Jiri Pirko <jiri@resnulli.us>
Date: Fri, 18 Aug 2017 10:10:43 +0200
From: Jiri Pirko <redacted>

The dereference before check is wrong and leads to an oops when
p_filter_chain is NULL. The check needs to be done on the pointer to
prevent NULL dereference.

Fixes: f93e1cdcf42c ("net/sched: fix filter flushing")
Signed-off-by: Jiri Pirko <redacted>
Applied, thanks Jiri.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help