Commit e1b539bd authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski

xfrm: add net device refcount tracker to struct xfrm_state_offload

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Acked-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
Link: https://lore.kernel.org/r/20211209154451.4184050-1-eric.dumazet@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 3d20408d
...@@ -128,6 +128,7 @@ struct xfrm_state_walk { ...@@ -128,6 +128,7 @@ struct xfrm_state_walk {
struct xfrm_state_offload { struct xfrm_state_offload {
struct net_device *dev; struct net_device *dev;
netdevice_tracker dev_tracker;
struct net_device *real_dev; struct net_device *real_dev;
unsigned long offload_handle; unsigned long offload_handle;
unsigned int num_exthdrs; unsigned int num_exthdrs;
...@@ -1913,7 +1914,7 @@ static inline void xfrm_dev_state_free(struct xfrm_state *x) ...@@ -1913,7 +1914,7 @@ static inline void xfrm_dev_state_free(struct xfrm_state *x)
if (dev->xfrmdev_ops->xdo_dev_state_free) if (dev->xfrmdev_ops->xdo_dev_state_free)
dev->xfrmdev_ops->xdo_dev_state_free(x); dev->xfrmdev_ops->xdo_dev_state_free(x);
xso->dev = NULL; xso->dev = NULL;
dev_put(dev); dev_put_track(dev, &xso->dev_tracker);
} }
} }
#else #else
......
...@@ -259,6 +259,7 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x, ...@@ -259,6 +259,7 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x,
} }
xso->dev = dev; xso->dev = dev;
netdev_tracker_alloc(dev, &xso->dev_tracker, GFP_ATOMIC);
xso->real_dev = dev; xso->real_dev = dev;
xso->num_exthdrs = 1; xso->num_exthdrs = 1;
xso->flags = xuo->flags; xso->flags = xuo->flags;
...@@ -269,7 +270,7 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x, ...@@ -269,7 +270,7 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x,
xso->flags = 0; xso->flags = 0;
xso->dev = NULL; xso->dev = NULL;
xso->real_dev = NULL; xso->real_dev = NULL;
dev_put(dev); dev_put_track(dev, &xso->dev_tracker);
if (err != -EOPNOTSUPP) if (err != -EOPNOTSUPP)
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment