Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4077812imm; Tue, 25 Sep 2018 10:56:26 -0700 (PDT) X-Google-Smtp-Source: ACcGV632t9N+Z0KifDfK4VvtIJ92xL4IeFhoBGRJXfTMrPocIusNl3wUw9vFm9BeZGUaKQSlt2ke X-Received: by 2002:a17:902:6bc1:: with SMTP id m1-v6mr201228plt.148.1537898186482; Tue, 25 Sep 2018 10:56:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537898186; cv=none; d=google.com; s=arc-20160816; b=r48opMavoLsyXvoIW1tZ+fTOJKLS+ART3kZ2s+TTsRFi6CN/qGUQSbvNxNbr3t1w/p 7Nwx8vyevyLoNRg++5WksL8424a/Xbzg+8ELGLaK7gDR/eGC1pq80dMzFN7Y+1FAMkZv GcCpNZL58LiZopm63yXgdZnABkbs+Ssf68Kdz84CenyyF0jSkNniPORPrg5WSr9/VaR0 kX907BOZ+EoJBlQXIHFb26wVyAHUIHp8XvHJcdkHdsUx8tDBqUhoWM/QCbow1OifeAwq Y5IRWIgd1QYiHEnIAPlTlWda19JdF/P/hRvi2KV/C/0XYdBlhD8P/KemCwhmvGY5TfhE UpVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=0MJL440roibSmPk6skeWkgO8MZHou4br1WmNh0NgwMY=; b=yplbswHQrHCBpCguGuyU3rW4F4PAq6dNFSkRIO3SN7nQFvtKugAvukB2YXtdoBx2Mj P2wQ6Ng2wRxEcfZiGHvFKJezZRZ5fMu2AZYV8ex8XKgEFkV9JwZdo97u51AB/dPgvRss TRq6zO0mBPWVTrnSqSZZx1+qW+2LDGz5CNi2BFkeRXCYklICc5Jj9XUAkvxPkZujcxWU 1983L104VReek4Eq9G76s2dV2YeHa2pmm8Fvlw30W/bHKNztnyrcZN8hCjIXyoniHeNA XNBetQQMpmRzCgZlfOPm4PGFg3495MkqEHFRPVGNxbJdulC39dEox4nTlrwqdwD5Tq5z EBtA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v13-v6si2812810pgi.92.2018.09.25.10.56.10; Tue, 25 Sep 2018 10:56:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727171AbeIZADR (ORCPT + 99 others); Tue, 25 Sep 2018 20:03:17 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:40072 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726304AbeIZADR (ORCPT ); Tue, 25 Sep 2018 20:03:17 -0400 Received: (qmail 6816 invoked by uid 2102); 25 Sep 2018 13:54:38 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 25 Sep 2018 13:54:38 -0400 Date: Tue, 25 Sep 2018 13:54:38 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Andrey Konovalov cc: Vladis Dronov , Greg Kroah-Hartman , Oliver Neukum , Hans de Goede , syzkaller , USB list , LKML , stable Subject: Re: [PATCH] usb: usbfs: fix crash in check_ctrlrecip()->usb_find_alt_setting() In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 25 Sep 2018, Andrey Konovalov wrote: > On Tue, Sep 25, 2018 at 5:15 PM, Alan Stern 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