[PATCH] usb: typec: ucsi: debugfs: Fix GET commands on UCSI < 2.0

From: Ali Ahmet Memiş

Date: Sat Oct 24 2026 - 13:45:24 EST


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@xxxxxxxxxxx>
---
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