Re: [PATCH net v4 1/1] openvswitch: Fix CT limit teardown use-after-free

Yuqi Xu <[email protected]>
Newsgroups org.kernel.vger.netdev
Message-ID <[email protected]>
Hi Jakub,

Thanks for the review. You are right that the CT-limit netlink command
handlers cannot race with netns teardown.

The handlers derive their netns from sock_net(skb->sk), while the
userspace netlink socket holds an active reference to that netns and
delivery to the kernel receiver is synchronous. Therefore
ovs_ct_limit_exit() cannot run concurrently with SET, DEL, or GET for
that socket's netns.

For v5, I will remove the unreachable NULL handling from SET and DEL,
including the uninstalled-allocation free, and remove the GET NULL check
and its new -ENOENT result. This restores the previous command-path
semantics and removes the corresponding teardown-race explanation.

The RCU pointer replacement and grace period remain necessary for packet
processing, which can access ct_limit_info while netns teardown removes
the state. GET will retain its RCU read-side section for traversal of the
RCU-protected limit list.

I will also update the ovs_net::ct_limit_info kernel-doc to document the
RCU protection, ovs_mutex serialization for updates and teardown, and the
transient NULL state during teardown.

Thanks again,
Yuqi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.