Skip to content

Commit 9199b91

Browse files
Jianbo Liuklassert
authored andcommitted
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: f8a70af ("xfrm: add TX datapath support for IPsec packet offload mode") Signed-off-by: Jianbo Liu <[email protected]> Reviewed-by: Cosmin Ratiu <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent 2d53177 commit 9199b91

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

net/xfrm/xfrm_state.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,8 +1331,7 @@ xfrm_state_find(const xfrm_address_t *daddr, const xfrm_address_t *saddr,
13311331
xso->dev = xdo->dev;
13321332
xso->real_dev = xdo->real_dev;
13331333
xso->flags = XFRM_DEV_OFFLOAD_FLAG_ACQ;
1334-
netdev_tracker_alloc(xso->dev, &xso->dev_tracker,
1335-
GFP_ATOMIC);
1334+
netdev_hold(xso->dev, &xso->dev_tracker, GFP_ATOMIC);
13361335
error = xso->dev->xfrmdev_ops->xdo_dev_state_add(x, NULL);
13371336
if (error) {
13381337
xso->dir = 0;

0 commit comments

Comments
 (0)