* [PATCH] usb: raw-gadget: do not limit transfer length
@ 2025-09-04 20:06 andrey.konovalov
2025-09-04 20:07 ` andrey.konovalov
2025-10-21 14:18 ` Andrey Konovalov
0 siblings, 2 replies; 6+ messages in thread
From: andrey.konovalov @ 2025-09-04 20:06 UTC (permalink / raw)
To: Andrey Konovalov; +Cc: stable
From: Andrey Konovalov <andreyknvl@gmail.com>
Drop the check on the maximum transfer length in Raw Gadget for both
control and non-control transfers.
Limiting the transfer length causes a problem with emulating USB devices
whose full configuration descriptor exceeds PAGE_SIZE in length.
Overall, there does not appear to be any reason to enforce any kind of
transfer length limit on the Raw Gadget side for either control or
non-control transfers, so let's just drop the related check.
Cc: stable@vger.kernel.org
Fixes: f2c2e717642c ("usb: gadget: add raw-gadget interface")
Signed-off-by: Andrey Konovalov <andreyknvl@gmail.com>
---
drivers/usb/gadget/legacy/raw_gadget.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/usb/gadget/legacy/raw_gadget.c b/drivers/usb/gadget/legacy/raw_gadget.c
index 20165e1582d9..b71680c58de6 100644
--- a/drivers/usb/gadget/legacy/raw_gadget.c
+++ b/drivers/usb/gadget/legacy/raw_gadget.c
@@ -667,8 +667,6 @@ static void *raw_alloc_io_data(struct usb_raw_ep_io *io, void __user *ptr,
return ERR_PTR(-EINVAL);
if (!usb_raw_io_flags_valid(io->flags))
return ERR_PTR(-EINVAL);
- if (io->length > PAGE_SIZE)
- return ERR_PTR(-EINVAL);
if (get_from_user)
data = memdup_user(ptr + sizeof(*io), io->length);
else {
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH] usb: raw-gadget: do not limit transfer length 2025-09-04 20:06 [PATCH] usb: raw-gadget: do not limit transfer length andrey.konovalov @ 2025-09-04 20:07 ` andrey.konovalov 2025-10-21 14:18 ` Andrey Konovalov 1 sibling, 0 replies; 6+ messages in thread From: andrey.konovalov @ 2025-09-04 20:07 UTC (permalink / raw) To: Greg Kroah-Hartman, Alan Stern Cc: Andrey Konovalov, linux-usb, linux-kernel, stable From: Andrey Konovalov <andreyknvl@gmail.com> Drop the check on the maximum transfer length in Raw Gadget for both control and non-control transfers. Limiting the transfer length causes a problem with emulating USB devices whose full configuration descriptor exceeds PAGE_SIZE in length. Overall, there does not appear to be any reason to enforce any kind of transfer length limit on the Raw Gadget side for either control or non-control transfers, so let's just drop the related check. Cc: stable@vger.kernel.org Fixes: f2c2e717642c ("usb: gadget: add raw-gadget interface") Signed-off-by: Andrey Konovalov <andreyknvl@gmail.com> --- drivers/usb/gadget/legacy/raw_gadget.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/usb/gadget/legacy/raw_gadget.c b/drivers/usb/gadget/legacy/raw_gadget.c index 20165e1582d9..b71680c58de6 100644 --- a/drivers/usb/gadget/legacy/raw_gadget.c +++ b/drivers/usb/gadget/legacy/raw_gadget.c @@ -667,8 +667,6 @@ static void *raw_alloc_io_data(struct usb_raw_ep_io *io, void __user *ptr, return ERR_PTR(-EINVAL); if (!usb_raw_io_flags_valid(io->flags)) return ERR_PTR(-EINVAL); - if (io->length > PAGE_SIZE) - return ERR_PTR(-EINVAL); if (get_from_user) data = memdup_user(ptr + sizeof(*io), io->length); else { -- 2.43.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] usb: raw-gadget: do not limit transfer length 2025-09-04 20:06 [PATCH] usb: raw-gadget: do not limit transfer length andrey.konovalov 2025-09-04 20:07 ` andrey.konovalov @ 2025-10-21 14:18 ` Andrey Konovalov 2025-10-21 14:19 ` Andrey Konovalov 1 sibling, 1 reply; 6+ messages in thread From: Andrey Konovalov @ 2025-10-21 14:18 UTC (permalink / raw) To: andrey.konovalov Cc: Greg Kroah-Hartman, Alan Stern, linux-usb, linux-kernel, stable On Thu, Sep 4, 2025 at 10:08 PM <andrey.konovalov@linux.dev> wrote: > > From: Andrey Konovalov <andreyknvl@gmail.com> > > Drop the check on the maximum transfer length in Raw Gadget for both > control and non-control transfers. > > Limiting the transfer length causes a problem with emulating USB devices > whose full configuration descriptor exceeds PAGE_SIZE in length. > > Overall, there does not appear to be any reason to enforce any kind of > transfer length limit on the Raw Gadget side for either control or > non-control transfers, so let's just drop the related check. > > Cc: stable@vger.kernel.org > Fixes: f2c2e717642c ("usb: gadget: add raw-gadget interface") > Signed-off-by: Andrey Konovalov <andreyknvl@gmail.com> > --- > drivers/usb/gadget/legacy/raw_gadget.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/drivers/usb/gadget/legacy/raw_gadget.c b/drivers/usb/gadget/legacy/raw_gadget.c > index 20165e1582d9..b71680c58de6 100644 > --- a/drivers/usb/gadget/legacy/raw_gadget.c > +++ b/drivers/usb/gadget/legacy/raw_gadget.c > @@ -667,8 +667,6 @@ static void *raw_alloc_io_data(struct usb_raw_ep_io *io, void __user *ptr, > return ERR_PTR(-EINVAL); > if (!usb_raw_io_flags_valid(io->flags)) > return ERR_PTR(-EINVAL); > - if (io->length > PAGE_SIZE) > - return ERR_PTR(-EINVAL); > if (get_from_user) > data = memdup_user(ptr + sizeof(*io), io->length); > else { > -- > 2.43.0 > Hi Greg, Could you pick up this patch? Thank you! ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] usb: raw-gadget: do not limit transfer length 2025-10-21 14:18 ` Andrey Konovalov @ 2025-10-21 14:19 ` Andrey Konovalov 2025-10-21 16:06 ` Greg Kroah-Hartman 0 siblings, 1 reply; 6+ messages in thread From: Andrey Konovalov @ 2025-10-21 14:19 UTC (permalink / raw) To: Greg Kroah-Hartman Cc: Alan Stern, linux-usb, linux-kernel, stable, andrey.konovalov On Tue, Oct 21, 2025 at 4:18 PM Andrey Konovalov <andreyknvl@gmail.com> wrote: > > On Thu, Sep 4, 2025 at 10:08 PM <andrey.konovalov@linux.dev> wrote: > > > > From: Andrey Konovalov <andreyknvl@gmail.com> > > > > Drop the check on the maximum transfer length in Raw Gadget for both > > control and non-control transfers. > > > > Limiting the transfer length causes a problem with emulating USB devices > > whose full configuration descriptor exceeds PAGE_SIZE in length. > > > > Overall, there does not appear to be any reason to enforce any kind of > > transfer length limit on the Raw Gadget side for either control or > > non-control transfers, so let's just drop the related check. > > > > Cc: stable@vger.kernel.org > > Fixes: f2c2e717642c ("usb: gadget: add raw-gadget interface") > > Signed-off-by: Andrey Konovalov <andreyknvl@gmail.com> > > --- > > drivers/usb/gadget/legacy/raw_gadget.c | 2 -- > > 1 file changed, 2 deletions(-) > > > > diff --git a/drivers/usb/gadget/legacy/raw_gadget.c b/drivers/usb/gadget/legacy/raw_gadget.c > > index 20165e1582d9..b71680c58de6 100644 > > --- a/drivers/usb/gadget/legacy/raw_gadget.c > > +++ b/drivers/usb/gadget/legacy/raw_gadget.c > > @@ -667,8 +667,6 @@ static void *raw_alloc_io_data(struct usb_raw_ep_io *io, void __user *ptr, > > return ERR_PTR(-EINVAL); > > if (!usb_raw_io_flags_valid(io->flags)) > > return ERR_PTR(-EINVAL); > > - if (io->length > PAGE_SIZE) > > - return ERR_PTR(-EINVAL); > > if (get_from_user) > > data = memdup_user(ptr + sizeof(*io), io->length); > > else { > > -- > > 2.43.0 > > > > Hi Greg, > > Could you pick up this patch? > > Thank you! (Greg to To:) ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] usb: raw-gadget: do not limit transfer length 2025-10-21 14:19 ` Andrey Konovalov @ 2025-10-21 16:06 ` Greg Kroah-Hartman 2025-10-21 22:26 ` Andrey Konovalov 0 siblings, 1 reply; 6+ messages in thread From: Greg Kroah-Hartman @ 2025-10-21 16:06 UTC (permalink / raw) To: Andrey Konovalov Cc: Alan Stern, linux-usb, linux-kernel, stable, andrey.konovalov On Tue, Oct 21, 2025 at 04:19:13PM +0200, Andrey Konovalov wrote: > On Tue, Oct 21, 2025 at 4:18 PM Andrey Konovalov <andreyknvl@gmail.com> wrote: > > > > On Thu, Sep 4, 2025 at 10:08 PM <andrey.konovalov@linux.dev> wrote: > > > > > > From: Andrey Konovalov <andreyknvl@gmail.com> > > > > > > Drop the check on the maximum transfer length in Raw Gadget for both > > > control and non-control transfers. > > > > > > Limiting the transfer length causes a problem with emulating USB devices > > > whose full configuration descriptor exceeds PAGE_SIZE in length. > > > > > > Overall, there does not appear to be any reason to enforce any kind of > > > transfer length limit on the Raw Gadget side for either control or > > > non-control transfers, so let's just drop the related check. > > > > > > Cc: stable@vger.kernel.org > > > Fixes: f2c2e717642c ("usb: gadget: add raw-gadget interface") > > > Signed-off-by: Andrey Konovalov <andreyknvl@gmail.com> > > > --- > > > drivers/usb/gadget/legacy/raw_gadget.c | 2 -- > > > 1 file changed, 2 deletions(-) > > > > > > diff --git a/drivers/usb/gadget/legacy/raw_gadget.c b/drivers/usb/gadget/legacy/raw_gadget.c > > > index 20165e1582d9..b71680c58de6 100644 > > > --- a/drivers/usb/gadget/legacy/raw_gadget.c > > > +++ b/drivers/usb/gadget/legacy/raw_gadget.c > > > @@ -667,8 +667,6 @@ static void *raw_alloc_io_data(struct usb_raw_ep_io *io, void __user *ptr, > > > return ERR_PTR(-EINVAL); > > > if (!usb_raw_io_flags_valid(io->flags)) > > > return ERR_PTR(-EINVAL); > > > - if (io->length > PAGE_SIZE) > > > - return ERR_PTR(-EINVAL); > > > if (get_from_user) > > > data = memdup_user(ptr + sizeof(*io), io->length); > > > else { > > > -- > > > 2.43.0 > > > > > > > Hi Greg, > > > > Could you pick up this patch? > > > > Thank you! > > (Greg to To:) Can you send it to the proper list again? I didn't see it on the linux-usb list as it was never sent there :( thanks, greg k-h ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] usb: raw-gadget: do not limit transfer length 2025-10-21 16:06 ` Greg Kroah-Hartman @ 2025-10-21 22:26 ` Andrey Konovalov 0 siblings, 0 replies; 6+ messages in thread From: Andrey Konovalov @ 2025-10-21 22:26 UTC (permalink / raw) To: Greg Kroah-Hartman Cc: Alan Stern, linux-usb, linux-kernel, stable, andrey.konovalov On Tue, Oct 21, 2025 at 6:06 PM Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote: > > On Tue, Oct 21, 2025 at 04:19:13PM +0200, Andrey Konovalov wrote: > > On Tue, Oct 21, 2025 at 4:18 PM Andrey Konovalov <andreyknvl@gmail.com> wrote: > > > > > > On Thu, Sep 4, 2025 at 10:08 PM <andrey.konovalov@linux.dev> wrote: > > > > > > > > From: Andrey Konovalov <andreyknvl@gmail.com> > > > > > > > > Drop the check on the maximum transfer length in Raw Gadget for both > > > > control and non-control transfers. > > > > > > > > Limiting the transfer length causes a problem with emulating USB devices > > > > whose full configuration descriptor exceeds PAGE_SIZE in length. > > > > > > > > Overall, there does not appear to be any reason to enforce any kind of > > > > transfer length limit on the Raw Gadget side for either control or > > > > non-control transfers, so let's just drop the related check. > > > > > > > > Cc: stable@vger.kernel.org > > > > Fixes: f2c2e717642c ("usb: gadget: add raw-gadget interface") > > > > Signed-off-by: Andrey Konovalov <andreyknvl@gmail.com> > > > > --- > > > > drivers/usb/gadget/legacy/raw_gadget.c | 2 -- > > > > 1 file changed, 2 deletions(-) > > > > > > > > diff --git a/drivers/usb/gadget/legacy/raw_gadget.c b/drivers/usb/gadget/legacy/raw_gadget.c > > > > index 20165e1582d9..b71680c58de6 100644 > > > > --- a/drivers/usb/gadget/legacy/raw_gadget.c > > > > +++ b/drivers/usb/gadget/legacy/raw_gadget.c > > > > @@ -667,8 +667,6 @@ static void *raw_alloc_io_data(struct usb_raw_ep_io *io, void __user *ptr, > > > > return ERR_PTR(-EINVAL); > > > > if (!usb_raw_io_flags_valid(io->flags)) > > > > return ERR_PTR(-EINVAL); > > > > - if (io->length > PAGE_SIZE) > > > > - return ERR_PTR(-EINVAL); > > > > if (get_from_user) > > > > data = memdup_user(ptr + sizeof(*io), io->length); > > > > else { > > > > -- > > > > 2.43.0 > > > > > > > > > > Hi Greg, > > > > > > Could you pick up this patch? > > > > > > Thank you! > > > > (Greg to To:) > > Can you send it to the proper list again? I didn't see it on the > linux-usb list as it was never sent there :( Sure, done! ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-10-21 22:26 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-09-04 20:06 [PATCH] usb: raw-gadget: do not limit transfer length andrey.konovalov 2025-09-04 20:07 ` andrey.konovalov 2025-10-21 14:18 ` Andrey Konovalov 2025-10-21 14:19 ` Andrey Konovalov 2025-10-21 16:06 ` Greg Kroah-Hartman 2025-10-21 22:26 ` Andrey Konovalov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox