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>
This commit is contained in:
parent
cc01572e2f
commit
aa5dd6fa6f
@ -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);
|
err = dev->xfrmdev_ops->xdo_dev_state_add(x);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
xso->dev = NULL;
|
||||||
dev_put(dev);
|
dev_put(dev);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user