diff options
author | Daniil Stas <daniil.stas@posteo.net> | 2025-01-05 21:36:18 +0000 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2025-01-07 16:36:01 -0800 |
commit | 82163d63ae7a4c36142cd252388737205bb7e4b9 (patch) | |
tree | 14d6933fd92e25d3460387c0774ee326c55d1cb4 /drivers/remoteproc/qcom_q6v5_wcss.c | |
parent | 9d89551994a430b50c4fffcb1e617a057fa76e20 (diff) | |
download | lwn-82163d63ae7a4c36142cd252388737205bb7e4b9.tar.gz lwn-82163d63ae7a4c36142cd252388737205bb7e4b9.zip |
hwmon: (drivetemp) Fix driver producing garbage data when SCSI errors occur
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: 5b46903d8bf37 ("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>
Diffstat (limited to 'drivers/remoteproc/qcom_q6v5_wcss.c')
0 files changed, 0 insertions, 0 deletions