kernel-hacking-2024-linux-s.../net/tls
Xiyu Yang 095f5614bf net/tls: Fix sk_psock refcnt leak in bpf_exec_tx_verdict()
bpf_exec_tx_verdict() invokes sk_psock_get(), which returns a reference
of the specified sk_psock object to "psock" with increased refcnt.

When bpf_exec_tx_verdict() returns, local variable "psock" becomes
invalid, so the refcount should be decreased to keep refcount balanced.

The reference counting issue happens in one exception handling path of
bpf_exec_tx_verdict(). When "policy" equals to NULL but "psock" is not
NULL, the function forgets to decrease the refcnt increased by
sk_psock_get(), causing a refcnt leak.

Fix this issue by calling sk_psock_put() on this error path before
bpf_exec_tx_verdict() returns.

Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-04-27 11:17:16 -07:00
..
Kconfig net/tls: allow compiling TLS TOE out 2019-10-04 14:07:07 -07:00
Makefile net/tls: add skeleton of MIB statistics 2019-10-05 16:29:00 -07:00
tls_device.c net/tls: Annotate access to sk_prot with READ_ONCE/WRITE_ONCE 2020-03-21 20:08:17 -07:00
tls_device_fallback.c net: Use skb_frag_off accessors 2019-07-30 14:21:32 -07:00
tls_main.c net/tls: fix const assignment warning 2020-04-08 14:34:02 -07:00
tls_proc.c net/tls: Fix unused function warning 2019-11-15 12:12:28 -08:00
tls_sw.c net/tls: Fix sk_psock refcnt leak in bpf_exec_tx_verdict() 2020-04-27 11:17:16 -07:00
tls_toe.c net/tls: rename tls_hw_* functions tls_toe_* 2019-10-04 14:07:07 -07:00
trace.c net/tls: add tracing for device/offload events 2019-10-05 16:29:00 -07:00
trace.h net/tls: add device decrypted trace point 2019-10-05 16:29:00 -07:00