Skip to content

Commit

Permalink
xfrm6: release dev before returning error
Browse files Browse the repository at this point in the history
We forget to call dev_put() on error path in xfrm6_fill_dst(),
its caller doesn't handle this.

Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Cong Wang authored and David S. Miller committed May 12, 2013
1 parent 5dbd506 commit 84c4a9d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/ipv6/xfrm6_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
dev_hold(dev);

xdst->u.rt6.rt6i_idev = in6_dev_get(dev);
if (!xdst->u.rt6.rt6i_idev)
if (!xdst->u.rt6.rt6i_idev) {
dev_put(dev);
return -ENODEV;
}

rt6_transfer_peer(&xdst->u.rt6, rt);

Expand Down

0 comments on commit 84c4a9d

Please sign in to comment.