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

Ilya Maximets <[email protected]>
Newsgroups org.kernel.vger.netdev,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 8/21/26 5:19 AM, Yuqi Xu wrote:
> Packet processing uses CT limit state under RCU, while netns teardown
> frees that state under ovs_mutex. The CT limit pointer was neither removed
> from readers nor protected by a grace period, allowing packet processing to
> dereference the freed state.
> 
> An unprivileged user can trigger this bug from a user and network
> namespace, causing a slab-use-after-free in ovs_ct_execute() when the
> netns is torn down.
> 
> Publish the CT limit pointer through RCU, remove it before teardown, and
> wait for readers before freeing its contents. Keep ovs_mutex around
> individual CT limit updates, and use the RCU read-side lock while GET
> traverses the RCU-protected limit lists.
> 
> Netns teardown detaches the RCU-protected CT limit state in the pernet
> .pre_exit callback while holding ovs_mutex.  The pernet core guarantees an
> RCU grace period between the .pre_exit and .exit callbacks, so the .exit
> callback completes the teardown without adding any extra synchronization.
> 
> The netlink command handlers do not need NULL checks because the userspace
> netlink socket holds an active reference to its network namespace while a
> request is processed. The per-netns exit path therefore cannot run
> concurrently with SET, DEL, or GET for that socket's namespace.
> 
> Fixes: 11efd5cb04a1 ("openvswitch: Support conntrack zone limit")
> Cc: [email protected]
> Reported-by: Vega <[email protected]>
> Link: https://lore.kernel.org/all/[email protected]
> Assisted-by: Codex:GPT-5.4
> Co-developed-by: Nan Li <[email protected]>
> Signed-off-by: Nan Li <[email protected]>
> Signed-off-by: Yuqi Xu <[email protected]>
> Reviewed-by: Ren Wei <[email protected]>
> ---
> 
> Changes in v9:
> 
> - Rebase onto net/main.
> - Drop the data parameter from ovs_ct_exit_finish() and read the detached
>   state from ovs_net directly, fixing the build with
>   CONFIG_NETFILTER_CONNCOUNT disabled.
> - Rename ct_exit_data to ct_limit_exit_data and stop moving declarations
>   around in ovs_exit_net().
> - v8 Link: https://lore.kernel.org/all/[email protected]/
> 

Reviewed-by: Ilya Maximets <[email protected]>
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.