Go to file
Daniil Stas f86eb1fa40 hwmon: (drivetemp) Fix driver producing garbage data when SCSI errors occur
ANBZ: #19160

commit 82163d63ae upstream.

scsi_execute_cmd() function can return both negative (linux codes) and
positive (scsi_cmnd result field) error codes.

Currently the driver just passes error codes of scsi_execute_cmd() to
hwmon core, which is incorrect because hwmon only checks for negative
error codes. This leads to hwmon reporting uninitialized data to
userspace in case of SCSI errors (for example if the disk drive was
disconnected).

This patch checks scsi_execute_cmd() output and returns -EIO if it's
error code is positive.

Fixes: CVE-2025-21656
Fixes: 5b46903d8b ("hwmon: Driver for disk and solid state drives with temperature sensors")
Signed-off-by: Daniil Stas <daniil.stas@posteo.net>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Chris Healy <cphealy@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: linux-kernel@vger.kernel.org
Cc: linux-scsi@vger.kernel.org
Cc: linux-ide@vger.kernel.org
Cc: linux-hwmon@vger.kernel.org
Link: https://lore.kernel.org/r/20250105213618.531691-1-daniil.stas@posteo.net
[groeck: Avoid inline variable declaration for portability]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Bitao Hu <yaoma@linux.alibaba.com>
Reviewed-by: Guixin Liu <kanie@linux.alibaba.com>
Link: https://gitee.com/anolis/cloud-kernel/pulls/4916
2025-03-27 03:34:50 +00:00
Documentation sched/psi: report zeroes for CPU full at the system level 2025-01-16 02:22:49 +00:00
LICENSES LICENSES/deprecated: add Zlib license text 2020-09-16 14:33:49 +02:00
anolis anolis: Remove vtoa.ko 2025-03-26 05:39:57 +00:00
arch anolis: sw64: kexec: add support for crashkernel=size[KMG] 2025-03-25 02:04:03 +00:00
block block: call rq_qos_done() before ref check in batch completions 2025-03-14 03:16:50 +00:00
certs certs/blacklist_hashes.c: fix const confusion in certs blacklist 2022-06-22 14:13:17 +02:00
crypto KEYS: asymmetric: properly validate hash_algo and encoding 2024-10-22 17:41:35 +08:00
drivers hwmon: (drivetemp) Fix driver producing garbage data when SCSI errors occur 2025-03-27 03:34:50 +00:00
fs erofs: simplify erofs_map_blocks_flatmode() 2025-03-19 05:58:01 +00:00
include list: fix a data-race around ep->rdllist 2025-03-27 02:07:05 +00:00
init init/main.c: Fix potential static_command_line memory overflow 2024-12-27 08:24:51 +00:00
io_uring fs: add batch and poll flags to the uring_cmd_iopoll() handler 2024-12-09 06:40:29 +00:00
ipc memcg: enable accounting of ipc resources 2023-03-18 02:22:59 +00:00
kernel sched: remove redundant on_rq status change 2025-03-26 06:31:01 +00:00
lib dyndbg: fix old BUG_ON in >control parser 2025-02-05 07:36:47 +00:00
mm mm: shmem: fix UAF bug in shmem_show_options() 2025-03-24 15:41:49 +08:00
net sched: act_ct: take care of padding in struct zones_ht_key 2025-03-26 10:50:35 +00:00
samples vfio/mbochs: Fix close when multiple device FDs are open 2024-11-12 13:28:27 +00:00
scripts scripts/spelling.txt: remove 'thead' as a typo 2024-12-18 03:19:45 +00:00
security kvm: add cvm host feature 2024-12-20 04:05:11 +00:00
sound ALSA: core: Fix NULL module pointer assignment at card init 2024-12-31 08:58:00 +00:00
tools selftests/sgx: Ignore OpenSSL 3.0 deprecated functions warning 2025-03-14 03:19:33 +00:00
usr usr/include/Makefile: add linux/nfc.h to the compile-test coverage 2022-02-01 17:25:48 +01:00
virt kvm: add cvm host feature 2024-12-20 04:05:11 +00:00
.clang-format RDMA 5.10 pull request 2020-10-17 11:18:18 -07:00
.cocciconfig
.get_maintainer.ignore Opt out of scripts/get_maintainer.pl 2019-05-16 10:53:40 -07:00
.gitattributes .gitattributes: use 'dts' diff driver for dts files 2019-12-04 19:44:11 -08:00
.gitignore kbuild: generate Module.symvers only when vmlinux exists 2021-05-19 10:12:59 +02:00
.mailmap mailmap: add two more addresses of Uwe Kleine-König 2020-12-06 10:19:07 -08:00
COPYING COPYING: state that all contributions really are covered by this file 2020-02-10 13:32:20 -08:00
CREDITS MAINTAINERS: Move Jason Cooper to CREDITS 2020-11-30 10:20:34 +01:00
Kbuild kbuild: rename hostprogs-y/always to hostprogs/always-y 2020-02-04 01:53:07 +09:00
Kconfig kbuild: ensure full rebuild when the compiler is updated 2020-05-12 13:28:33 +09:00
MAINTAINERS anolis: Remove vtoa.ko 2025-03-26 05:39:57 +00:00
Makefile arch: Introduce CONFIG_FUNCTION_ALIGNMENT 2024-03-01 07:25:29 +00:00
README Drop all 00-INDEX files from Documentation/ 2018-09-09 15:08:58 -06:00

README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.