Skip to content

Commit 1d1b0d7

Browse files
madalinbucurIgor
authored andcommitted
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>
1 parent 4d6b312 commit 1d1b0d7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

net/xfrm/xfrm_policy.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,14 +1349,16 @@ static inline struct xfrm_dst *xfrm_alloc_dst(struct net *net, int family)
13491349
BUG();
13501350
}
13511351
xdst = dst_alloc(dst_ops, NULL, 0, 0, 0);
1352-
memset(&xdst->u.rt6.rt6i_table, 0, sizeof(*xdst) - sizeof(struct dst_entry));
1353-
xfrm_policy_put_afinfo(afinfo);
13541352

1355-
if (likely(xdst))
1353+
if (likely(xdst)) {
1354+
memset(&xdst->u.rt6.rt6i_table, 0,
1355+
sizeof(*xdst) - sizeof(struct dst_entry));
13561356
xdst->flo.ops = &xfrm_bundle_fc_ops;
1357-
else
1357+
} else
13581358
xdst = ERR_PTR(-ENOBUFS);
13591359

1360+
xfrm_policy_put_afinfo(afinfo);
1361+
13601362
return xdst;
13611363
}
13621364

0 commit comments

Comments
 (0)