Skip to content

Commit aa5dd6f

Browse files
aviadyeklassert
authored andcommitted
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 <[email protected]> Signed-off-by: Boris Pismeny <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent cc01572 commit aa5dd6f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/xfrm/xfrm_device.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x,
102102

103103
err = dev->xfrmdev_ops->xdo_dev_state_add(x);
104104
if (err) {
105+
xso->dev = NULL;
105106
dev_put(dev);
106107
return err;
107108
}

0 commit comments

Comments
 (0)