diff options
| author | 2025-11-10 06:41:25 +0000 | |
|---|---|---|
| committer | 2025-11-14 10:12:36 +0100 | |
| commit | a55ef3bff84f11ee8c84a1ae29b071ffd4ccbbd9 (patch) | |
| tree | 39577cdcba685dbefd8db17e405b185e55e497db /net/openvswitch/ssh:/git@git.zx2c4.com/git: | |
| parent | xfrm: Prevent locally generated packets from direct output in tunnel mode (diff) | |
xfrm: fix memory leak in xfrm_add_acquire()
The xfrm_add_acquire() function constructs an xfrm policy by calling
xfrm_policy_construct(). This allocates the policy structure and
potentially associates a security context and a device policy with it.
However, at the end of the function, the policy object is freed using
only kfree() . This skips the necessary cleanup for the security context
and device policy, leading to a memory leak.
To fix this, invoke the proper cleanup functions xfrm_dev_policy_delete(),
xfrm_dev_policy_free(), and security_xfrm_policy_free() before freeing the
policy object. This approach mirrors the error handling path in
xfrm_add_policy(), ensuring that all associated resources are correctly
released.
Fixes: 980ebd25794f ("[IPSEC]: Sync series - acquire insert")
Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/openvswitch/ssh:/git@git.zx2c4.com/git:')
0 files changed, 0 insertions, 0 deletions
