android_kernel_xiaomi_sm8350/net/xfrm
Xin Xiong 63da7a2bbf xfrm: fix refcount leak in __xfrm_policy_check()
[ Upstream commit 9c9cb23e00ddf45679b21b4dacc11d1ae7961ebe ]

The issue happens on an error path in __xfrm_policy_check(). When the
fetching process of the object `pols[1]` fails, the function simply
returns 0, forgetting to decrement the reference count of `pols[0]`,
which is incremented earlier by either xfrm_sk_policy_lookup() or
xfrm_policy_lookup(). This may result in memory leaks.

Fix it by decreasing the reference count of `pols[0]` in that path.

Fixes: 134b0fc544 ("IPsec: propagate security module errors up from flow_cache_lookup")
Signed-off-by: Xin Xiong <xiongx18@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-09-05 10:27:39 +02:00
..
Kconfig
Makefile
xfrm_algo.c
xfrm_device.c
xfrm_hash.c
xfrm_hash.h
xfrm_inout.h
xfrm_input.c
xfrm_interface.c xfrm: fix tunnel model fragmentation behavior 2022-04-15 14:17:56 +02:00
xfrm_ipcomp.c
xfrm_output.c
xfrm_policy.c xfrm: fix refcount leak in __xfrm_policy_check() 2022-09-05 10:27:39 +02:00
xfrm_proc.c
xfrm_replay.c
xfrm_state.c ip: Fix data-races around sysctl_ip_no_pmtu_disc. 2022-07-29 17:14:10 +02:00
xfrm_sysctl.c
xfrm_user.c xfrm: Check if_id in xfrm_migrate 2022-03-19 13:40:16 +01:00