Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83025136 authored by Paolo Abeni's avatar Paolo Abeni Committed by Greg Kroah-Hartman
Browse files

ipv6: fix another slab-out-of-bounds in fib6_nh_flush_exceptions



[ Upstream commit 8fb4792f091e608a0a1d353dfdf07ef55a719db5 ]

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 821bbf79fe46 ("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: f88d8ea6 ("ipv6: Plumb support for nexthop object in a fib6_info")
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent a88414fb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3655,7 +3655,7 @@ static struct fib6_info *ip6_route_info_create(struct fib6_config *cfg,
		err = PTR_ERR(rt->fib6_metrics);
		/* Do not leave garbage there. */
		rt->fib6_metrics = (struct dst_metrics *)&dst_default_metrics;
		goto out;
		goto out_free;
	}

	if (cfg->fc_flags & RTF_ADDRCONF)