提交 0b150932 编写于 作者: H Hiroaki SHIMODA 提交者: David S. Miller

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: NHiroaki SHIMODA <shimoda.hiroaki@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 520732af
...@@ -1340,10 +1340,13 @@ static inline struct xfrm_dst *xfrm_alloc_dst(struct net *net, int family) ...@@ -1340,10 +1340,13 @@ static inline struct xfrm_dst *xfrm_alloc_dst(struct net *net, int family)
default: default:
BUG(); BUG();
} }
xdst = dst_alloc(dst_ops) ?: ERR_PTR(-ENOBUFS); xdst = dst_alloc(dst_ops);
xfrm_policy_put_afinfo(afinfo); 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; return xdst;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册