From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17EB0C433E4 for ; Fri, 24 Jul 2020 17:08:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E7F9E206F6 for ; Fri, 24 Jul 2020 17:08:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726783AbgGXRIP (ORCPT ); Fri, 24 Jul 2020 13:08:15 -0400 Received: from netrider.rowland.org ([192.131.102.5]:33167 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726782AbgGXRIP (ORCPT ); Fri, 24 Jul 2020 13:08:15 -0400 Received: (qmail 1396181 invoked by uid 1000); 24 Jul 2020 13:08:14 -0400 Date: Fri, 24 Jul 2020 13:08:14 -0400 From: Alan Stern To: Bastien Nocera Cc: Andy Shevchenko , USB , Greg Kroah-Hartman Subject: Re: [PATCH v4] USB: Fix device driver race Message-ID: <20200724170814.GA1395815@rowland.harvard.edu> References: <20200724152707.GB1388675@rowland.harvard.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On Fri, Jul 24, 2020 at 06:52:31PM +0200, Bastien Nocera wrote: > On Fri, 2020-07-24 at 11:27 -0400, Alan Stern wrote: > > > > + if (new_udriver->match || new_udriver->id_table) > > > > > > But match check is incorporated in the loop function. > > > > Agreed, this test is redundant. However, we should test that > > new_udriver != &usb_generic_driver. > > Do you really want to loop over every USB device when you know for a > fact that not a single one will match? Think of it the other way around: How often will anybody load a specialized USB device driver that doesn't have a match function or ID table? It wouldn't match any devices! > I guess it's unlikely, the generic driver would be loaded before any > device, Since it's built into usbcore, I guess that's true. > and the specialised drivers need to be able to selected, so > I've done that locally. Okay, you're ready to submit the next version? Alan Stern