From: Alan Stern <stern@rowland.harvard.edu>
To: Andrey Konovalov <andreyknvl@google.com>
Cc: Vladis Dronov <vdronov@redhat.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Oliver Neukum <oneukum@suse.com>,
Hans de Goede <hdegoede@redhat.com>,
syzkaller <syzkaller@googlegroups.com>,
USB list <linux-usb@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
stable <stable@vger.kernel.org>
Subject: Re: [PATCH] usb: usbfs: fix crash in check_ctrlrecip()->usb_find_alt_setting()
Date: Tue, 25 Sep 2018 13:54:38 -0400 (EDT) [thread overview]
Message-ID: <Pine.LNX.4.44L0.1809251352540.1517-100000@iolanthe.rowland.org> (raw)
In-Reply-To: <CAAeHK+weYa=d=dSgCJ0o6dZBAxBakeAy2hodHhuPSeTr3iesuA@mail.gmail.com>
On Tue, 25 Sep 2018, Andrey Konovalov wrote:
> On Tue, Sep 25, 2018 at 5:15 PM, Alan Stern <stern@rowland.harvard.edu> wrote:
> > On Tue, 25 Sep 2018, Vladis Dronov wrote:
> >
> >> > What reason is there for having two different fixes for the same bug?
> >> > This one isn't going to get into any mainline trees that don't already
> >> > have c9a4cb204e9e.
> >>
> >> I believe this is the right thing to do, so usb_find_alt_setting()
> >> is not called with a known-bad argument.
> >>
> >> Honestly, I would change "if (!config)" in usb_find_alt_setting() to
> >> "BUG_ON(!config)" so we know when its callers do smth wrong and go
> >
> > (You'll be lucky if Linus doesn't see that. He yells at anybody who
> > suggests adding BUG_ON for anything that doesn't completely crash the
> > kernel. The basic problem is that "BUG_ON" is not a good name: That
> > routine doesn't really report bugs; instead it brings everything to a
> > halt in situations where the kernel is unable to proceed. In practice
> > this tends to make actual debugging more difficult.)
>
> What about adding a WARN_ON()? It doesn't crash the kernel and it will
> be detected and reported by syzbot.
Sure, we could do that. But would be the point? After c9a4cb204e9e,
calling usb_find_alt_setting() with a NULL config is no more of a bug
than calling kfree() with a NULL pointer. You wouldn't want to put a
WARN_ON in kfree(), would you?
Alan Stern
next prev parent reply other threads:[~2018-09-25 17:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-25 12:22 [PATCH] usb: usbfs: fix crash in check_ctrlrecip()->usb_find_alt_setting() Vladis Dronov
2018-09-25 14:14 ` Alan Stern
2018-09-25 14:55 ` Vladis Dronov
2018-09-25 15:15 ` Alan Stern
2018-09-25 15:17 ` Andrey Konovalov
2018-09-25 17:54 ` Alan Stern [this message]
2018-09-25 18:55 ` Vladis Dronov
2018-09-25 20:44 ` Alan Stern
2018-09-26 8:22 ` Vladis Dronov
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=Pine.LNX.4.44L0.1809251352540.1517-100000@iolanthe.rowland.org \
--to=stern@rowland.harvard.edu \
--cc=andreyknvl@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=oneukum@suse.com \
--cc=stable@vger.kernel.org \
--cc=syzkaller@googlegroups.com \
--cc=vdronov@redhat.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;
as well as URLs for NNTP newsgroup(s).