Messages in this thread Patch in this message | | | From | Matteo Croce <> | Date | Mon, 24 Feb 2020 20:47:13 +0100 | Subject | Re: [PATCH nf] netfilter: ensure rcu_read_lock() in ipv4_find_option() |
| |
On Mon, Feb 24, 2020 at 8:42 PM Matteo Croce <mcroce@redhat.com> wrote: > > On Mon, Feb 24, 2020 at 8:12 PM Florian Westphal <fw@strlen.de> wrote: > > > > Matteo Croce <mcroce@redhat.com> wrote: > > > As in commit c543cb4a5f07 ("ipv4: ensure rcu_read_lock() in ipv4_link_failure()") > > > and commit 3e72dfdf8227 ("ipv4: ensure rcu_read_lock() in cipso_v4_error()"), > > > __ip_options_compile() must be called under rcu protection. > > > > This is not needed, all netfilter hooks run with rcu_read_lock held. > > > > Ok, so let's drop it, thanks.
What about adding a RCU_LOCKDEP_WARN() in __ip_options_compile() to protect against future errors? Something like:
----------------------------------%<------------------------------------- @@ -262,6 +262,9 @@ int __ip_options_compile(struct net *net, unsigned char *iph; int optlen, l;
+ RCU_LOCKDEP_WARN(!rcu_read_lock_held(), + __FUNC__ " needs rcu_read_lock() protection"); + if (skb) { rt = skb_rtable(skb); optptr = (unsigned char *)&(ip_hdr(skb)[1]); ---------------------------------->%------------------------------------- Bye, -- Matteo Croce per aspera ad upstream
| |