* [PATCH] usb: typec: ucsi: debugfs: Fix GET commands on UCSI < 2.0
@ 2026-10-24 17:44 Ali Ahmet Memiş
2026-10-24 17:57 ` sashiko-bot
2026-10-26 13:36 ` Heikki Krogerus
0 siblings, 2 replies; 3+ messages 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 related [flat|nested] 3+ messages in thread* Re: [PATCH] usb: typec: ucsi: debugfs: Fix GET commands on UCSI < 2.0
2026-10-24 17:44 [PATCH] usb: typec: ucsi: debugfs: Fix GET commands on UCSI < 2.0 Ali Ahmet Memiş
@ 2026-10-24 17:57 ` sashiko-bot
2026-10-26 13:36 ` Heikki Krogerus
1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-10-24 17:57 UTC (permalink / raw)
To: Ali Ahmet Memiş; +Cc: linux-usb
> 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>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261024174441.878903-1-aliamemis@disroot.org?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] usb: typec: ucsi: debugfs: Fix GET commands on UCSI < 2.0
2026-10-24 17:44 [PATCH] usb: typec: ucsi: debugfs: Fix GET commands on UCSI < 2.0 Ali Ahmet Memiş
2026-10-24 17:57 ` sashiko-bot
@ 2026-10-26 13:36 ` Heikki Krogerus
1 sibling, 0 replies; 3+ messages in thread
From: Heikki Krogerus @ 2026-10-26 13:36 UTC (permalink / raw)
To: Ali Ahmet Memiş
Cc: Greg Kroah-Hartman, Madhu M, Pooja Katiyar, linux-usb,
linux-kernel
On Sat, Oct 24, 2026 at 08:44:41PM +0300, Ali Ahmet Memiş wrote:
> 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>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> 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
--
heikki
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-26 13:36 UTC | newest]
Thread overview: 3+ messages (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ş
2026-10-24 17:57 ` sashiko-bot
2026-10-26 13:36 ` Heikki Krogerus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox