* [PATCH net v1] net: sched: fully initialize tcf_chain before publishing it with RCU
@ 2026-11-30 8:47 Binbin Deng
2026-11-30 8:53 ` netdev-bot+sinfo
0 siblings, 1 reply; 2+ messages in thread
From: Binbin Deng @ 2026-11-30 8:47 UTC (permalink / raw)
To: jhs, jiri, davem, edumazet, kuba, pabeni
Cc: netdev, linux-kernel, Binbin Deng
tcf_chain_create() publishes a newly allocated struct tcf_chain with
list_add_tail_rcu() before initializing chain->block, chain->index and
chain->refcnt; mutex_init(&chain->filter_chain_lock) also happens after
the publication.
tcf_chain_lookup_rcu() walks block->chain_list without any lock and
reads chain->index for every packet that is classified with a tc chain
redirect (TC_SKB_EXT) attached. A concurrent lookup can therefore
observe a half-initialized chain, e.g. match chain index 0 against a
chain whose index has not been stored yet, or fail to match a chain
that is being created; traffic falling into the window is transiently
dropped or steered into the wrong chain.
Fix by initializing all fields before the RCU publication, so a chain
is only ever visible to readers fully initialized.
Signed-off-by: Binbin Deng <18983559317@163.com>
---
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 c47d2ee13641..a3302dffd3c4 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -520,13 +520,13 @@ static struct tcf_chain *tcf_chain_create(struct tcf_block *block,
chain = kzalloc_obj(*chain);
if (!chain)
return NULL;
- list_add_tail_rcu(&chain->list, &block->chain_list);
mutex_init(&chain->filter_chain_lock);
chain->block = block;
chain->index = chain_index;
chain->refcnt = 1;
if (!chain->index)
block->chain0.chain = chain;
+ list_add_tail_rcu(&chain->list, &block->chain_list);
return chain;
}
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH net v1] net: sched: fully initialize tcf_chain before publishing it with RCU
2026-11-30 8:47 [PATCH net v1] net: sched: fully initialize tcf_chain before publishing it with RCU Binbin Deng
@ 2026-11-30 8:53 ` netdev-bot+sinfo
0 siblings, 0 replies; 2+ messages in thread
From: netdev-bot+sinfo @ 2026-11-30 8:53 UTC (permalink / raw)
To: Binbin Deng
Cc: jhs, jiri, davem, edumazet, kuba, pabeni, netdev, linux-kernel
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during
development, syzbot report, manual code inspection, LLM or static
analysis tool scan.
- Whether the issue was actually triggered, or is only theoretical
(e.g. found by LLM and not proven at runtime). If it was triggered
please include the symptoms, like the stack trace or kernel messages.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.
*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
--
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-30 8:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-30 8:47 [PATCH net v1] net: sched: fully initialize tcf_chain before publishing it with RCU Binbin Deng
2026-11-30 8:53 ` netdev-bot+sinfo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®