summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorAviad Yehezkel <aviadye@mellanox.com>2018-01-18 16:41:51 +0300
committerSteffen Klassert <steffen.klassert@secunet.com>2018-01-19 08:44:22 +0300
commitaa5dd6fa6f5d4bdc82a67e952bba8ad2e98d77e2 (patch)
tree5a82ca3b3f6e651b76341476530f26c39f42a222 /net
parentcc01572e2fb080e279ca625f239aca61f435ebf3 (diff)
downloadlinux-aa5dd6fa6f5d4bdc82a67e952bba8ad2e98d77e2.tar.xz
xfrm: fix error flow in case of add state fails
If add state fails in case of device offload, netdev refcount will be negative since gc task is attempting to dev_free this state. This is fixed by putting NULL in state dev field. Signed-off-by: Aviad Yehezkel <aviadye@mellanox.com> Signed-off-by: Boris Pismeny <borisp@mellanox.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net')
-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 30e5746085b8..ac9477189d1c 100644
--- a/net/xfrm/xfrm_device.c
+++ b/net/xfrm/xfrm_device.c
@@ -102,6 +102,7 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x,
err = dev->xfrmdev_ops->xdo_dev_state_add(x);
if (err) {
+ xso->dev = NULL;
dev_put(dev);
return err;
}