mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-25 13:14:07 +08:00
xfrm: add net device refcount tracker to struct xfrm_state_offload
Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Steffen Klassert <steffen.klassert@secunet.com> Link: https://lore.kernel.org/r/20211209154451.4184050-1-eric.dumazet@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
3d20408dff
commit
e1b539bd73
@ -128,6 +128,7 @@ struct xfrm_state_walk {
|
||||
|
||||
struct xfrm_state_offload {
|
||||
struct net_device *dev;
|
||||
netdevice_tracker dev_tracker;
|
||||
struct net_device *real_dev;
|
||||
unsigned long offload_handle;
|
||||
unsigned int num_exthdrs;
|
||||
@ -1913,7 +1914,7 @@ static inline void xfrm_dev_state_free(struct xfrm_state *x)
|
||||
if (dev->xfrmdev_ops->xdo_dev_state_free)
|
||||
dev->xfrmdev_ops->xdo_dev_state_free(x);
|
||||
xso->dev = NULL;
|
||||
dev_put(dev);
|
||||
dev_put_track(dev, &xso->dev_tracker);
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
@ -259,6 +259,7 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x,
|
||||
}
|
||||
|
||||
xso->dev = dev;
|
||||
netdev_tracker_alloc(dev, &xso->dev_tracker, GFP_ATOMIC);
|
||||
xso->real_dev = dev;
|
||||
xso->num_exthdrs = 1;
|
||||
xso->flags = xuo->flags;
|
||||
@ -269,7 +270,7 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x,
|
||||
xso->flags = 0;
|
||||
xso->dev = NULL;
|
||||
xso->real_dev = NULL;
|
||||
dev_put(dev);
|
||||
dev_put_track(dev, &xso->dev_tracker);
|
||||
|
||||
if (err != -EOPNOTSUPP)
|
||||
return err;
|
||||
|
Loading…
Reference in New Issue
Block a user