From: sashiko-bot@kernel.org
To: "Jaegyun Lee" <dreams200260@gmail.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH v2] usb: gadget: f_printer: take dev->lock on copy_from_user() failure
Date: Thu, 03 Dec 2026 00:26:04 +0000 [thread overview]
Message-ID: <sashiko-outbox-246836@kernel.org> (raw)
In-Reply-To: <20261203002008.1704433-1-dreams200260@gmail.com>
> In printer_write(), dev->lock is dropped before copy_from_user().
> When copy_from_user() fails, the error path returns the request to
> dev->tx_reqs without retaking dev->lock:
>
> spin_unlock_irqrestore(&dev->lock, flags);
>
> if (copy_from_user(req->buf, buf, size)) {
> list_add(&req->list, &dev->tx_reqs);
> mutex_unlock(&dev->lock_printer_io);
> return bytes_copied;
> }
>
> dev->lock_printer_io only serializes userspace I/O calls and does not
> protect dev->tx_reqs from tx_complete(), which concurrently appends
> completed requests to the same list under dev->lock from UDC giveback.
> [ ... ]
>
> Fixes: 25a010c8c1a5 ("USB: add Printer Gadget Driver")
> Cc: stable@vger.kernel.org
> Assisted-by: ZCode:GLM-5.4
> Signed-off-by: Jaegyun Lee <dreams200260@gmail.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203002008.1704433-1-dreams200260@gmail.com?part=1
next prev parent reply other threads:[~2026-12-03 0:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 13:58 [PATCH] usb: gadget: f_printer: take dev->lock on copy_from_user() failure Jaegyun Lee
2026-11-29 14:06 ` Greg Kroah-Hartman
2026-12-03 0:20 ` [PATCH v2] " Jaegyun Lee
2026-12-03 0:26 ` sashiko-bot [this message]
2026-11-29 14:08 ` [PATCH] " sashiko-bot
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=sashiko-outbox-246836@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dreams200260@gmail.com \
--cc=linux-usb@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.