diff options
author | Madalin Bucur <madalin.bucur@freescale.com> | 2011-09-26 07:04:36 +0000 |
---|---|---|
committer | JP Abgrall <jpa@google.com> | 2012-05-09 22:28:16 -0700 |
commit | 25914de08dadda721c38175be33b667481ee1ff5 (patch) | |
tree | 976328e707df9505c521dcadb306867473a3afca /net/xfrm/xfrm_policy.c | |
parent | 52f91d889a2c2a0f9e0b5e97fa7be8b584834016 (diff) | |
download | kernel_samsung_tuna-25914de08dadda721c38175be33b667481ee1ff5.zip kernel_samsung_tuna-25914de08dadda721c38175be33b667481ee1ff5.tar.gz kernel_samsung_tuna-25914de08dadda721c38175be33b667481ee1ff5.tar.bz2 |
net: check return value for dst_alloc
return value of dst_alloc must be checked before use
Signed-off-by: Madalin Bucur <madalin.bucur@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm/xfrm_policy.c')
-rw-r--r-- | net/xfrm/xfrm_policy.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 7803eb6..1b906c3 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -1349,14 +1349,16 @@ static inline struct xfrm_dst *xfrm_alloc_dst(struct net *net, int family) BUG(); } xdst = dst_alloc(dst_ops, NULL, 0, 0, 0); - memset(&xdst->u.rt6.rt6i_table, 0, sizeof(*xdst) - sizeof(struct dst_entry)); - xfrm_policy_put_afinfo(afinfo); - if (likely(xdst)) + if (likely(xdst)) { + memset(&xdst->u.rt6.rt6i_table, 0, + sizeof(*xdst) - sizeof(struct dst_entry)); xdst->flo.ops = &xfrm_bundle_fc_ops; - else + } else xdst = ERR_PTR(-ENOBUFS); + xfrm_policy_put_afinfo(afinfo); + return xdst; } |