CVE-2022-49979 Information
Description
In the Linux kernel the following vulnerability has been resolved:
net: fix refcount bug in sk_psock_get (2)
Syzkaller reports refcount bug as follows:
————[ cut here ]————
refcount_t: saturated; leaking memory.
WARNING: CPU: 1 PID: 3605 at lib/refcount.c:19 refcount_warn_saturate+0xf4/0x1e0 lib/refcount.c:19
Modules linked in:
CPU: 1 PID: 3605 Comm: syz-executor208 Not tainted 5.18.0-syzkaller-03023-g7e062cda7d90 0
During SMC fallback process in connect syscall kernel will replaces TCP with SMC. In order to forward wakeup smc socket waitqueue after fallback kernel will sets clcsk->sk_user_data to origin smc socket in smc_fback_replace_callbacks().
Later in shutdown syscall kernel will calls sk_psock_get() which treats the clcsk->sk_user_data as psock type triggering the refcnt warning.
So the root cause is that smc and psock both will use sk_user_data field. So they will mismatch this field easily.
This patch solves it by using another bit(defined as SK_USER_DATA_PSOCK) in PTRMASK to mark whether sk_user_data points to a psock object or not. This patch depends on a PTRMASK introduced in commit f1ff5ce2cd5e ( et sk_msg: Clear sk_user_data pointer on clone if tagged).
For there will possibly be more flags in the sk_user_data field this patch also refactor sk_user_data flags code to be more generic to improve its maintainability.
Reference
https://git.kernel.org/stable/c/2a0133723f9ebeb751cfce19f74ec07e108bef1f https://git.kernel.org/stable/c/61cc798591a36ca27eb7d8d6c09bf20e50a59968 https://git.kernel.org/stable/c/86026be8535c16fcc5e4f960286faf04d7f77815 https://git.kernel.org/stable/c/a5d1cb908131e939bd8b63b8e5e23365bbc2edaf
Related CNNVD
CNNVD-202506-2266 (Published: 2025-06-18)
Share on: