* [PATCH net-2.6] xfrm: avoid possible oopse in xfrm_alloc_dst
@ 2011-02-11 6:41 Hiroaki SHIMODA
2011-02-11 7:08 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Hiroaki SHIMODA @ 2011-02-11 6:41 UTC (permalink / raw)
To: davem; +Cc: netdev, timo.teras, herbert
Commit 80c802f3073e84 (xfrm: cache bundles instead of policies for
outgoing flows) introduced possible oopse when dst_alloc returns NULL.
Signed-off-by: Hiroaki SHIMODA <shimoda.hiroaki@gmail.com>
---
net/xfrm/xfrm_policy.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 8b3ef40..6459588 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -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;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-2.6] xfrm: avoid possible oopse in xfrm_alloc_dst
2011-02-11 6:41 [PATCH net-2.6] xfrm: avoid possible oopse in xfrm_alloc_dst Hiroaki SHIMODA
@ 2011-02-11 7:08 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-02-11 7:08 UTC (permalink / raw)
To: shimoda.hiroaki; +Cc: netdev, timo.teras, herbert
From: Hiroaki SHIMODA <shimoda.hiroaki@gmail.com>
Date: Fri, 11 Feb 2011 15:41:35 +0900
> Commit 80c802f3073e84 (xfrm: cache bundles instead of policies for
> outgoing flows) introduced possible oopse when dst_alloc returns NULL.
>
> Signed-off-by: Hiroaki SHIMODA <shimoda.hiroaki@gmail.com>
Good catch, applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-02-11 7:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-11 6:41 [PATCH net-2.6] xfrm: avoid possible oopse in xfrm_alloc_dst Hiroaki SHIMODA
2011-02-11 7:08 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).