From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B61993793CE for ; Sat, 10 Oct 2026 07:00:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791615659; cv=none; b=lbH58LXce1838oMvGERWLliKUW9/4x+nGb7QX9qEwydAyWAeZUmhVRbwTwFc+7FQJlSe7VYsUUn4+D/vBREWPC6u2e2bNesmAEq3RJPhzdqLWkvw72n2VCpuec1IdGB8fMpHcL5ptk8CiX72peMV52ZHDd1SkClT2wRHYW6Jp5k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791615659; c=relaxed/simple; bh=F/o+CB+c764IJjLKKJ/Vq/hAsz/74K7FVfCJHTirPPI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=I6ibJ12poWMfOb5mqn47cVn19EyvQWc6tBhOw9WGoWrx5So85fOJByx7rqTT7wPQwFokaDQiZcxyZleNOKvdPSPbQAJbiV9SWS4hFN66PjhNSLwZpmzQY5HRAMWLqjp13L21F+8SonbUb10gMGYyhnYppks64p+0XOb9vnku55I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cD+zYDZs; arc=none smtp.client-ip=209.85.219.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cD+zYDZs" Received: by mail-qv1-f54.google.com with SMTP id 6a1803df08f44-9178aabd30dso5457476d6.1 for ; Sat, 10 Oct 2026 00:00:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1791615657; x=1792220457; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=rBFXJ6vukRDHY7fGAWooctn5jSYzAGKP6c4NuLaCWJM=; b=cD+zYDZsEqV+yqW6aJGFK5e8H2qGSBuLbnPZAizUChJpB7jSWV9hWQNr6dsDOTWh62 jkJ9wnlkW2jfnAJo4zipaHKD7NBhVHB/j1JgM/lHnfOG30LmDJubhQUA7QQLwu5sRfg3 tmbfnnZ2RB77HkFmqCUqLrEHSnenORv4PRR/8pgfcLID1Tzo+iJNTJGwDxP1iaj8cGFB V0SsnYgNwp9MDh6OHMEl7SJ3+fnvwEe+iljH8E9Kh/yVU/RGUFOmoF0D4PCICbjYQPvk 5EcIiDf972lOiIdmH0FpSby3tbIwDILlQKFUMm1m9wqZzhBqvBiH3WjuvKdPCfpHasHU Mv1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791615657; x=1792220457; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=rBFXJ6vukRDHY7fGAWooctn5jSYzAGKP6c4NuLaCWJM=; b=Tq/OskKwlObXkkORRIpuCSD2+kpv0JklAvNtnP7bV0+rDUfLpUCfWKBqglBUUb4AX9 QIIiqHHEl5Mid428QQVYRxQroZ8Gf6olcSmHbhfE++0m1QW6tLEk2ZBYeALZ819M61q4 gtfsosuVGQLnGUad3QdwSeI1fawXewDMfnw0nJyJBin/hhjuUBFoB/ReBdGS9dXs+sx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x37vcflVzd+Wu59L+DaYAu6GFVpDFUgtgFOSxK2QFw+QfShie5MtlXFnC5h4iCn 7Zy3TMt8k7LJSbji5dZIPAG09uwBl0 X-Received: by 2002:ad4:5aee:0:b0:917:9ce0:b6d6 with SMTP id 6a1803df08f44-91b557bf438mr70044036d6.42.1791615657428; Sat, 10 Oct 2026 00:00:57 -0700 (PDT) Received: from node0.quickhttpnode15.cloudfaas-pg0.wisc.cloudlab.us ([128.105.144.50]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-91b55082d87sm38108606d6.29.2026.10.10.00.00.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Oct 2026 00:00:55 -0700 (PDT) From: mosafer X-Google-Original-From: mosafer To: stern@rowland.harvard.edu Cc: dakr@kernel.org, driver-core@lists.linux.dev, gregkh@linuxfoundation.org, khiemtranzo532001@gmail.com, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, mohsafer@gmail.com, rafael@kernel.org, stable@vger.kernel.org, syzbot+863936f50214e843ae0c@syzkaller.appspotmail.com Subject: Re: [PATCH v2] driver core: complete deferred binds when drivers_autoprobe is off Date: Sat, 10 Oct 2026 02:00:39 -0500 Message-Id: <20261010070039.288392-1-mosafer@node0.quickhttpnode15.cloudfaas-pg0.wisc.cloudlab.us> X-Mailer: git-send-email 2.34.1 In-Reply-To: <0cc7fb74-aa32-427e-a931-dcbac7ffdcf9@rowland.harvard.edu> References: <0cc7fb74-aa32-427e-a931-dcbac7ffdcf9@rowland.harvard.edu> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Fri, Oct 09, 2026 at 09:49:49PM -0400, Alan Stern wrote: > IMO, we do not want the system to limp along forever with the device in > this "half-bound" state. Claiming an interface should cause the driver > core to create a real binding at some point in the near future. > > This should happen even without automatic probing. For example, if both > interfaces are unbound and the user writes one of them to the driver's > "bind" sysfs attribute, both interfaces should end up bound to the > driver after only a short delay. Agreed --- that invariant is exactly what this patch restores. drivers_autoprobe is meant to suppress automatic *matching* against the bus's driver list; it should not cancel a bind that a driver already initiated by claiming the interface. With the patch, usb_driver_claim_interface()'s promise ("let the future device_add() bind it") is kept at device_add() time regardless of the knob: the deferred bind completes through device_bind_driver() under the device lock, so the interface ends up really bound, not half-bound. To your example: when the claimed interface is already registered, usb_driver_claim_interface() binds it immediately --- it checks device_is_registered() and calls device_bind_driver() inline --- so the manual "bind" attribute case works today and is unaffected by this patch. The one case where the invariant was broken, and the case the patch fixes, is a claim made while the sibling interface is not yet registered and the autoprobe knob happens to be off at its device_add(): the core silently dropped the promised completion, and the interface stayed registered with dev->driver set but never bound. That state is beyond repair from userspace too: writing the interface to the driver's "bind" attribute cannot complete it --- with dev->driver pre-assigned, __driver_probe_device() returns -EBUSY (or the attribute path rejects the device if it does not match the driver's id table), so interface teardown was the only way out --- and it oopsed. The patch keeps the knob's meaning for devices with no claiming driver: bus-wide matching is still skipped when autoprobe is off (the check now sits inside __device_attach(), evaluated under the device lock, per the review-bot finding on v1). On the reproducer that means the previously-crashing window now ends with a completed bind instead of an oops, while matching stays suppressed for all the other devices registered while the knob is off. If you would rather the same invariant be implemented with a different mechanism, say the word and I will respin. Thanks for taking a look, Mohammad Mosafer