lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Mon,  4 Oct 2021 21:53:06 -0700
From:   "Zephaniah E. Loss-Cutler-Hull" <zephaniah@...il.com>
To:     linux-nvme@...ts.infradead.org
Cc:     linux-kernel@...r.kernel.org,
        "Zephaniah E. Loss-Cutler-Hull" <zephaniah@...il.com>
Subject: [PATCH] nvme: hwmon: Do not create min and max values when not supported.

The Mushkin Enhanced Pilot-E 2TB (MKNSSDPE2TB-D8) provides a composite
temperature, as well as the over temperature threshold and under
temperature threshold settings for the composite temperature.

However for the 5 individual sensors, no over or under temperature
thresholds appear to be available, any attempt to access them results in
an error.

At the moment, that means that reading from or writing to the _min or
_max files in sys (as lmsensors does) results in an error.

That isn't horribly user friendly, and we can detect this situation at
initialization time.

So in nvme_hwmon_is_visible, for the hwmon_temp_max/hwmon_temp_min case,
we now attempt to actually get the threshold data, and if that fails we
return 0 to indicate that the data should not be made visible.

Signed-off-by: Zephaniah E. Loss-Cutler-Hull <zephaniah@...il.com>
---
 drivers/nvme/host/hwmon.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/nvme/host/hwmon.c b/drivers/nvme/host/hwmon.c
index 0a586d712920..063f8aaddcd5 100644
--- a/drivers/nvme/host/hwmon.c
+++ b/drivers/nvme/host/hwmon.c
@@ -164,6 +164,10 @@ static umode_t nvme_hwmon_is_visible(const void *_data,
 	case hwmon_temp_min:
 		if ((!channel && data->ctrl->wctemp) ||
 		    (channel && data->log.temp_sensor[channel - 1])) {
+			long val;
+
+			if (nvme_get_temp_thresh(data->ctrl, channel, (attr == hwmon_temp_min), &val) < 0)
+				return 0;
 			if (data->ctrl->quirks &
 			    NVME_QUIRK_NO_TEMP_THRESH_CHANGE)
 				return 0444;
-- 
2.33.0

Powered by blists - more mailing lists