All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: "Ali Ahmet Memiş" <aliamemis@disroot.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Madhu M <madhu.m@intel.com>,
	Pooja Katiyar <pooja.katiyar@intel.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: typec: ucsi: debugfs: Fix GET commands on UCSI < 2.0
Date: Mon, 26 Oct 2026 14:36:49 +0100	[thread overview]
Message-ID: <at9XcSnYtFvxf1H5@black.igk.intel.com> (raw)
In-Reply-To: <20261024174441.878903-1-aliamemis@disroot.org>

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

      parent reply	other threads:[~2026-10-26 13:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=at9XcSnYtFvxf1H5@black.igk.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=aliamemis@disroot.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=madhu.m@intel.com \
    --cc=pooja.katiyar@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.