Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2049045ybe; Tue, 3 Sep 2019 07:17:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqx0fyjV+f5mbJiHaqDaRCza0UeI7PUTjG62ts/JaMCG7vYCqvP/jwcctYaUkV+wmz+ej4iX X-Received: by 2002:a62:4d41:: with SMTP id a62mr40710164pfb.155.1567520237517; Tue, 03 Sep 2019 07:17:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567520237; cv=none; d=google.com; s=arc-20160816; b=bPTJBfo5kAVPo/c6d9VJKGdChkfHDgMxy5j2Cabw/W1ueCK3rOfSgTXjbsji+9L/1j YgfQkS/otzNg5LXfqITpCKu9J0sB7vd1ASoQ4kTzvvnig+3myHcbpMGk3jYlzB8SWUqq 6BOAVo7qXxUUkPxt76ZqFSlxsMXfzKnMuNUjjQYCm3WHpOya2AQaDZ3RnMPBl9hEaCMj 3ljCvPrp7GKgqRkGnRlDo/N5zgEGNBNoO3/3oUvedYFK+kRfEJ6eBjA+vqOKz+fYUVEA QRcmqaNgZeh+n834+Hg+ILaWCTbaA9tGGvPkhciFs91n8suRIPpZGylcdFZ8rf3JXGMw VdmQ== 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=Aezg1jwSpDbrPRrzGU0fBIl2FHR5pckex0afl58LKt0=; b=ROnilSJne/riQZHV/25C1DOeqVuU1kKjQNeUPSeWs0C8FobltNRmyCQaqGTV0cC0zX OnBfxvvUfbDub70ptL8b0OWyWdS4RIZwAxQxqPiyOvxv+CHI5RawQs2z8P3txmJx1nnu dto9bY5bij5Iy3GumdQHJbXtNJVzG2WFOBtztp3xIVSA1a8hgdWBDw8ter3NaDxwz2Ab ZQ/OHotAWNa5nOZvNEkv12GuBc1OtzZkC3XsJLaST2hX6nMcp9m48GS0YSbl49cEjh7e +Yg1nXL3O1VSS/2liW8IeW6TgTL1IYDJR+KLjY+IbxuJG6ubZ65GB568YKMkpJo7iqVd /jhw== 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 b97si15123763plb.163.2019.09.03.07.17.01; Tue, 03 Sep 2019 07:17:17 -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 S1729527AbfICOOh (ORCPT + 99 others); Tue, 3 Sep 2019 10:14:37 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:60612 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1728490AbfICOOh (ORCPT ); Tue, 3 Sep 2019 10:14:37 -0400 Received: (qmail 2738 invoked by uid 2102); 3 Sep 2019 10:14:36 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 3 Sep 2019 10:14:36 -0400 Date: Tue, 3 Sep 2019 10:14:36 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Greg KH cc: Oliver Neukum , Julius Werner , USB Storage list , Dan Williams , Kernel development list , USB list Subject: Re: [PATCH] usb: storage: Add ums-cros-aoa driver In-Reply-To: <20190903091953.GA12325@kroah.com> 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, 3 Sep 2019, Greg KH wrote: > On Tue, Sep 03, 2019 at 10:46:14AM +0200, Oliver Neukum wrote: > > Am Montag, den 02.09.2019, 18:47 +0200 schrieb Greg KH: > > > > > > This should work just fine today. Add a new device id to the "new_id" > > > file and then tell the driver to bind. That's pretty much the same as a > > > "force_bind", right? > > > > That looks like a race condition by design to me. > > How? > > Anyway, this should all "just work" somehow, there's an old lwn.net > article I wrote about this over a decade ago when it was added. A > number of subsystems use this all the time (vfio?) and I haven't heard > any issues with it in a long time. No, this won't "just work". The problem is that when you write to the new_id file, usb_store_new_id() calls driver_attach(), which tries to bind the driver to any matching device. There _will_ be other matching devices, and trying to bind them will cause runtime errors. That isn't what we want. We want to bind the driver to a _specific_ device and no others, even if the others match the new id. Now, this is what writing to the sysfs "bind" file does -- except that it won't let you bind a driver to a device it doesn't match! So we have two problems: Bind a driver to a particular device, Even though the id's for the device don't match the driver. The kernel already contains solutions for each of these problems, but nothing that can handle both at once. Alan Stern