xfrm: avoid possible oopse in xfrm_alloc_dst
Subsystems (3)
PATCH 1/1 xfrm: avoid possible oopse in xfrm_alloc_dst
Commit 80c802f3073e84 (xfrm: cache bundles instead of policies for outgoing flows) introduced possible oopse when dst_alloc returns NULL.
Signed-off-by Hiroaki SHIMODA <[email protected]>
--- net/xfrm/xfrm_policy.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
net/xfrm/xfrm_policy.c +5 -2
@@ -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); - xdst->flo.ops = &xfrm_bundle_fc_ops; +if (likely (xdst)) + xdst->flo.ops = &xfrm_bundle_fc_ops; +else + xdst =ERR_PTR (-ENOBUFS );return xdst; }
David Miller
maintainerFrom: Hiroaki SHIMODA <[email protected]>
Date: Fri, 11 Feb 2011 15:41:35 +0900
Quoted 4 lines
Commit
80c802f3073e84(xfrm: cache bundles instead of policies for outgoing flows) introduced possible oopse whendst_allocreturns NULL.Signed-off-by Hiroaki SHIMODA <[email protected]>
Good catch, applied.