[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1390675673-20682-1-git-send-email-horia.geanta@freescale.com>
Date: Sat, 25 Jan 2014 20:47:53 +0200
From: Horia Geanta <horia.geanta@...escale.com>
To: Steffen Klassert <steffen.klassert@...unet.com>
CC: <netdev@...r.kernel.org>
Subject: [PATCH] xfrm: fix potential incorrect pointer dereference in xfrm_bundle_create
Return value of xfrm_alloc_dst might be an error code.
Need to check this before using the pointer safely.
Signed-off-by: Horia Geanta <horia.geanta@...escale.com>
---
net/xfrm/xfrm_policy.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 9a91f74..f230f2a 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1541,7 +1541,7 @@ 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)) {
@@ -1560,6 +1560,8 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy,
} else
inner_mode = xfrm[i]->inner_mode;
+ dst1 = &xdst->u.dst;
+
if (!dst_prev)
dst0 = dst1;
else {
--
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists