Skip to content

Commit 8fb4792

Browse files
Paolo Abenidavem330
authored andcommitted
ipv6: fix another slab-out-of-bounds in fib6_nh_flush_exceptions
While running the self-tests on a KASAN enabled kernel, I observed a slab-out-of-bounds splat very similar to the one reported in commit 821bbf7 ("ipv6: Fix KASAN: slab-out-of-bounds Read in fib6_nh_flush_exceptions"). We additionally need to take care of fib6_metrics initialization failure when the caller provides an nh. The fix is similar, explicitly free the route instead of calling fib6_info_release on a half-initialized object. Fixes: f88d8ea ("ipv6: Plumb support for nexthop object in a fib6_info") Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 75d5641 commit 8fb4792

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/ipv6/route.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3769,7 +3769,7 @@ static struct fib6_info *ip6_route_info_create(struct fib6_config *cfg,
37693769
err = PTR_ERR(rt->fib6_metrics);
37703770
/* Do not leave garbage there. */
37713771
rt->fib6_metrics = (struct dst_metrics *)&dst_default_metrics;
3772-
goto out;
3772+
goto out_free;
37733773
}
37743774

37753775
if (cfg->fc_flags & RTF_ADDRCONF)

0 commit comments

Comments
 (0)