Skip to content

Commit 95bdba2

Browse files
dsahernkuba-moo
authored andcommitted
ipv6: Do cleanup if attribute validation fails in multipath route
As Nicolas noted, if gateway validation fails walking the multipath attribute the code should jump to the cleanup to free previously allocated memory. Fixes: 1ff15a7 ("ipv6: Check attribute length for RTA_GATEWAY when deleting multipath route") Signed-off-by: David Ahern <[email protected]> Acked-by: Nicolas Dichtel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent e30a845 commit 95bdba2

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

net/ipv6/route.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5277,12 +5277,10 @@ static int ip6_route_multipath_add(struct fib6_config *cfg,
52775277

52785278
nla = nla_find(attrs, attrlen, RTA_GATEWAY);
52795279
if (nla) {
5280-
int ret;
5281-
5282-
ret = fib6_gw_from_attr(&r_cfg.fc_gateway, nla,
5280+
err = fib6_gw_from_attr(&r_cfg.fc_gateway, nla,
52835281
extack);
5284-
if (ret)
5285-
return ret;
5282+
if (err)
5283+
goto cleanup;
52865284

52875285
r_cfg.fc_flags |= RTF_GATEWAY;
52885286
}

0 commit comments

Comments
 (0)