summaryrefslogtreecommitdiffstats
path: root/net/xfrm/xfrm_device.c
diff options
context:
space:
mode:
authorSteffen Klassert <steffen.klassert@secunet.com>2017-09-04 10:59:55 +0200
committerSteffen Klassert <steffen.klassert@secunet.com>2017-09-11 10:36:51 +0200
commit67a63387b1417b5954eedb15f638f1f0bee3da49 (patch)
tree0e8e662a925704338f1ba7dc2e90d3d1c1fb81ba /net/xfrm/xfrm_device.c
parentc5d4d7d83165ae863954b113c7f403d8b58febed (diff)
downloadlinux-67a63387b1417b5954eedb15f638f1f0bee3da49.tar.gz
linux-67a63387b1417b5954eedb15f638f1f0bee3da49.tar.bz2
linux-67a63387b1417b5954eedb15f638f1f0bee3da49.zip
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: d77e38e612a0 ("xfrm: Add an IPsec hardware offloading API") Reported-by: Shannon Nelson <shannon.nelson@oracle.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/xfrm/xfrm_device.c')
-rw-r--r--net/xfrm/xfrm_device.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c
index acf00104ef31..30e5746085b8 100644
--- a/net/xfrm/xfrm_device.c
+++ b/net/xfrm/xfrm_device.c
@@ -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) {
+ xso->dev = NULL;
dev_put(dev);
return 0;
}