netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [XFRM]: Don't dereference error pointer dst1
@ 2010-09-29 22:37 Roel Kluin
  2010-09-29 20:45 ` Eric Dumazet
  0 siblings, 1 reply; 3+ messages in thread
From: Roel Kluin @ 2010-09-29 22:37 UTC (permalink / raw)
  To: David S. Miller, netdev, Andrew Morton, LKML

Don't dereference dst1 when it's an error pointer.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
 net/xfrm/xfrm_policy.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

I just noticed this by code analysis. It wasn't tested in any way.

diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index cbab6e1..b186c3d 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1414,13 +1414,14 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy,
 
 	for (; i < nx; i++) {
 		struct xfrm_dst *xdst = xfrm_alloc_dst(net, family);
-		struct dst_entry *dst1 = &xdst->u.dst;
+		struct dst_entry *dst1;
 
 		err = PTR_ERR(xdst);
 		if (IS_ERR(xdst)) {
 			dst_release(dst);
 			goto put_states;
 		}
+		dst1 = &xdst->u.dst;
 
 		if (!dst_prev)
 			dst0 = dst1;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-09-29 22:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-29 22:37 [PATCH] [XFRM]: Don't dereference error pointer dst1 Roel Kluin
2010-09-29 20:45 ` Eric Dumazet
2010-09-29 20:49   ` 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).