Commit 01b0d887 authored by Cong Wang's avatar Cong Wang Committed by Ben Hutchings

xfrm6: release dev before returning error

[ Upstream commit 84c4a9df ]

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: default avatarCong Wang <amwang@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 6b0c985d
...@@ -96,8 +96,10 @@ static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, ...@@ -96,8 +96,10 @@ static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
dev_hold(dev); dev_hold(dev);
xdst->u.rt6.rt6i_idev = in6_dev_get(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; return -ENODEV;
}
xdst->u.rt6.rt6i_peer = rt->rt6i_peer; xdst->u.rt6.rt6i_peer = rt->rt6i_peer;
if (rt->rt6i_peer) if (rt->rt6i_peer)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment