diff options
author | Jianbo Liu <jianbol@nvidia.com> | 2024-07-08 09:58:11 +0300 |
---|---|---|
committer | Steffen Klassert <steffen.klassert@secunet.com> | 2024-07-08 13:24:13 +0200 |
commit | 9199b915e9fad7f5eff6160d24ff6b38e970107d (patch) | |
tree | ad870605ff73fd7616c4f8915b2ed0cd6c99dd0e /net/xfrm/xfrm_state.c | |
parent | 2d5317753e5f02a66e6d0afb9b25105d0beab1be (diff) | |
download | linux-stable-9199b915e9fad7f5eff6160d24ff6b38e970107d.tar.gz linux-stable-9199b915e9fad7f5eff6160d24ff6b38e970107d.tar.bz2 linux-stable-9199b915e9fad7f5eff6160d24ff6b38e970107d.zip |
xfrm: fix netdev reference count imbalance
In cited commit, netdev_tracker_alloc() is called for the newly
allocated xfrm state, but dev_hold() is missed, which causes netdev
reference count imbalance, because netdev_put() is called when the
state is freed in xfrm_dev_state_free(). Fix the issue by replacing
netdev_tracker_alloc() with netdev_hold().
Fixes: f8a70afafc17 ("xfrm: add TX datapath support for IPsec packet offload mode")
Signed-off-by: Jianbo Liu <jianbol@nvidia.com>
Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/xfrm/xfrm_state.c')
-rw-r--r-- | net/xfrm/xfrm_state.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 936f9348e5f6..67b2a399a48a 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c @@ -1331,8 +1331,7 @@ found: xso->dev = xdo->dev; xso->real_dev = xdo->real_dev; xso->flags = XFRM_DEV_OFFLOAD_FLAG_ACQ; - netdev_tracker_alloc(xso->dev, &xso->dev_tracker, - GFP_ATOMIC); + netdev_hold(xso->dev, &xso->dev_tracker, GFP_ATOMIC); error = xso->dev->xfrmdev_ops->xdo_dev_state_add(x, NULL); if (error) { xso->dir = 0; |