Skip to contentSkip to conversation

CVE-2026-98812: net/mctp: publish the mctp_dev only after it is initialised

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Oct 18

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

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

net/mctp: publish the mctp_dev only after it is initialised

mctp_add_dev() links the new mctp_dev into dev->mctp_ptr before mdev->dev is assigned, so a reader that picks the device up in that window dereferences a net_device pointer that is still NULL:

KASAN: null-ptr-deref in range [0x00000000000000b0-0x00000000000000b7]
Call Trace:
 <TASK>
 ? __pfx_mctp_sendmsg (./include/linux/sockptr.h:49)
 ? __pfx_mctp_dst_output (net/mctp/route.c:41)
 ? selinux_socket_sendmsg (security/selinux/hooks.c:5278)
 ____sys_sendmsg (net/socket.c:775 (discriminator 1) net/socket.c:790
 (discriminator 1) net/socket.c:2684 (discriminator 1))
 ? __pfx_____sys_sendmsg (net/socket.c:1131)
 ? __pfx_copy_msghdr_from_user (net/socket.c:2590)
 ? update_cfs_rq_load_avg (kernel/sched/fair.c:5478)
 ___sys_sendmsg (net/socket.c:2738)
 ? __pfx____sys_sendmsg (net/socket.c:2625)
 ? perf_event_task_tick (./include/linux/rcupdate.h:838)
 ? sched_tick (kernel/sched/core.c:5818)
 ? clockevents_program_event (kernel/time/clockevents.c:372)
 ? fdget (./include/linux/rcupdate.h:873 fs/file.c:1100)
 __sys_sendmsg (net/socket.c:2770)
 ? __pfx___sys_sendmsg (net/socket.c:2751)
 do_syscall_64 (arch/x86/entry/syscall_64.c:63)
 entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121)
 </TASK>

Fix by publishing only once the object is fully initialised:
__mctp_dev_get() runs under rcu_read_lock() only and hands this object to readers as soon as mctp_ptr is assigned, so they must never observe mdev->dev == NULL.

The Linux kernel CVE team has assigned CVE-2026-98812 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.15 with commit 583be982d93479ea3d85091b0fd0b01201ede87d and fixed in 6.12.113 with commit af6e4f931afc2d670d133aa2bedc8b6e3753c618
	Issue introduced in 5.15 with commit 583be982d93479ea3d85091b0fd0b01201ede87d and fixed in 6.18.56 with commit 63120572edde85bb2b70b0ed4d4817ed52247613
	Issue introduced in 5.15 with commit 583be982d93479ea3d85091b0fd0b01201ede87d and fixed in 7.2.10 with commit f37f42e6e039a48c2dcf6c079b9f7fbc864ab7ef
	Issue introduced in 5.15 with commit 583be982d93479ea3d85091b0fd0b01201ede87d and fixed in 7.3-rc6 with commit aadf655e8ea9a8ffa24bb8d69f504572e8d18181

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2026-98812

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
net/mctp/device.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/af6e4f931afc2d670d133aa2bedc8b6e3753c618
	https://git.kernel.org/stable/c/63120572edde85bb2b70b0ed4d4817ed52247613
	https://git.kernel.org/stable/c/f37f42e6e039a48c2dcf6c079b9f7fbc864ab7ef
	https://git.kernel.org/stable/c/aadf655e8ea9a8ffa24bb8d69f504572e8d18181