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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251112-diogo-smaug_ec_sensorhub-v1-1-f71d4e9eb9d4@tecnico.ulisboa.pt>
Date: Wed, 12 Nov 2025 16:00:12 +0000
From: Diogo Ivo <diogo.ivo@...nico.ulisboa.pt>
To: Benson Leung <bleung@...omium.org>, Tzung-Bi Shih <tzungbi@...nel.org>, 
 Guenter Roeck <groeck@...omium.org>
Cc: chrome-platform@...ts.linux.dev, linux-kernel@...r.kernel.org, 
 Diogo Ivo <diogo.ivo@...nico.ulisboa.pt>
Subject: [PATCH] platform/chrome: sensorhub: Support devices without
 FIFO_INT_ENABLE

Some devices (such as Smaug) report having MOTION_SENSE_FIFO but do not
support controlling the behaviour of the FIFO interrupt via the
FIFO_INT_ENABLE command and in these cases the interrupt is always
enabled. However, currently the code assumes that if MOTION_SENSE_FIFO
is supported then so is FIFO_INT_ENABLE, and when it tries to enable
the interrupt via this command and an unsupported device reports a
failure it then propagates this into failing the sensors probe.

In order to fix this, since the EC does not provide a way to determine
a priori if there is support for FIFO_INT_ENABLE send this command
unconditionally and carefully interpret the return value -EINVAL as a
device where FIFO_INT_ENABLE is not present and the interrupt is always
enabled.

Signed-off-by: Diogo Ivo <diogo.ivo@...nico.ulisboa.pt>
---
 drivers/platform/chrome/cros_ec_sensorhub_ring.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/platform/chrome/cros_ec_sensorhub_ring.c b/drivers/platform/chrome/cros_ec_sensorhub_ring.c
index 1205219515d6..d487ace7d172 100644
--- a/drivers/platform/chrome/cros_ec_sensorhub_ring.c
+++ b/drivers/platform/chrome/cros_ec_sensorhub_ring.c
@@ -129,6 +129,18 @@ int cros_ec_sensorhub_ring_fifo_enable(struct cros_ec_sensorhub *sensorhub,
 	/* We expect to receive a payload of 4 bytes, ignore. */
 	if (ret > 0)
 		ret = 0;
+	/*
+	 * Some platforms (such as Smaug) don't support the FIFO_INT_ENABLE
+	 * command and the interrupt is always enabled. Since the EC protocol
+	 * does not provide a way to discover if the command is supported a
+	 * priori interpret -EINVAL as not supported and proceed normally.
+	 *
+	 * N.B: there is no danger of -EINVAL meaning any other invalid
+	 * parameter since fifo_int_enable.enable is a bool and can never
+	 * be in an invalid range.
+	 */
+	else if (ret == -EINVAL)
+		ret = 0;
 
 	return ret;
 }

---
base-commit: 50e3a23e86817c295b5a188663c24054ec5932ed
change-id: 20251104-diogo-smaug_ec_sensorhub-3ddca5b0d359

Best regards,
-- 
Diogo Ivo <diogo.ivo@...nico.ulisboa.pt>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ