xfrm: drop SA reference in xfrm_state_update if dir doesn't match

We're not updating x1, but we still need to put() it.

Fixes: a4a87fa4e9 ("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>
This commit is contained in:
Sabrina Dubroca 2025-10-16 12:39:12 +02:00 committed by Steffen Klassert
parent f584239a9e
commit 8d2a2a49c3

View File

@ -2191,14 +2191,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;