From: Aviad Yehezkel Date: Thu, 18 Jan 2018 13:41:51 +0000 (+0200) Subject: xfrm: fix error flow in case of add state fails X-Git-Tag: v5.15~9612^2~10^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aa5dd6fa6f5d4bdc82a67e952bba8ad2e98d77e2;p=platform%2Fkernel%2Flinux-starfive.git 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 Signed-off-by: Boris Pismeny Signed-off-by: Steffen Klassert --- diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c index 30e5746..ac947718 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; }