On 2/25/26 6:05 PM, Matteo Perin via dev wrote:
> ovs_router_rule_add() is annotated with OVS_REQUIRES(mutex) but its
> external caller rule_handle_msg() in route-table.c does not hold the
> mutex. This could lead to data races on the rules pvector.
> 
> Fix this by changing the annotation to OVS_EXCLUDED(mutex) and
> acquiring the mutex inside ovs_router_rule_add() around the call to
> the internal ovs_router_rule_add__() function.
> 
> Fixes: e2a241560080 ("ovs-router: Introduce ovs/route/rule/{add, del} 
> commands.")

The Fixes tag for this issue should be the same as in the previous patches,
as the issue was introduced when the call was added to the route-table.c
that adds a rule from the netlink message.  All the calls from the unixctl
commands have proper locking.

> Signed-off-by: Matteo Perin <[email protected]>
> ---
>  lib/ovs-router.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/ovs-router.c b/lib/ovs-router.c
> index d0cf0f6a9..75d9badfa 100644
> --- a/lib/ovs-router.c
> +++ b/lib/ovs-router.c
> @@ -1338,11 +1338,13 @@ void
>  ovs_router_rule_add(uint32_t prio, bool invert, bool user, uint8_t src_len,
>                      const struct in6_addr *from, uint32_t lookup_table,
>                      bool ipv4)
> -    OVS_REQUIRES(mutex)
> +    OVS_EXCLUDED(mutex)
>  {
>      if (use_system_routing_table) {
> +        ovs_mutex_lock(&mutex);
>          ovs_router_rule_add__(prio, invert, user, src_len, from,
>                                lookup_table, ipv4);
> +        ovs_mutex_unlock(&mutex);
>      }
>  }
>  

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to