All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Linkai Gong <gonglinkai@kylinos.cn>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Michael Zimmermann <sigmaepsilon92@gmail.com>,
	Peter Korsgaard <peter@korsgaard.com>,
	Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	John Keeping <jkeeping@inmusicbrands.com>,
	William Wu <william.wu@rock-chips.com>,
	Marco Crivellari <marco.crivellari@suse.com>,
	Ethan Tidmore <ethantidmore06@gmail.com>,
	Kees Cook <kees@kernel.org>, Chris Wulff <Chris.Wulff@biamp.com>,
	David Sands <david.sands@biamp.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: gadget: f_hid: drop ERROR() on copy_from_user() failure
Date: Tue, 18 Aug 2026 09:07:49 +0100	[thread overview]
Message-ID: <20260818090749.3fa0ea61@pumpkin> (raw)
In-Reply-To: <20260818012118.3903388-1-gonglinkai@kylinos.cn>

On Tue, 18 Aug 2026 09:21:18 +0800
Linkai Gong <gonglinkai@kylinos.cn> wrote:

> A failed copy_from_user() is a userspace error and should not spam the
> kernel log. Just free the temporary entry and return.
> 
> Suggested-by: David Laight <david.laight.linux@gmail.com>
> Signed-off-by: Linkai Gong <gonglinkai@kylinos.cn>
> ---
>  drivers/usb/gadget/function/f_hid.c | 1 -
>  1 file changed, 1 deletion(-)
> diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
> index 3c6b43d06a6d..5c39da1ac7a6 100644
> --- a/drivers/usb/gadget/function/f_hid.c
> +++ b/drivers/usb/gadget/function/f_hid.c
> @@ -656,7 +656,6 @@ static int f_hidg_get_report(struct file *file, struct usb_hidg_report __user *b
>  
>  	if (copy_from_user(&entry->report_data, buffer,
>  				sizeof(struct usb_hidg_report))) {
> -		ERROR(cdev, "copy_from_user error\n");
>  		kfree(entry);
>  		return -EINVAL;

This should be -EFAULT.

David

>  	}


  parent reply	other threads:[~2026-08-18  8:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-17  6:11 [PATCH] usb: gadget: f_hid: do not copy_from_user() under a spinlock Linkai Gong
2026-08-17  8:39 ` Peter Korsgaard
2026-08-17 14:46 ` David Laight
2026-08-18  1:17   ` Linkai Gong
2026-08-18  1:21   ` [PATCH] usb: gadget: f_hid: drop ERROR() on copy_from_user() failure Linkai Gong
2026-08-18  6:32     ` Peter Korsgaard
2026-08-18  8:07     ` David Laight [this message]
2026-08-18  8:42     ` [PATCH v2] " Linkai Gong

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=20260818090749.3fa0ea61@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=Chris.Wulff@biamp.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=david.sands@biamp.com \
    --cc=ethantidmore06@gmail.com \
    --cc=gonglinkai@kylinos.cn \
    --cc=gregkh@linuxfoundation.org \
    --cc=jkeeping@inmusicbrands.com \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=marco.crivellari@suse.com \
    --cc=peter@korsgaard.com \
    --cc=sigmaepsilon92@gmail.com \
    --cc=william.wu@rock-chips.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.