CVE-2022-49979

Source
https://nvd.nist.gov/vuln/detail/CVE-2022-49979
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2022-49979.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2022-49979
Downstream
Published
2025-06-18T11:15:25Z
Modified
2025-07-01T14:24:40.465785Z
Summary
[none]
Details

In the Linux kernel, the following vulnerability has been resolved:

net: fix refcount bug in skpsockget (2)

Syzkaller reports refcount bug as follows: ------------[ cut here ]------------ refcountt: saturated; leaking memory. WARNING: CPU: 1 PID: 3605 at lib/refcount.c:19 refcountwarnsaturate+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 <TASK> _refcountaddnotzero include/linux/refcount.h:163 [inline] _refcountincnotzero include/linux/refcount.h:227 [inline] refcountincnotzero include/linux/refcount.h:245 [inline] skpsockget+0x3bc/0x410 include/linux/skmsg.h:439 tlsdataready+0x6d/0x1b0 net/tls/tlssw.c:2091 tcpdataready+0x106/0x520 net/ipv4/tcpinput.c:4983 tcpdataqueue+0x25f2/0x4c90 net/ipv4/tcpinput.c:5057 tcprcvstateprocess+0x1774/0x4e80 net/ipv4/tcpinput.c:6659 tcpv4dorcv+0x339/0x980 net/ipv4/tcpipv4.c:1682 skbacklogrcv include/net/sock.h:1061 [inline] _releasesock+0x134/0x3b0 net/core/sock.c:2849 releasesock+0x54/0x1b0 net/core/sock.c:3404 inetshutdown+0x1e0/0x430 net/ipv4/afinet.c:909 _sysshutdownsock net/socket.c:2331 [inline] _sysshutdownsock net/socket.c:2325 [inline] _sysshutdown+0xf1/0x1b0 net/socket.c:2343 _dosysshutdown net/socket.c:2351 [inline] _sesysshutdown net/socket.c:2349 [inline] _x64sysshutdown+0x50/0x70 net/socket.c:2349 dosyscallx64 arch/x86/entry/common.c:50 [inline] dosyscall64+0x35/0xb0 arch/x86/entry/common.c:80 entrySYSCALL64after_hwframe+0x46/0xb0 </TASK>

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->skuserdata to origin smc socket in smcfbackreplace_callbacks().

Later, in shutdown syscall, kernel will calls skpsockget(), which treats the clcsk->skuserdata as psock type, triggering the refcnt warning.

So, the root cause is that smc and psock, both will use skuserdata field. So they will mismatch this field easily.

This patch solves it by using another bit(defined as SKUSERDATAPSOCK) in PTRMASK, to mark whether skuserdata points to a psock object or not. This patch depends on a PTRMASK introduced in commit f1ff5ce2cd5e ("net, skmsg: Clear skuserdata pointer on clone if tagged").

For there will possibly be more flags in the skuserdata field, this patch also refactor skuserdata flags code to be more generic to improve its maintainability.

References

Affected packages

Debian:11 / linux

Package

Name
linux
Purl
pkg:deb/debian/linux?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
5.10.148-1

Affected versions

5.*

5.10.46-4
5.10.46-5
5.10.70-1~bpo10+1
5.10.70-1
5.10.84-1
5.10.92-1~bpo10+1
5.10.92-1
5.10.92-2
5.10.103-1~bpo10+1
5.10.103-1
5.10.106-1
5.10.113-1
5.10.120-1~bpo10+1
5.10.120-1
5.10.127-1
5.10.127-2~bpo10+1
5.10.127-2
5.10.136-1
5.10.140-1

Ecosystem specific

{
    "urgency": "not yet assigned"
}

Debian:12 / linux

Package

Name
linux
Purl
pkg:deb/debian/linux?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
6.0.2-1

Ecosystem specific

{
    "urgency": "not yet assigned"
}

Debian:13 / linux

Package

Name
linux
Purl
pkg:deb/debian/linux?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
6.0.2-1

Ecosystem specific

{
    "urgency": "not yet assigned"
}