]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
xfrm: Fix negative device refcount on offload failure.
authorSteffen Klassert <steffen.klassert@secunet.com>
Mon, 4 Sep 2017 08:59:55 +0000 (10:59 +0200)
committerSteffen Klassert <steffen.klassert@secunet.com>
Mon, 11 Sep 2017 08:36:51 +0000 (10:36 +0200)
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>
net/xfrm/xfrm_device.c

index acf00104ef312b563be9f3aa9698fa2a9dbdfea7..30e5746085b8fcfc5aa8abc7a8a23753c510a630 100644 (file)
@@ -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;
        }