From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.222.178 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795949590; b=gZWOg5l7iBvepqFcIqA49YC4dvJ1eG16vQhkxi93DkTDWEkAupz49qNazi5WskMN0lkh nZaAPUZCTun5fvQAgAwNKcXR8AISBjGwim+29G+7hztDJVaTPUr9fw88TnhrMsF7W6+Ah GhMCJwd4NJvgAMOLUBXJXKjp40CPKjxIzhRw3BQ6KYle34zTPq+BQpB6SAi6AMSeydKj2 7KFC8CYoEjg2V3KwhfhJzOaLrTvtPPBVXd3PW0fraH4WIq4H4G7/Tb/MLWn3N0boHRvLk gtOJ9/+YwjDUsAyHfrY+5vkcZYdVPZxeRW/BAxRMtqTE+Ho8b9IsuHEpmxjq2j1PlxA== 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=HHUOkoCd1u2ycJRvRZQbeIvjb6so+1M4M7d10KS3izGeaQDtUL5uJDQWngZes95XdGnK jTLcV2mIUuXz8YvCpKfEY24GJRY6WwvketncISeGL/Sv+fa3CpMXesyzbVLDSo0WHSEbl mDNkhtl/rHxo+x5KmwsC1zs3ivd1ZiXW3d9wzCdMZfDayKX6vduwkm0/3dXcmQ+EjOW5D NeDsU3wNzDzF9XVfRcg6gzTIoEF3g/sc5n33Sb5PDSZn8O6shLghbV7XmhxEhU8VVDKxX HhD7jDQzPMcpVJRE3SM+yMZmvWk7ek/OrVkkJOS2fFuVjUTXu2X601d6OHwIP0AI7BA== 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.178 Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (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 9D3EA606A31C for ; Sun, 29 Nov 2026 10:53:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9D3EA606A31C 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-f178.google.com with SMTP id af79cd13be357-93f269e335eso1112989785a.3 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=XA+6Rz1b7dncIgFj8mwOnXroOu/9aXWWHlnyRrl18D7gIQUFg5zWq+gTVDsdIDti2y UglahauA61tqa1+PPdWAnLm9AWVW5v02oBqu9sqdRTOhp71/nFkXP6shheXkVmigQWkH 4DYfB2lI90RUTWO2RPEOsAN7YlsFMJjn0YYuW2m1ZA2W6nCAq+g3VDEpFRhIUBYpqhqJ 8VaeQ7NSiGvhuz3IlpuqU0X51BzWDI27ob86mUkxo2DXzINVAiLL9PVkzT8TxCK6iEqv ofnn67vE8qHbQQ85U1gTStbSifq6906rm9Ottuz8xtLnWmB/xwOg+noCmV1kHeY7BlgW rbmw== X-Forwarded-Encrypted: i=1; AL+hErFrhnti4e446smGeZL6lSJ0XXpN42RB2kiuGZ06xx2jItAgAkPQh/1txoeiUqPd9uXp/F1TdIAh10A=@vger.kernel.org X-Gm-Message-State: APuU4Z8eJuoWFFOUKD8NDy37fId9ZMBGd5SwdFeHfkw+Nwu+QqZ5Csrv V7+dH+MTU2ca1Eg6Zhl1qfoVt0k6y5JWbCIP/KtP5q9vjZSrRzPBZeCX X-Gm-Gg: AZFdTZefyJAySnWWsoU0GOGy/iPcbZx7U5/m4Kl9oOFlaExdcAg7EzJ/SM8FTCl+Sw0 nC474Lf/aKYeL74JEIZFIyWVssHJPYSTCcWVyygSv4HR4PUjwtTWo/Jz7tWhNLdeRkiOR/gnKBU fDvQQWAaabtt4h7GRDT6rbSuIFCQouNx6HR7iO4YMyRQ+aXdrf40V0y+Y0cWUVLZdzhoFBJ5ofL 2prGGDzceGej+hOeF2Wr4QBCTvESd1WU/CBMgwNaRLjUsmnryxyeMolEIAcm2/Pb0zPV2M3WdmN D4g3WIERwLSRnRhPJlBOriOch1X0nxz+CaAXziv+tyGUk8zJ/NV2hkJRW9yJyH6CxksJWsyiOOz TZLb/7lkB3BwMJHKmmE7oD2HqLRDs4f3IcFtSi36yAjgBUzOPZ6MQiwgVcpo4JdBXQNE9DgWQTU ZFLMKZfoPS09XPscdxWjqdtTWfjPv3TlbQFvJGni5h8MIzJaddIlZUoPaJKb/jub5awkNwIFcR4 a1l389mimn3SBEMuTFJ2UmSbhfnpSZhf1lcbuq4l58qXW/ZY8QrBonymozzs4OIhWnezDmYbXol VqwwFhUkmg7Y7h7CqfW0ge6ngF4VPfDOB/7hyCJcG4XjdYN1u+QWUi8/S17xif6nd1yE7oqNtV2 P9v2tHezj/QMBlvyZ1iaTdzq7Jz2bR1TCOj4r47YDTY6fXf3E4tI= 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-usb@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