usb: typec: ucsi: debugfs: Fix GET commands on UCSI < 2.0
Subsystems (2)
PATCH 1/1 usb: typec: ucsi: debugfs: Fix GET commands on UCSI < 2.0
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ş <[email protected]>
--- drivers/usb/typec/ucsi/debugfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/typec/ucsi/debugfs.c +2 -1
@@ -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 ;
Signature · 1 line
2.55.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 6 lines
Since the debugfs response buffer grew to 24 bytes, every GET command fails with
-EINVALon UCSI < 2.0, where the data length is limited to 16 bytes. Clamp the length toUCSI_MAX_DATA_LENGTH().Fixes d9dc19910321 ("usb: typec: ucsi: Fix debugfs response truncation beyond 16 bytes")Signed-off-by Ali Ahmet Memiş <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 6 lines · Ali Ahmet Memiş
Since the debugfs response buffer grew to 24 bytes, every GET command fails with
-EINVALon UCSI < 2.0, where the data length is limited to 16 bytes. Clamp the length toUCSI_MAX_DATA_LENGTH().Fixes d9dc19910321 ("usb: typec: ucsi: Fix debugfs response truncation beyond 16 bytes")Signed-off-by Ali Ahmet Memiş <[email protected]>
Reviewed-by Heikki Krogerus <[email protected]>
Quoted 20 lines
--- drivers/usb/typec/ucsi/debugfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/usb/typec/ucsi/debugfs.c +2
-1@@ -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 ;Signature · 1 line
2.55.0
Signature · 1 line
heikki