Message ID | 3b140111-8af0-176f-d3d0-567e8051eaf4@virtuozzo.com |
---|---|
State | Accepted |
Delegated to: | Pablo Neira |
Headers | show |
Series | [NETFILTER,v2] netfilter: nfnetlink: suspicious RCU usage in ctnetlink_dump_helpinfo | expand |
On Thu, Jul 01, 2021 at 08:02:49AM +0300, Vasily Averin wrote: > Two patches listed below removed ctnetlink_dump_helpinfo call from under > rcu_read_lock. Now its rcu_dereference generates following warning: > ============================= > WARNING: suspicious RCU usage > 5.13.0+ #5 Not tainted > ----------------------------- > net/netfilter/nf_conntrack_netlink.c:221 suspicious rcu_dereference_check() usage! Applied.
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index 8690fc07030f..f3e8e6ce82c4 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c @@ -218,6 +218,7 @@ static int ctnetlink_dump_helpinfo(struct sk_buff *skb, if (!help) return 0; + rcu_read_lock(); helper = rcu_dereference(help->helper); if (!helper) goto out; @@ -233,9 +234,11 @@ static int ctnetlink_dump_helpinfo(struct sk_buff *skb, nla_nest_end(skb, nest_helper); out: + rcu_read_unlock(); return 0; nla_put_failure: + rcu_read_unlock(); return -1; }