From: Greg KH <gregkh@linuxfoundation.org>
To: Eugeniu Rosca <erosca@de.adit-jv.com>
Cc: stable <stable@kernel.org>,
balbi@kernel.org, linux-usb@vger.kernel.org,
Ilja Van Sprundel <ivansprundel@ioactive.com>,
Brooke Basile <brookebasile@gmail.com>,
Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
Eugeniu Rosca <roscaeugeniu@gmail.com>
Subject: Re: [PATCH] USB: gadget: f_ncm: Fix NDP16 datagram validation
Date: Tue, 6 Oct 2020 22:18:25 +0200 [thread overview]
Message-ID: <20201006201825.GA188912@kroah.com> (raw)
In-Reply-To: <20201006182943.GA12648@lxhi-065.adit-jv.com>
On Tue, Oct 06, 2020 at 08:29:43PM +0200, Eugeniu Rosca wrote:
> Hello Greg,
> Hello stable maintainers,
>
> On Sun, Sep 20, 2020 at 06:01:58PM +0100, Bryan O'Donoghue wrote:
> > commit 2b74b0a04d3e ("USB: gadget: f_ncm: add bounds checks to ncm_unwrap_ntb()")
> > adds important bounds checking however it unfortunately also introduces a
> > bug with respect to section 3.3.1 of the NCM specification.
> >
> > wDatagramIndex[1] : "Byte index, in little endian, of the second datagram
> > described by this NDP16. If zero, then this marks the end of the sequence
> > of datagrams in this NDP16."
> >
> > wDatagramLength[1]: "Byte length, in little endian, of the second datagram
> > described by this NDP16. If zero, then this marks the end of the sequence
> > of datagrams in this NDP16."
> >
> > wDatagramIndex[1] and wDatagramLength[1] respectively then may be zero but
> > that does not mean we should throw away the data referenced by
> > wDatagramIndex[0] and wDatagramLength[0] as is currently the case.
> >
> > Breaking the loop on (index2 == 0 || dg_len2 == 0) should come at the end
> > as was previously the case and checks for index2 and dg_len2 should be
> > removed since zero is valid.
> >
> > I'm not sure how much testing the above patch received but for me right now
> > after enumeration ping doesn't work. Reverting the commit restores ping,
> > scp, etc.
> >
> > The extra validation associated with wDatagramIndex[0] and
> > wDatagramLength[0] appears to be valid so, this change removes the incorrect
> > restriction on wDatagramIndex[1] and wDatagramLength[1] restoring data
> > processing between host and device.
> >
> > Fixes: 2b74b0a04d3e ("USB: gadget: f_ncm: add bounds checks to ncm_unwrap_ntb()")
> > Cc: Ilja Van Sprundel <ivansprundel@ioactive.com>
> > Cc: Brooke Basile <brookebasile@gmail.com>
> > Cc: stable <stable@kernel.org>
> > Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> > ---
> > drivers/usb/gadget/function/f_ncm.c | 30 ++---------------------------
> > 1 file changed, 2 insertions(+), 28 deletions(-)
>
> This patch appears to be pushed to 4.19, 5.4 and 5.8 stable trees via:
>
> https://lore.kernel.org/lkml/20201005142108.771915994@linuxfoundation.org/
> https://lore.kernel.org/lkml/20201005142109.966570222@linuxfoundation.org/
> https://lore.kernel.org/lkml/20201005142114.960807335@linuxfoundation.org/
>
> Will you push this patch to v4.14.y, in order to fix v4.14.196 commit
> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=b88ad6e714284b
> ("USB: gadget: f_ncm: add bounds checks to ncm_unwrap_ntb()") ?
It also need to go to 4.9.y, and is already queued up in the stable
queues for those trees for the next round of kernels that are released
for them.
thanks,
greg k-h
next prev parent reply other threads:[~2020-10-06 20:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-20 17:01 [PATCH] USB: gadget: f_ncm: Fix NDP16 datagram validation Bryan O'Donoghue
2020-09-20 21:08 ` Brooke Basile
2020-09-24 15:22 ` Harald Seiler
2020-10-06 18:29 ` Eugeniu Rosca
2020-10-06 20:18 ` Greg KH [this message]
2020-10-07 10:24 ` Eugeniu Rosca
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=20201006201825.GA188912@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=balbi@kernel.org \
--cc=brookebasile@gmail.com \
--cc=bryan.odonoghue@linaro.org \
--cc=erosca@de.adit-jv.com \
--cc=ivansprundel@ioactive.com \
--cc=linux-usb@vger.kernel.org \
--cc=roscaeugeniu@gmail.com \
--cc=stable@kernel.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).