Commit 67a63387 authored by Steffen Klassert's avatar Steffen Klassert
Browse files

xfrm: Fix negative device refcount on offload failure.



Reset the offload device at the xfrm_state if the device was
not able to offload the state. Otherwise we drop the device
refcount twice.

Fixes: d77e38e6 ("xfrm: Add an IPsec hardware offloading API")
Reported-by: default avatarShannon Nelson <shannon.nelson@oracle.com>
Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
parent c5d4d7d8
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -91,6 +91,7 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x,
	}
	}


	if (!dev->xfrmdev_ops || !dev->xfrmdev_ops->xdo_dev_state_add) {
	if (!dev->xfrmdev_ops || !dev->xfrmdev_ops->xdo_dev_state_add) {
		xso->dev = NULL;
		dev_put(dev);
		dev_put(dev);
		return 0;
		return 0;
	}
	}