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

Commit 0b150932 authored by Hiroaki SHIMODA's avatar Hiroaki SHIMODA Committed by David S. Miller
Browse files

xfrm: avoid possible oopse in xfrm_alloc_dst



Commit 80c802f3 (xfrm: cache bundles instead of policies for
outgoing flows) introduced possible oopse when dst_alloc returns NULL.

Signed-off-by: default avatarHiroaki SHIMODA <shimoda.hiroaki@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 520732af
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1340,10 +1340,13 @@ static inline struct xfrm_dst *xfrm_alloc_dst(struct net *net, int family)
	default:
		BUG();
	}
	xdst = dst_alloc(dst_ops) ?: ERR_PTR(-ENOBUFS);
	xdst = dst_alloc(dst_ops);
	xfrm_policy_put_afinfo(afinfo);

	if (likely(xdst))
		xdst->flo.ops = &xfrm_bundle_fc_ops;
	else
		xdst = ERR_PTR(-ENOBUFS);

	return xdst;
}