On 20 Jan 2025, at 14:43, Frode Nordahl wrote:
> As highlighted by static analysis [0], a potential memory leak
> was introduced in the commit referenced in the fixes tag.
>
> The issue was introduced by what I can describe as premature
> optimization, and while very unlikely to hit, let's make the code
> correct.
>
> The logic for cleanup assumes rdnh will always be added to the
> list of nexthops, and then I apparently chose to skip that when
> processing the outer message with a RTA_MULTIPATH attribute,
> presumably because its nexthop attributes will be added when
> processing nested attributes, making the list addition
> redundant.
>
> Skipping the list addition was technically safe, because at
> this point rdnh would be pointing at primary_next_hop__ on the
> stack.
>
> Separate out the nexthop cleanup code in private helper for
> internal use, while this is the only action for the public
> route_data_destroy() today, it might grow other powers in the
> future.
>
> Always add rdnh to list of nexthops and remove it when processing
> RTA_MULTIPATH nested attributes.
>
> 0: https://mail.openvswitch.org/pipermail/ovs-dev/2025-January/419818.html
> Fixes: 91fc51106cfe ("route-table: Support parsing multipath routes.")
> Signed-off-by: Frode Nordahl <[email protected]>
Thanks for adding the comment. With this added it looks good to me.
Acked-by: Eelco Chaudron <[email protected]>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev