Thread View: linux.kernel.netdev
2 messages
2 total messages
Started by Binbin Deng
Mon, 30 Nov 2026 09:02
[PATCH net v2] net: sched: fully initialize tcf_chain before publishing it with RCU
Author: Binbin Deng
Date: Mon, 30 Nov 2026 09:02
Date: Mon, 30 Nov 2026 09:02
44 lines
9857 bytes
9857 bytes
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.
Fixes: 437192981932 ("net: sched: Change the block's chain list to an rcu list")
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
Re: [PATCH net v2] net: sched: fully initialize tcf_chain before publishing it with RCU
Author: netdev-bot+sinfo
Date: Mon, 30 Nov 2026 09:09
Date: Mon, 30 Nov 2026 09:09
23 lines
8571 bytes
8571 bytes
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.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads