Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

xfrm: call xfrm_dev_state_delete when xfrm_state_migrate fails to add the state

In case xfrm_state_migrate fails after calling xfrm_dev_state_add, we
directly release the last reference and destroy the new state, without
calling xfrm_dev_state_delete (this only happens in
__xfrm_state_delete, which we're not calling on this path, since the
state was never added).

Call xfrm_dev_state_delete on error when an offload configuration was
provided.

Fixes: ab244a394c7f ("xfrm: Migrate offload configuration")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>

authored by

Sabrina Dubroca and committed by
Steffen Klassert
7f022857 5502bc47

+4 -1
+4 -1
net/xfrm/xfrm_state.c
··· 2159 2159 xfrm_state_insert(xc); 2160 2160 } else { 2161 2161 if (xfrm_state_add(xc) < 0) 2162 - goto error; 2162 + goto error_add; 2163 2163 } 2164 2164 2165 2165 return xc; 2166 + error_add: 2167 + if (xuo) 2168 + xfrm_dev_state_delete(xc); 2166 2169 error: 2167 2170 xc->km.state = XFRM_STATE_DEAD; 2168 2171 xfrm_state_put(xc);