* [PATCH] usb: typec: ucsi: debugfs: Fix GET commands on UCSI < 2.0
@ 2026-10-24 17:44 Ali Ahmet Memiş
0 siblings, 0 replies; only message in thread
From: Ali Ahmet Memiş @ 2026-10-24 17:44 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman
Cc: Madhu M, Pooja Katiyar, linux-usb, linux-kernel
Since the debugfs response buffer grew to 24 bytes, every GET command
fails with -EINVAL on UCSI < 2.0, where the data length is limited to 16
bytes. Clamp the length to UCSI_MAX_DATA_LENGTH().
Fixes: d9dc19910321 ("usb: typec: ucsi: Fix debugfs response truncation beyond 16 bytes")
Signed-off-by: Ali Ahmet Memiş <aliamemis@disroot.org>
---
drivers/usb/typec/ucsi/debugfs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/typec/ucsi/debugfs.c b/drivers/usb/typec/ucsi/debugfs.c
index 77a0dd75edd3..3cffd3778c67 100644
--- a/drivers/usb/typec/ucsi/debugfs.c
+++ b/drivers/usb/typec/ucsi/debugfs.c
@@ -60,7 +60,8 @@ static int ucsi_cmd(void *data, u64 val)
case UCSI_GET_LPM_PPM_INFO:
ret = ucsi_send_command(ucsi, val,
&ucsi->debugfs->response,
- sizeof(ucsi->debugfs->response));
+ min(sizeof(ucsi->debugfs->response),
+ UCSI_MAX_DATA_LENGTH(ucsi)));
break;
default:
ret = -EOPNOTSUPP;
--
2.55.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-24 17:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-24 17:44 [PATCH] usb: typec: ucsi: debugfs: Fix GET commands on UCSI < 2.0 Ali Ahmet Memiş
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®