提交 e0479b67 编写于 作者: V Vlad Buslov 提交者: David S. Miller

net: sched: fix unprotected access to rcu cookie pointer

Fix action attribute size calculation function to take rcu read lock and
access act_cookie pointer with rcu dereference.

Fixes: eec94fdb ("net: sched: use rcu for action cookie update")
Reported-by: NMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: NVlad Buslov <vladbu@mellanox.com>
Reviewed-by: NMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 2368957a
...@@ -149,10 +149,15 @@ EXPORT_SYMBOL(__tcf_idr_release); ...@@ -149,10 +149,15 @@ EXPORT_SYMBOL(__tcf_idr_release);
static size_t tcf_action_shared_attrs_size(const struct tc_action *act) static size_t tcf_action_shared_attrs_size(const struct tc_action *act)
{ {
struct tc_cookie *act_cookie;
u32 cookie_len = 0; u32 cookie_len = 0;
if (act->act_cookie) rcu_read_lock();
cookie_len = nla_total_size(act->act_cookie->len); act_cookie = rcu_dereference(act->act_cookie);
if (act_cookie)
cookie_len = nla_total_size(act_cookie->len);
rcu_read_unlock();
return nla_total_size(0) /* action number nested */ return nla_total_size(0) /* action number nested */
+ nla_total_size(IFNAMSIZ) /* TCA_ACT_KIND */ + nla_total_size(IFNAMSIZ) /* TCA_ACT_KIND */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册