diff options
| author | Sabrina Dubroca <sd@queasysnail.net> | 2025-10-16 12:39:12 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-12-01 11:43:29 +0100 |
| commit | ba670eba991873a05d73f961c49facfc998e0ea8 (patch) | |
| tree | e1e6ae4e4cf54b82b4c7608a9df4a4398a7bfdb9 /net | |
| parent | a077ec70561b0dce1863bea00a52c81a2ca6f147 (diff) | |
| download | linux-ba670eba991873a05d73f961c49facfc998e0ea8.tar.gz linux-ba670eba991873a05d73f961c49facfc998e0ea8.tar.bz2 linux-ba670eba991873a05d73f961c49facfc998e0ea8.zip | |
xfrm: drop SA reference in xfrm_state_update if dir doesn't match
[ Upstream commit 8d2a2a49c30f67a480fa9ed25e08436a446f057e ]
We're not updating x1, but we still need to put() it.
Fixes: a4a87fa4e96c ("xfrm: Add Direction to the SA in or out")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
| -rw-r--r-- | net/xfrm/xfrm_state.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 1e2f5ecd6324..f8cb033f102e 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c @@ -2117,14 +2117,18 @@ int xfrm_state_update(struct xfrm_state *x) } if (x1->km.state == XFRM_STATE_ACQ) { - if (x->dir && x1->dir != x->dir) + if (x->dir && x1->dir != x->dir) { + to_put = x1; goto out; + } __xfrm_state_insert(x); x = NULL; } else { - if (x1->dir != x->dir) + if (x1->dir != x->dir) { + to_put = x1; goto out; + } } err = 0; |
