In the Linux kernel, the following vulnerability has been resolved:
mptcp: fix sleep in atomic at close time
Matt reported a splat at msk close time:
BUG: sleeping function called from invalid context at net/mptcp/protocol.c:2877
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 155, name: packetdrill
preempt_count: 201, expected: 0
RCU nest depth: 0, expected: 0
4 locks held by packetdrill/155:
#0: ffff888001536990 (&sb->s_type->i_mutex_key#6){+.+.}-{3:3}, at: __sock_release (net/socket.c:650)
#1: ffff88800b498130 (sk_lock-AF_INET){+.+.}-{0:0}, at: mptcp_close (net/mptcp/protocol.c:2973)
#2: ffff88800b49a130 (sk_lock-AF_INET/1){+.+.}-{0:0}, at: __mptcp_close_ssk (net/mptcp/protocol.c:2363)
#3: ffff88800b49a0b0 (slock-AF_INET){+...}-{2:2}, at: __lock_sock_fast (include/net/sock.h:1820)
Preemption disabled at:
0x0
CPU: 1 PID: 155 Comm: packetdrill Not tainted 6.1.0-rc5 #365
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl (lib/dump_stack.c:107 (discriminator 4))
__might_resched.cold (kernel/sched/core.c:9891)
__mptcp_destroy_sock (include/linux/kernel.h:110)
__mptcp_close (net/mptcp/protocol.c:2959)
mptcp_subflow_queue_clean (include/net/sock.h:1777)
__mptcp_close_ssk (net/mptcp/protocol.c:2363)
mptcp_destroy_common (net/mptcp/protocol.c:3170)
mptcp_destroy (include/net/sock.h:1495)
__mptcp_destroy_sock (net/mptcp/protocol.c:2886)
__mptcp_close (net/mptcp/protocol.c:2959)
mptcp_close (net/mptcp/protocol.c:2974)
inet_release (net/ipv4/af_inet.c:432)
__sock_release (net/socket.c:651)
sock_close (net/socket.c:1367)
__fput (fs/file_table.c:320)
task_work_run (kernel/task_work.c:181 (discriminator 1))
exit_to_user_mode_prepare (include/linux/resume_user_mode.h:49)
syscall_exit_to_user_mode (kernel/entry/common.c:130)
do_syscall_64 (arch/x86/entry/common.c:87)
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:120)
We can't call mptcpclose under the 'fast' socket lock variant, replace it with a socklock_nested() as the relevant code is already under the listening msk socket lock protection.
{
"cna_assigner": "Linux",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/49xxx/CVE-2022-49018.json"
}[
{
"signature_version": "v1",
"deprecated": false,
"id": "CVE-2022-49018-6ed2807d",
"target": {
"file": "net/mptcp/subflow.c"
},
"digest": {
"line_hashes": [
"263341326314974304471590513335080586806",
"330507684811182492906480121413786852645",
"253793340409606684407272100667184857812",
"199883501871924709731893451635239719791",
"48929215714113239773539234356196992440",
"107941987113028117402715025312226311930",
"27986506476377430464994701624326262768",
"181730142894800574811624155567673102130",
"10783690220966207728919152261633097774",
"45098957520937166507182934673155845788",
"42737418831986534999820954116430973119"
],
"threshold": 0.9
},
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d8e6c5500dbf0f3e87aace90d4beba6ae928e866"
},
{
"signature_version": "v1",
"deprecated": false,
"id": "CVE-2022-49018-cd5043ae",
"target": {
"function": "mptcp_subflow_queue_clean",
"file": "net/mptcp/subflow.c"
},
"digest": {
"length": 950.0,
"function_hash": "249531104008723158714099123366487991759"
},
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d8e6c5500dbf0f3e87aace90d4beba6ae928e866"
},
{
"signature_version": "v1",
"deprecated": false,
"id": "CVE-2022-49018-cdb289b2",
"target": {
"function": "mptcp_subflow_queue_clean",
"file": "net/mptcp/subflow.c"
},
"digest": {
"length": 950.0,
"function_hash": "249531104008723158714099123366487991759"
},
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@b4f166651d03b5484fa179817ba8ad4899a5a6ac"
},
{
"signature_version": "v1",
"deprecated": false,
"id": "CVE-2022-49018-dfab94ae",
"target": {
"file": "net/mptcp/subflow.c"
},
"digest": {
"line_hashes": [
"263341326314974304471590513335080586806",
"330507684811182492906480121413786852645",
"253793340409606684407272100667184857812",
"199883501871924709731893451635239719791",
"48929215714113239773539234356196992440",
"107941987113028117402715025312226311930",
"27986506476377430464994701624326262768",
"181730142894800574811624155567673102130",
"10783690220966207728919152261633097774",
"45098957520937166507182934673155845788",
"42737418831986534999820954116430973119"
],
"threshold": 0.9
},
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@b4f166651d03b5484fa179817ba8ad4899a5a6ac"
}
]