]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
net: check return value for dst_alloc
authorMadalin Bucur <madalin.bucur@freescale.com>
Mon, 26 Sep 2011 07:04:36 +0000 (07:04 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 27 Sep 2011 19:32:06 +0000 (15:32 -0400)
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>
net/xfrm/xfrm_policy.c

index 94fdcc7f103044d97dfe52c5405f8bbf52872a1a..552df27dcf53d3388fb2eb9ab3ba7a31c7ffcd64 100644 (file)
@@ -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;
 }