From: Greg KH <gregkh@linuxfoundation.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
Brooke Basile <brookebasile@gmail.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
USB <linux-usb@vger.kernel.org>,
Ilja Van Sprundel <ivansprundel@ioactive.com>,
Kees Cook <keescook@chromium.org>,
Felipe Balbi <balbi@kernel.org>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: Re: [GIT PULL] USB fixes for 5.9-rc3
Date: Wed, 26 Aug 2020 18:16:08 +0200 [thread overview]
Message-ID: <20200826161608.GA1684@kroah.com> (raw)
In-Reply-To: <CAHp75VepkugjZ4pvdNgxzT4T83ewL1AFtSZZtVq6aL+7=sqskA@mail.gmail.com>
On Wed, Aug 26, 2020 at 06:53:02PM +0300, Andy Shevchenko wrote:
> On Wed, Aug 26, 2020 at 6:36 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> > On Wed, Aug 26, 2020 at 05:02:38PM +0200, Marek Szyprowski wrote:
> > > On 26.08.2020 15:43, Greg KH wrote:
>
> > > > Brooke Basile (2):
> > > > USB: gadget: u_f: add overflow checks to VLA macros
> > >
> > > Sorry, but the above patch breaks USB Ethernet Gadget operation. It also
> > > didn't get the proper testing in linux-next (next-20200826 is the first
> > > one with this patch).
> > >
> > > This is how it explodes on Samsung Exynos (ARM 32bit) based board with
> > > g_ether module loaded:
>
> > Odd, for a "normal" descriptor, the logic should have remained the same
> > as without this patch.
>
> > Brooke, any ideas?
>
> I have an idea.
>
> Does below fix this?
>
>
> --
> With Best Regards,
> Andy Shevchenko
> diff --git a/drivers/usb/gadget/u_f.h b/drivers/usb/gadget/u_f.h
> index df4e1dcb357d..0b5c5f0dd073 100644
> --- a/drivers/usb/gadget/u_f.h
> +++ b/drivers/usb/gadget/u_f.h
> @@ -25,8 +25,8 @@
> size_t offset = 0; \
> if (groupname##__next != SIZE_MAX) { \
> size_t align_mask = __alignof__(type) - 1; \
> - size_t offset = (groupname##__next + align_mask) \
> - & ~align_mask; \
> + offset = (groupname##__next + align_mask) & \
> + ~align_mask; \
> size_t size = array_size(n, sizeof(type)); \
> if (check_add_overflow(offset, size, \
> &groupname##__next)) { \
> @@ -43,8 +43,8 @@
> size_t offset = 0; \
> if (groupname##__next != SIZE_MAX) { \
> size_t align_mask = __alignof__(type) - 1; \
> - size_t offset = (groupname##__next + align_mask) \
> - & ~align_mask; \
> + offset = (groupname##__next + align_mask) & \
> + ~align_mask; \
> if (check_add_overflow(offset, groupname##_##name##__sz,\
> &groupname##__next)) { \
> groupname##__next = SIZE_MAX; \
Oh wow, yeah, that should fix the problem, but would be good to get
confirmation...
thanks,
greg k-h
next prev parent reply other threads:[~2020-08-26 16:16 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20200826150239eucas1p24c59716cc31edfeb2eece84d97936b93@eucas1p2.samsung.com>
2020-08-26 13:43 ` [GIT PULL] USB fixes for 5.9-rc3 Greg KH
2020-08-26 15:02 ` Marek Szyprowski
2020-08-26 15:33 ` Greg KH
2020-08-26 15:53 ` Andy Shevchenko
2020-08-26 16:16 ` Greg KH [this message]
2020-08-26 16:17 ` Marek Szyprowski
2020-08-26 16:19 ` Andy Shevchenko
2020-08-26 17:20 ` Brooke Basile
2020-08-26 15:57 ` Kees Cook
2020-08-26 16:14 ` Andy Shevchenko
2020-08-27 7:51 ` Krzysztof Kozlowski
2020-08-26 17:18 ` Linus Torvalds
2020-08-26 19:13 ` Greg KH
2020-08-30 19:15 ` pr-tracker-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=20200826161608.GA1684@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=akpm@linux-foundation.org \
--cc=andy.shevchenko@gmail.com \
--cc=b.zolnierkie@samsung.com \
--cc=balbi@kernel.org \
--cc=brookebasile@gmail.com \
--cc=ivansprundel@ioactive.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=torvalds@linux-foundation.org \
/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;
as well as URLs for NNTP newsgroup(s).