Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.222.169 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795949590; b=QuiQyTqavdEkt3uKfHYbhH6a3Zd8LV3YNmsNKvF/szI0vcMft3ONh/SunRNxyYxMrdDO 62RqYU3/OLCmJdrjy28GeueWJUtIlyxqLEqfMuDhyGHbWLAvt+EExfIiPjeOnE8XgTnph HYStqeKsUWV6AykGDs8ENL3otP/cf8cL2DT4C/le+h8oAqTamTUXnwy7k6ffSxw5VciNd bshAFWs6/l+f8ODMBYUhepQGmjo0lfvoGnn2lXyBc+JgY12kbB2Z+Fh82xSkTuyRhbukt cAzdgYfn1wmsTMjv/5YBKM5ul9wlwn/HwtV0qm9Oa/+ZPHsBbkyhBwYJNzdimykNPMw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795949590; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=BPaDnrShvYCbOQgGZg4B+0xFJM3ozVtRsquJ9sKNmGU=; b=eyx9wQffh6oM4acdrzhku94DrRm4FPZ+D2Yyduj6sSOUYDQjBJBGOtk7sFSDzoWeRBJO Zt7TYsyqyA8cHSj3GxHbUsp1/J+gebzyYG0zQLtW82Y7NBp7Rox9Zwr6OZGd8i5ZwFr5T 3Sh9Ped7xb7mUNPPEunyAAZzgdqktnX85kgpGFWPhq+02SIYXW7rsesf5x75W3ZOELz9m A4GQFSx2LOKc+amJxX3SeHg+sWH1bFGpo5c3lpBHqkxNj9Mg3JTSt31nAyalIcMRkXQ5N vz7RNN5maGY6VYBCWo966d1B4JjgUmp5kGbHMpVpINp22hhuYKndmXA3AwokE6OmXjA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=TGHSrbOY; arc=none smtp.remote-ip=209.85.222.169 Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A37AC606A323 for ; Sun, 29 Nov 2026 10:53:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A37AC606A323 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.a=rsa-sha256 header.s=20260707 header.b=TGHSrbOY Received: by mail-qk1-f169.google.com with SMTP id af79cd13be357-9496317b730so1108652885a.1 for ; Sun, 29 Nov 2026 02:53:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795949588; x=1796554388; darn=vger.kernel.org; h=mime-version:content-transfer-encoding:content-type:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to :content-type; bh=BPaDnrShvYCbOQgGZg4B+0xFJM3ozVtRsquJ9sKNmGU=; b=TGHSrbOYYp7Mi6pJy38Qq5PpOFlqWKMFOfftQydhRaP5P5hXZ6NqOiHCUZqYi7Ed/N inJRPgFVgjGONnfFtQE9fw4MFnC8vIXbF2WdiinuHbzMKNZmZ/LSZULruT3P1B/LprSj xcftGKYMK9to6YEJstj8Njih77Hoowjs6vJFUDP168yiEt/F7fu4tdVCNTBQNoFT+qLh 5rLrYkLjZrq3ZyzM6Lt9Ru2z5yoebxh/X9WmrqyjdXwEAqETGoExML4b0oYgFQhEc8Q6 9inzss1mWdehQwPpzWrMV63Ev329GMPP/T5NZWelM31SbUiCdF4o+kX9n6P+m3HOa8UX CNlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795949588; x=1796554388; h=mime-version:content-transfer-encoding:content-type: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=BPaDnrShvYCbOQgGZg4B+0xFJM3ozVtRsquJ9sKNmGU=; b=uHj8hKUif1Y36XRPoF9yO+Cy21B6Pnd3E7yYzmHgg+VxV7tPzyvJDzNV6u+n6EfaEa 3UFb0n881BYbuaZIsZISqqA7cgAUIre9FNTV6s2iFdmCEHV+RwLz2YF48LslmSnxNw+X AgCuFkEpyFZtkvnl1n0Oh5JXOQNNBC+O0rrvks7zNWbsVbjX82h8JWvpBXWAFkOuO75c w99l0YeYWYKxSa4MEcX+QAevubdbpygxZ9yR6WkjAv8YSIWFUZbMJeHg4Mlo+tL25C39 tRPAjR2BkrW4Z8qTMFitmJlWxWN6SNy1HccM+6FZ3Jmr/0ScX/5dugyTlbXmDaBjPHJd FZjA== X-Forwarded-Encrypted: i=1; AL+hErEmkdPFilP4AjoRno3sx14zdp9TeedjkpziAwUpc8SpbFOSo1aky7RxE8+e1kCltuU94uDY9CVOl2aPGhmD@vger.kernel.org X-Gm-Message-State: APuU4Z8phNe1mGcTUs/W5n3rfyIRRyYsofPwsHVCO1UH98ZTJH/g+nEA MOFXkg8e7ckeVbcqBN8sitYMOuJqjuHyVyjgV4ksNuXDDIphsZ2jD0Pobl2SdPnZa5igwQ== X-Gm-Gg: AZFdTZfv7aq7xyU8+qH1AySp4MH+zCTG6BXxrxyhXztpxGmWLUaNyky/ST4yPvtvLne Bwy8OpKTrDLzAesJ/xKi4akgrdnl0Oin4Ks2PAtc7Qh1L5VmFLcO21x+ZsVymB/XSkfAurwCiG4 bniOODjWY1xrUnx6jmgMpNyW9racty7H/uQMILiwaBzndD7YKffMd4O18H1jxO7YVVj61KnF1Cr bYtczsXvAy39LSar05FGWWUNPHxwv05mQLSMFyQzdOOxzYzf4cwARF2cuKS3ryzO4WFtX3G/aqL z44SxHmcZyZid/6fmcJawfMP0wUe1IrJ0hWozPlkDEAm8W+8TiAE0fj5c7Vr5A0I88G4Sd48Cwk B2Mo1HGc6KKsr+vnUXOhYz5bi1b+Dneg9QQwfYXc0C6VWCTEPfB/I4SEsq+H97C0lYHu6VR3hY7 6ny13wF0YhXOvLO9ik2NOFpGlrm4hrfBvuWGbFWcBHgnnJqIw8BLmiuAy+k+sIZU4BdRgqH0Cg6 yap/AGEqt33cF7XljlRnp5t487gTb2Ye0c8fKYMFdlWHqoi7YzHngy4+PHYR1BYi+7XFoP0cr7L S2FKaeKm4bctBwADtAHtINWVw/+I1avuBU6mDpA2UYkUlAzbJLbCWvLIV3LFANgH3BtMVbVB8Ks nPw4ZhPQ7E2QFuKyyACyzs3d9Nx/858igUo/6LbkvPuAA9MJ22b4= X-Received: by 2002:a05:620a:4485:b0:949:710e:2ccc with SMTP id af79cd13be357-949bab5beacmr4892071585a.77.1795949588543; Sun, 29 Nov 2026 02:53:08 -0800 (PST) Received: from zeppelin-x.local (dhcp-9-244-177-183.gobrightspeed.net. [9.244.177.183]) by smtp.gmail.com with ESMTPSA id af79cd13be357-949bb41a341sm2279831685a.37.2026.11.29.02.53.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2026 02:53:07 -0800 (PST) From: Felipe Infante de Castro To: Thinh Nguyen , Greg Kroah-Hartman Cc: Bjorn Andersson , Konrad Dybcio , linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [NOTE] usb: dwc3: qcom: .shutdown = dwc3_qcom_remove double-remove hazard on guest unbind during shutdown Date: Sun, 29 Nov 2026 05:53:07 -0500 Message-ID: <179594958702.39790.7164177942155143370@gmail.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Hi Thinh, Greg, Bjorn, and Konrad, While bringing up an out-of-tree USB4 host router driver on a Snapdragon X Elite laptop (Linux v7.3.6 arm64), we hit a reproducible (3/3) PID 1 kernel panic on reboot with a USB4 dock attached. Scope note upfront: nothing in mainline Linux triggers this today. It requires a second driver that unbinds a bound dwc3-qcom device during system shutdown (which our USB4 host router driver initially did when tearing down its guest USB3 session). We have already fixed our USB4 driver to skip device_release_driver() during shutdown, so this is purely a hardening note for dwc3-qcom in case it is useful upstream. What happened: 1. dwc3-qcom wires .shutdown = dwc3_qcom_remove. 2. When dwc3-qcom is re-bound as a guest after the USB4 router starts, it sits later on devices_kset, so device_shutdown() invokes dwc3_qcom_remove() on it *before* the USB4 router's .shutdown(). 3. dwc3_qcom_remove() tears down dwc3_qcom and clears dev_set_drvdata(dev, NULL), while leaving dev->driver bound (normal for Linux ->shutdown()). 4. When the USB4 router's .shutdown() then called device_release_driver() on the guest dwc3-qcom device, driver core saw dev->driver still set and called dwc3_qcom_remove() a second time with NULL drvdata, faulting at fffffffffffffff0 (-0x10) in PID 1: Unable to handle kernel paging request at virtual address fffffffffffffff0 pc : dwc3_qcom_remove+0x28/0x168 [dwc3_qcom] ... device_shutdown / kernel_restart Kernel panic - not syncing: Attempted to kill init! Hardening thought: Guarding dwc3_qcom_remove() with `if (!qcom) return;` (or using a dedicated idempotent .shutdown callback) would make dwc3-qcom safe against any future driver-core or parent-triggered teardown running after ->shutdown(). Details: https://github.com/fidecastro/surface-laptop-7-15in-facts/blob/main/upstream-reports/dwc3-qcom-shutdown.md Best regards, Felipe Infante de Castro Signed-off-by: Felipe Infante de Castro