Linux USB
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Oliver Neukum <oneukum@suse.com>
Cc: Keshav Verma <iganschel@gmail.com>,
	johan@kernel.org, kees@kernel.org, o.bock@fh-wolfenbuettel.de,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: misc: cypress_cy7c63: check control transfer status
Date: Fri, 10 Jul 2026 14:06:25 +0200	[thread overview]
Message-ID: <2026071038-gilled-autograph-f3b8@gregkh> (raw)
In-Reply-To: <58b55e55-652a-498a-8f36-145d9ad58e9e@suse.com>

On Fri, Jul 10, 2026 at 11:53:31AM +0200, Oliver Neukum wrote:
> On 10.07.26 01:30, Keshav Verma wrote:
> > read_port() currently ignores errors from vendor_command() and always
> > returns the cached port value. This can report stale data when the USB
> > control transfer fails or returns a short response.
> > 
> > Convert vendor_command() to usb_control_msg_recv(), which returns 0 on
> > success and a negative errno on failure, and propagate transport errors
> > from read_port() instead of returning cached data.
> 
> Hi,
> 
> Thank you for making a patch for this issue.
> I am sorry, but this approach mixes issues that are real with something
> that is not a problem.
> > Fixes: 9189bfc2df0f ("[PATCH] USB: rename Cypress CY7C63xxx driver to
> > proper name and fix up some tiny things")
> > Signed-off-by: Keshav Verma <iganschel@gmail.com>
> > ---
> > v2:
> 
> > -       retval = usb_control_msg(dev->udev, pipe, request,
> > -                                USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_OTHER,
> > -                                address, data, iobuf, CYPRESS_MAX_REQSIZE,
> > -                                USB_CTRL_GET_TIMEOUT);
> 
> This does return errors.

Yes, but they are not checked properly, as your patch showed.

> > -       /* we must not process garbage */
> > -       if (retval < 2)
> > +       dev_dbg(&dev->udev->dev, "Sending usb_control_msg_recv (data:
> > %d)\n", data);
> > +
> > +       retval = usb_control_msg_recv(dev->udev, 0, request,
> 
> There is no point in this change. You just allocate yet another
> buffer for no gain.

That's not an issue, we should be moving all drivers away from
usb_control_msg() as it's used wrong so many times (like this one.)

So I think this is the correct thing to be doing here.

thanks,

greg k-h

      parent reply	other threads:[~2026-07-10 12:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-18 20:30 [PATCH] usb: misc: cypress_cy7c63: check control transfer status Keshav Verma
2026-07-08 15:15 ` Greg KH
2026-07-08 18:04   ` Keshav Verma
2026-07-09 23:30     ` Keshav Verma
2026-07-10  9:53       ` Oliver Neukum
2026-07-10 12:01         ` Keshav Verma
2026-07-10 12:06         ` Greg KH [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=2026071038-gilled-autograph-f3b8@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=iganschel@gmail.com \
    --cc=johan@kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=o.bock@fh-wolfenbuettel.de \
    --cc=oneukum@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox