History

net/sched: don't dereference a->goto_chain to read the chain index

callers of tcf_gact_goto_chain_index() can potentially read an old value of the chain index, or even dereference a NULL 'goto_chain' pointer, because 'goto_chain' and 'tcfa_action' are read in the traffic path without caring of concurrent write in the control path. The most recent value of chain index can be read also from a->tcfa_action (it's encoded there together with TC_ACT_GOTO_CHAIN bits), so we don't really need to dereference 'goto_chain': just read the chain id from the control action.

Davide Caratti committed 7 years ago

Commit fe384e21 parent 7e0c8891 file · +1 −1Browse files

Unified · Split

include/net/tc_act/tc_gact.h+1−1
@@ -56,7 +56,7 @@ static inline bool is_tcf_gact_goto_chain(const struct tc_action *a) · 55 unmodified lines
5656
5757 static inline u32 tcf_gact_goto_chain_index(const struct tc_action *a)
5858 {
59− return a->goto_chain->index;
59+ return READ_ONCE(a->tcfa_action) & TC_ACT_EXT_VAL_MASK;
6060 }
6161
6262 #endif /* __NET_TC_GACT_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t