CVE: CVE-2023-52613
Published: 2024-03-18
Description: In the Linux kernel, the following vulnerability has been resolved:

drivers/thermal/loongson2_thermal: Fix incorrect PTR_ERR() judgment

PTR_ERR() returns -ENODEV when thermal-zones are undefined, and we need
-ENODEV as the right value for comparison.

Otherwise, tz->type is NULL when thermal-zones is undefined, resulting
in the following error:

[   12.290030] CPU 1 Unable to handle kernel paging request at virtual address fffffffffffffff1, era ==[PII_REDACTED]55f410, ra ==[PII_REDACTED]1579b8
[   12.302877] Oops[#1]:
[   12.305190] CPU: 1 PID: 181 Comm: systemd-udevd Not tainted 6.6.0-rc7+ #5385
[   12.312304] pc[PII_REDACTED]55f410 ra[PII_REDACTED]1579b8 tp[PII_REDACTED]9e8000 sp[PII_REDACTED]9eba10
[   12.320739] a0 [PII_REDACTED] a1 fffffffffffffff1 a2 [PII_REDACTED] a3 [PII_REDACTED]
[   12.329173] a4[PII_REDACTED]9eb990 a5 [PII_REDACTED] a6 [PII_REDACTED] a7[PII_REDACTED]03431c
[   12.337606] t0 fffffffffffffff1 t1 54567fd5da9b4fd4 t2[PII_REDACTED]14ec40 t3[PII_REDACTED]0dc901
[   12.346041] t4 [PII_REDACTED] t5 [PII_REDACTED] t6[PII_REDACTED]14ee20 t7 900000000d00b790
[   12.354472] t8[PII_REDACTED]0dc901 u0 54567fd5da9b4fd4 s9[PII_REDACTED]02ae10 s0[PII_REDACTED]14ec40
[   12.362916] s[PII_REDACTED]9fced0 s2 ffffffffffffffed s3 ffffffffffffffed s4[PII_REDACTED]acc000
[   12.362931] s5 [PII_REDACTED] s6 fffffffffffff000 s7 [PII_REDACTED] s8[PII_REDACTED]8b2ec8
[   12.362938]    ra:[PII_REDACTED]1579b8 thermal_add_hwmon_sysfs+0x258/0x300
[   12.386411]   ERA:[PII_REDACTED]55f410 strscpy+0xf0/0x160
[   12.391626]  CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE)
[   12.397898]  PRMD: 00000004 (PPLV0 +PIE -PWE)
[   12.403678]  EUEN: 00000000 (-FPE -SXE -ASXE -BTE)
[   12.409859]  ECFG: 00071c1c (LIE=2-4,10-12 VS=7)
[   12.415882] ESTAT: 00010000 [PIL] (IS= ECode=1 EsubCode=0)
[   12.415907]  BADV: fffffffffffffff1
[   12.415911]  PRID: 0014a000 (Loongson-64bit, Loongson-2K1000)
[   12.415917] Modules linked in: loongson2_thermal(+) vfat fat uio_pdrv_genirq uio fuse zram zsmalloc
[   12.415950] Process systemd-udevd (pid: 181, threadinfo=[PII_REDACTED]8b9718, task=00000000ace72fe3)
[   12.415961] Stack :[PII_REDACTED]000dc0 54567fd5da9b4fd4[PII_REDACTED]02ae10[PII_REDACTED]df9358
[   12.415982]         ffffffffffffffed [PII_REDACTED][PII_REDACTED]a10aa8[PII_REDACTED]2a3410
[   12.415999]         ffffffffffffffed ffffffffffffffed[PII_REDACTED]a1[PII_REDACTED]003157ab0
[   12.416016]        [PII_REDACTED]a10aa8 ffffff80020fc0c8[PII_REDACTED]2a3410 ffffffffffffffed
[   12.416032]         [PII_REDACTED] ffffff80020cc1e8[PII_REDACTED]02b2a0[PII_REDACTED]acc000
[   12.416048]        [PII_REDACTED]2a3410 [PII_REDACTED] ffffff80020f4[PII_REDACTED]1002a3410
[   12.416065]         [PII_REDACTED][PII_REDACTED]df6[PII_REDACTED]1002a3410 [PII_REDACTED]
[   12.416081]         ffffff80020f4030 [PII_REDACTED][PII_REDACTED]2a3[PII_REDACTED]002df2ba8
[   12.416097]        [PII_REDACTED]0000b4[PII_REDACTED]2a34f4[PII_REDACTED]2a3410 [PII_REDACTED]
[   12.416114]         ffffff80020f4030 fffffffffffffff0[PII_REDACTED]2a3[PII_REDACTED]002df2f30
[   12.416131]         ...
[   12.416138] Call Trace:
[   12.416142] [<[PII_REDACTED]55f410>] strscpy+0xf0/0x160
[   12.416167] [<[PII_REDACTED]1579b8>] thermal_add_hwmon_sysfs+0x258/0x300
[   12.416183] [<[PII_REDACTED]157ab0>] devm_thermal_add_hwmon_sysfs+0x50/0xe0
[   12.416200] [<ffffff80020cc1e8>] loongson2_thermal_probe+0x128/0x200 [loongson2_thermal]
[   12.416232] [<[PII_REDACTED]df6808>] platform_probe+0x68/0x140
[   12.416249] [<[PII_REDACTED]df2ba8>] really_probe+0xc8/0x3c0
[   12.416269] [<[PII_REDACTED]df2f30>] __driver_probe_device+0x90/0x180
[   12.416286] [<[PII_REDACTED]df3058>] driver_probe_device+0x38/0x160
[   12.416302] [<[PII_REDACTED]df33a8>] __driver_attach+0xa8/0x200
[   12.416314] [<[PII_REDACTED]deffec>] bus_for_each_dev+0x8c/0x120
[   12.416330] [<[PII_REDACTED]df198c>] bus_add_driver+0x10c/0x2a0
[   12.416346] [<[PII_REDACTED]df46b4>] driver_register+0x74/0x160
[   12.416358] [<[PII_REDACTED]2201a4>] do_one_initcall+0x84/0x220
[   12.416372] [<[PII_REDACTED]2f3ab8>] do_init_module+0x58/0x2c0
[
---truncated---
CVSS Score: 5.5 (MEDIUM)
CWE: CWE-476
References: https://git.kernel.org/stable/c/15ef92e9c41124ee9d88b01208364f3fe1f45f84; https://git.kernel.org/stable/c/6010a9fc14eb1feab5cafd[PII_REDACTED]4fe8ec58; https://git.kernel.org/stable/c/70481755ed77400e783200e2d022e5fea16060ce