CVE-2024-50147: net/mlx5: Fix command bitmask initialization
In the Linux kernel, the following vulnerability has been resolved:
net/mlx5: Fix command bitmask initialization
Command bitmask have a dedicated bit for MANAGEPAGES command, this bit isn't Initialize during command bitmask Initialization, only during MANAGEPAGES.
In addition, mlx5cmdtriggercompletions() is trying to trigger completion for MANAGEPAGES command as well.
Hence, in case health error occurred before any MANAGEPAGES command have been invoke (for example, during mlx5enablehca()), mlx5cmdtriggercompletions() will try to trigger completion for MANAGEPAGES command, which will result in null-ptr-deref error.[1]
Fix it by Initialize command bitmask correctly.
While at it, re-write the code for better understanding.
[1] BUG: KASAN: null-ptr-deref in mlx5cmdtriggercompletions+0x1db/0x600 [mlx5core] Write of size 4 at addr 0000000000000214 by task kworker/u96:2/12078 CPU: 10 PID: 12078 Comm: kworker/u96:2 Not tainted 6.9.0-rc2forupstreamdebug202404071901 #1 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 Workqueue: mlx5health0000:08:00.0 mlx5fwfatalreportererrwork [mlx5core] Call Trace: <TASK> dumpstacklvl+0x7e/0xc0 kasanreport+0xb9/0xf0 kasancheckrange+0xec/0x190 mlx5cmdtriggercompletions+0x1db/0x600 [mlx5core] mlx5cmdflush+0x94/0x240 [mlx5core] entererrorstate+0x6c/0xd0 [mlx5core] mlx5fwfatalreportererrwork+0xf3/0x480 [mlx5core] processonework+0x787/0x1490 ? lockdephardirqsonprepare+0x400/0x400 ? pwqdecnrinflight+0xda0/0xda0 ? assignwork+0x168/0x240 workerthread+0x586/0xd30 ? rescuerthread+0xae0/0xae0 kthread+0x2df/0x3b0 ? kthreadcompleteandexit+0x20/0x20 retfromfork+0x2d/0x70 ? kthreadcompleteandexit+0x20/0x20 retfromforkasm+0x11/0x20 </TASK>
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2024-50147?
The severity of CVE-2024-50147 has not been explicitly rated but involves a technical flaw in the Linux kernel's command bitmask initialization.
How does CVE-2024-50147 affect Linux kernel users?
CVE-2024-50147 affects certain versions of the Linux kernel by potentially leading to mismanagement of command bits.
How do I fix CVE-2024-50147?
To fix CVE-2024-50147, users should upgrade their Linux kernel to a patched version that addresses the command bitmask initialization issue.
Which versions of the Linux kernel are affected by CVE-2024-50147?
CVE-2024-50147 affects Linux kernel versions between 6.1 and 6.12-rc3, including several specific release candidates.
Is CVE-2024-50147 exploitable?
While the specifics of exploitation are not detailed, vulnerabilities in command bitmask initialization can have security implications.