diff options
author | Madalin Bucur <madalin.bucur@freescale.com> | 2011-09-26 09:04:36 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-09-27 21:32:06 +0200 |
commit | d4cae56219755ccf8acfc8e2c1927009ff29d8c6 (patch) | |
tree | 28045314ccfd03e3bf927319716808bbc23a8a0f /net | |
parent | ipv6-multicast: Fix memory leak in input path. (diff) | |
download | linux-d4cae56219755ccf8acfc8e2c1927009ff29d8c6.tar.xz linux-d4cae56219755ccf8acfc8e2c1927009ff29d8c6.zip |
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')
-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 94fdcc7f1030..552df27dcf53 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; } |