From: Peter Korsgaard <peter@korsgaard.com>
To: Linkai Gong <gonglinkai@kylinos.cn>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
David Laight <david.laight.linux@gmail.com>,
Michael Zimmermann <sigmaepsilon92@gmail.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 08:32:34 +0200 [thread overview]
Message-ID: <877bloym4d.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <20260818012118.3903388-1-gonglinkai@kylinos.cn> (Linkai Gong's message of "Tue, 18 Aug 2026 09:21:18 +0800")
>>>>> "Linkai" == Linkai Gong <gonglinkai@kylinos.cn> writes:
> 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>
Acked-by: Peter Korsgaard <peter@korsgaard.com>
> ---
> 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;
> }
> --
> 2.25.1
--
Bye, Peter Korsgaard
next prev parent reply other threads:[~2026-08-18 6:33 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 [this message]
2026-08-18 8:07 ` David Laight
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=877bloym4d.fsf@dell.be.48ers.dk \
--to=peter@korsgaard.com \
--cc=Chris.Wulff@biamp.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=david.laight.linux@gmail.com \
--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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox