[PATCH 1/2] fib6: fix memory leak on delete operation

Robin Jarry rjarry at redhat.com
Wed Oct 15 11:32:18 CEST 2025


Vladimir Medvedkin, Oct 14, 2025 at 20:17:
> When deleting a prefix, the first attempt to get next prefix cannot
> return NULL as we will at a minimum get the prefix we are trying to
> delete, whereas we were rather interested in whether there are other
> prefixes within the same subtree, not counting the prefix we are
> deleting. To address this, we check if we have found the exact prefix we
> started with, and perform another search to see if there are more
> prefixes to be found.
>
> In addition to that, doing the searches with _COVER rather than _ALL is
> incorrect, because if we are doing search with _COVER rather than _ALL, we
> do not dive into the tree to find more specific prefixes within the
> prefix we are going to delete, and thus will not notice if our subtree
> also has more specific prefixes. To fix it, perform first (and
> subsequent) searches with _ALL rather than _COVER.
>
> Finally, when we hit the "tmp == NULL" branch (meaning, when we are
> deleting the only node that exists in our subtree), we know that the
> rib6_lookup will always return us the node that we are trying to delete,
> but this is incorrect because further code will consider this to be our
> parent node. Address this by doing another search to find the parent of
> the current node.
>
> Fixes: c3e12e0f0354 ("fib: add dataplane algorithm for IPv6")
> Cc: stable at dpdk.org
>
> Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin at intel.com>

Tested-by: Robin Jarry <rjarry at redhat.com>

-- 
Robin

> Use extra care when cleaning on stairs.



More information about the dev mailing list