mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-28 13:22:57 +00:00
xfrm: don't skip free of empty state in acquire policy
[ Upstream commitf3ec2b5d87
] In destruction flow, the assignment of NULL to xso->dev caused to skip of xfrm_dev_state_free() call, which was called in xfrm_state_put(to_put) routine. Instead of open-coded variant of xfrm_dev_state_delete() and xfrm_dev_state_free(), let's use them directly. Fixes:f8a70afafc
("xfrm: add TX datapath support for IPsec packet offload mode") Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
757eaa5d76
commit
c8ce01aad1
2 changed files with 3 additions and 6 deletions
|
@ -1984,6 +1984,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;
|
||||||
|
xso->type = XFRM_DEV_OFFLOAD_UNSPECIFIED;
|
||||||
netdev_put(dev, &xso->dev_tracker);
|
netdev_put(dev, &xso->dev_tracker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1324,12 +1324,8 @@ xfrm_state_find(const xfrm_address_t *daddr, const xfrm_address_t *saddr,
|
||||||
struct xfrm_dev_offload *xso = &x->xso;
|
struct xfrm_dev_offload *xso = &x->xso;
|
||||||
|
|
||||||
if (xso->type == XFRM_DEV_OFFLOAD_PACKET) {
|
if (xso->type == XFRM_DEV_OFFLOAD_PACKET) {
|
||||||
xso->dev->xfrmdev_ops->xdo_dev_state_delete(x);
|
xfrm_dev_state_delete(x);
|
||||||
xso->dir = 0;
|
xfrm_dev_state_free(x);
|
||||||
netdev_put(xso->dev, &xso->dev_tracker);
|
|
||||||
xso->dev = NULL;
|
|
||||||
xso->real_dev = NULL;
|
|
||||||
xso->type = XFRM_DEV_OFFLOAD_UNSPECIFIED;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
x->km.state = XFRM_STATE_DEAD;
|
x->km.state = XFRM_STATE_DEAD;
|
||||||
|
|
Loading…
Reference in a new issue