From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 BE9F736B906 for ; Wed, 12 Aug 2026 02:41:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786502469; cv=none; b=fJ3XJzr6mpD5amYL6+Y4InhW+NOTsKHdEDm2QvacTHkc2CYTQ5ql7npEKIB7I3+9bgLxEC5pyEILuJQII7V1V411UFDaiMwu+3USsZB/DXNSvCfr3jLtN7B+jC7L4U9GeDntlI709UwFmEyePFUQJuhDoPAKwl6NmlMNpUANEEs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786502469; c=relaxed/simple; bh=37VMdUxytPiKD/RJADwOCf4HSW0rsdJG6Rkc8HMGe9s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Yoo5krHI0Ud4AnigLtR1bs5p5HTvL98oIJUoJAm2Bn/yQi1NwRyjW8uHnpOqvxGQELRTqa/aDVKq6pzVkDMssRL6uXbJjtkeNShU17GDqJ4oP3wtkxDRosvGvCYjLv2J1mZYis/MlBkpOKg5tlj3tIDOYgU9QwYTGOwkn6D6poo= 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=djNivMvo; arc=none smtp.client-ip=209.85.214.170 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="djNivMvo" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-2d004f135b1so8327665ad.3 for ; Tue, 11 Aug 2026 19:41:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786502467; x=1787107267; 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=Lanv+kqXaRyeIzc5S81EnjUM67Ox70p+DZLgF1B6Q9o=; b=djNivMvoIRz1PA3xGL1A3TpN2QJdXpIxnOXUsxOMrvg6M/K08tMndxWxzzqu337p/E oCu78NY5w5nepRdNGbvP2PguLGeOYxb9ng24EpDlSOyPVb7JhFR/FgtMFw+TGqL9ApPL sRmEOCEqNzYE6/ur44Y9RakfbNWVjjEX4kM4tMfQLv+xLfC4gTcvtfOLrxTTYTFGu2Gb Dng8fGBzTlmJFl53JV4s4wex/DAwd9eJ/5ZC6Wj3Oi90QbK/dNIZ1tQL1rJRcQMOH+la yn+z2isdIBDir1NL2uCEhbrco6iyPbyiL0PeA4wm1EWYx703v/nDKRh1fE3CGhmEVs9o emCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786502467; x=1787107267; 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=Lanv+kqXaRyeIzc5S81EnjUM67Ox70p+DZLgF1B6Q9o=; b=R2M67XH7d48UjtVsCtdHX8b3VgckguNiW5ztEpdWoGv1vYg0OnJzdoqiSxaJLDeeNi 5P5tlcO4f1z45OY2AdAMPalnSExQ5ayIU/1GWw3OkRIj9LbuuG/dSoIkpgJ5EpBdl9EL hT5dVLdIJ4tILrjiRa+8a3nzg51pXNcZIryKJsuuOx2oFCOgYwxWN7a3m33qlOyTl2as t9iFrrrgy3M/tymbxny/OBCWIRkw8etjR2frvesIEPpSu3PuiiPN+4wSWag4O4y9z8uQ p865gcQEZME6N2/Pw2icKreXVffMcapPJDTKPlpZmBCw+VDod9/KN2h52dfqUlIrmgZn canw== X-Forwarded-Encrypted: i=1; AHgh+Rowxyl8pSNUTFlhJImrrzaHNoinFKzQQzPdMs3/+vnbTlFHlQXbJ0lbKqnlPcIX5ELM8387tNGQW3xO5fc=@vger.kernel.org X-Gm-Message-State: AOJu0YwDMmYZLBhe8IKUNmlyZXTXQ0MCx+btOSQHoF64w64b90cjdNyW zOLKleFP5BFAzCtaJnzSvE6grsQb25a+aFn0El79qWUIQKiagGzwlF30 X-Gm-Gg: AR+sD11C7GDfrdlbai7rff2r/dos0N/5nnZoWTbssmcFY3bLUZeOJgybuwgh/DnN3Gw Gdl7Hs6lBqfDCbmUUCmR5LQhqCiWNxPDKLj8xIVHFvmk3sJbaEuj/GbzVjmpDcHo2jQQn5BvDo0 BeaAz51GJjJkjVrmJq9B/WBfhH5zcn3KcRf4hM/3F9XiK4cio+ureC+XeOMztmSVSSxz6XGCWsc 3YltRI5gKTvsPtdjdXcTAG4bb9yWTNVOwg48dnO49FjFipBn9AM44LDst/9gcPk0mwAujmJ67p0 A2vqJ61OPhoVyOx0Z0rah7XoQk6zrByUhcwbi8RRg3SG5+ySRVRr/aC/sW7X39bLiudqk6Wjq3q QdV9fwUr6t5LrgKmn140+TSpAppWV8zsETR2BPhJuGVXq+o7vD0yRK3stf7ZXtaZGvwgQmnVOfU 0Amagepe5A2lCZBpRoErbqn2xkqVuMDdf3jphQsfdwOTlJQBTSqTiVXSFqdFzN7or3BGeBgWKba BI= X-Received: by 2002:a05:6a21:2982:b0:3c3:a41f:ce7d with SMTP id adf61e73a8af0-3cc3f1f5dd7mr1909572637.0.1786502466733; Tue, 11 Aug 2026 19:41:06 -0700 (PDT) Received: from Default ([2409:40f4:100e:be9a:465a:ee31:5561:2b2b]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1412448a38esm4632210c88.6.2026.08.11.19.41.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Aug 2026 19:41:06 -0700 (PDT) From: Jeffin Philip To: skhan@linuxfoundation.org Cc: gregkh@linuxfoundation.org, i@zenithal.me, jeffinphilip14@gmail.com, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, shuah@kernel.org, stable@vger.kernel.org, syzbot+af76b01c9a0f0ab60fb0@syzkaller.appspotmail.com, valentina.manea.m@gmail.com Subject: Re: [PATCH v3 0/2] usbip: usbip_host: remove legacy rebind_store in favor of drivers_probe Date: Wed, 12 Aug 2026 08:10:50 +0530 Message-ID: <20260812024050.11267-1-jeffinphilip14@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Tue, Aug 11 2026, at 16:53:23 -0600, Shuah Khan wrote: >On 8/11/26 10:05, Jeffin Philip wrote: >> do_rebind, which sleeps normally gets a mutex lock. However, it does not >> or should I say, cannot check for null udev between spin lock dropped in >> rebind_store and entering do_rebind. This is a potential race window >> already. So, even if we check for null udev under spinlock, we cannot do >> it outside. Regarding do_rebind, it is called during stub_device_rebind, >> but that function is called during module exit when all files are removed. >> So, do_rebind is not designed to work in a concurrent environment in the >> first place. >> >> We have a safer function that can already do what do_rebind does, >> drivers_probe. So, we use drivers_probe to rebind the device rather than >> use rebind_store. >> >> usbip tool references this function immediately after the device is unbound, >> which is safe for the tool itself but since we opted for drivers_probe, fix >> it by using drivers_probe rather than rebind_store after unbinding device >> which is more safer. >> >> Tested and working in both userspace via the tool and manually echoing >> the busid in the related nodes. rebind node is still left active with a >> warning to use drivers_probe upon encountering rebind_store. >> >> Thanks, >> Jeffin. >> >> Signed-off-by: Jeffin Philip >> --- >> Changes in v3: >> - Removed rebind_store in favor of drivers_probe to eliminate race >> condition > >How did you find this problem? I found the problem on syzbot and had to reproduce it using the following commands: link to issue: https://syzkaller.appspot.com/bug?extid=af76b01c9a0f0ab60fb0 echo 'add 1-1' > /sys/bus/usb/drivers/ubsip-host/match_busid echo '1-1' > /sys/bus/usb/drivers/usbip-host/rebind >Is this generated code or did you write it? No, I wrote the code myself. >Also, the first patch removes code in rebind_store(), replacing it >with a pr_warn()? The second patch points it driver_probe() - what >happens with just the first patch? It just prints out a warning. I did get a -Wunused function warning while building the kernel for testing and considered removing it. I ultimately didn't as scripts running on newer kernels(if this was merged) would break as there is no rebind node. Should I remove it? and is pr_warn not the right way to deal with this? If so, please advise. >Did you run tests to see if you can bind and unbind devices - does the >driver work correctly? Yes the tool works correctly after switching to drivers_probe. Devices are bound and unbound correctly. The function also caused an invalid opcode while testing in an unpatched kernel with a different sequence: write to match_busid, then write to bind and rebind, followed by writing to unbind. Thanks, Jeffin.