From nobody Mon Sep 28 16:21:59 2026 Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) (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 5F4CE3B71A8 for ; Thu, 20 Aug 2026 07:45:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787211945; cv=none; b=JfhgFSHB2xTTxit2fCGjbK75mg3tAWszrN87iqDIHSI02YvMX5GShcBPO7skEiZz/1oBygbkL9igB0wBqoz3jmLwsturSaWEwBQ61WVDqGieFq9ngFfCkEYKFCG7tbxG+HCDb7fScGSA4lHlJnjluOLTZwgLThv7X9f2tKqvYzE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787211945; c=relaxed/simple; bh=Mi6gMMTrdKEbNJ15AQPXdegSQJ+6Xj0ZZ+yiyd1qRJg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=niuePoVanLh/m7tIiW/oJcLoEkRY6o1xHoBLy6xmYDMfl2bEFx4linYOdF6NUO6DUS+yNXDR3g8sAJF1drLlBTW/7JSWzs1BYzFdsDNH69+lou3jCRmu8YNXDFOcfupmnQEG1feaiN8ztTRFc7Vrt9hnmc/fjYBGQqTrS+wcjOI= 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=PP6/En7o; arc=none smtp.client-ip=209.85.216.48 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="PP6/En7o" Received: by mail-pj1-f48.google.com with SMTP id 98e67ed59e1d1-38dfe910e9dso2181403a91.3 for ; Thu, 20 Aug 2026 00:45:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787211944; x=1787816744; 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=HFG3aPxSt6p7E5MMT2TB/oV3PiYeyY1S0Plz/2+PJGY=; b=PP6/En7opC77lPwBXCeozPk8kjHU3B7dZ8Hxt/ce9M78WRXIAxl/8xn/GALd8f80rv J+M3Z4ws7GeqH+vmuqh6vFNFQTdbyo8pCTjgM6fkDXhgkHolvKd2KDCHXHUgcrbHA49/ a5ZOEyriOKboSsgJ8CMialogt1SXx+MzS63vjPu9NyzgWP/rLj5/2gNMhjXP8hDjhva+ ic6hSsGLGu9Ia3ycpH7p/GWm6PNXyLCJ5TQHTDWRJ1vqDQ30+qfQBBPDLoEnC/a6JQ67 nWAw5SBRjdgkqterCn4mrs295lHHV1yAn52KCwyrDwA6sGKyCYqVFkHD+XsH9Akr/3id LjkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787211944; x=1787816744; 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=HFG3aPxSt6p7E5MMT2TB/oV3PiYeyY1S0Plz/2+PJGY=; b=RmctN3DniL/lzX460WjLfkQEUieGESXe50MQRf7JpQICbFr8DjzP9ptEl6lTquRcwy qNbawNiJxYh3sOQ8ZMa7uivL6avpeWbcA/RpEQqvN6E8aRgF8nE3kHeIVvRP5KGOXmGP QdIkH4GH1e6HsMYcYn8mCl8ocfpx2SLZVGaDVrOeu1gKnSMLtVpRKBoTu+NnEMCTipbz mTYs/9oAb0jHtji6/Jv5W/kyUoAeNjLUwS5+9cTacUNry1XdfR69X4QGJH+vbrMWI9mb chPr1Tn15lJsljOaH96noQCJVZtwOnU82HBxZeC7qZTRt6N8+7Uu0rXMBVo7pXEQl26J NN3w== X-Gm-Message-State: AFuF++mtBdYw4TLFmWQ1pYAnHX33vRRU1n1vvydQgHDSXXhoyDmkljIK rZsYQG42o+kjVr5yveS9Vigfb2SnVTUQpAuCIhUU3j3LmZq7oxnXuIg9 X-Gm-Gg: AR+sD12MLfg1YYbtKeA3bHwuEfhkY9WVn1qHwNxHyEWfaiUnXxoLh9RqOPOfT1sD531 nbUE78y893XjZ3y4EcHuhdwdc2IxgyVtLPJTaIRnZxDhNv1lMSjFds5nT6NcHK97rc+cVQtMWam LaO38oKhoZRCtw9x7KawEk3OcCiqx55vJlrctq+yrBLXyA7SnlmdimYdIFllAiqcAvos5UE3jyB k3w5ytPAlCfIjasurMIEGREWUJzTMIcn/UmQdwF5k4ErKoYK6qxsIyLT5I38ngijdQZYvKnO6wi 44q/rmv7RAJxYlfAiXHbCw85wiHe8uRSUIY9L1HRYnsf7y/2qwtsdetvcSZJ4Sv+O1gmjWP41yv VCGnYHAk6Yi71p+GHVqOuFn7oH9SCVfoUJfvHuF6+WihlSEbVsIh7KxAdlO+GfQKgw6yKtZJU4F i4XA8oIj4bMQaoTSv5xqNKQb/3lqR8OPHNelPrkRygf/0sx+R2z3aVZos3bp7MCxIIA+r5JcUrG seEsQlG+gTnNCx3P+2TDgNT X-Received: by 2002:a17:90a:da90:b0:37c:6910:5758 with SMTP id 98e67ed59e1d1-39580a91ae0mr21482680a91.1.1787211943660; Thu, 20 Aug 2026 00:45:43 -0700 (PDT) Received: from ML-GYSUBT565.ECARX.COM.CN ([101.47.164.95]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1416ad69638sm12848089c88.7.2026.08.20.00.45.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Aug 2026 00:45:43 -0700 (PDT) From: Nguyen Quang Le Kien To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, driver-core@lists.linux.dev, syzbot+87188222c77c0dbbdb4d@syzkaller.appspotmail.com, Nguyen Quang Le Kien Subject: [PATCH v3] driver core: avoid klist_remove() on unattached knode_driver Date: Thu, 20 Aug 2026 15:45:38 +0800 Message-Id: <20260820074538.102158-1-khiemtranzo532001@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <2026082048-malformed-finite-4e61@gregkh> References: <2026082048-malformed-finite-4e61@gregkh> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" usb_driver_claim_interface() sets dev->driver directly and skips device_bind_driver() when the interface is not yet registered, so the device can reach teardown with dev->driver set but knode_driver never added to the driver's klist_devices. __device_release_driver() then unconditionally calls klist_remove() on the unattached node, which dereferences a NULL klist pointer in klist_put() and crashes. Only remove the node if the device is actually bound. Use device_is_bound() rather than klist_node_attached() directly: the latter is a raw klist API and does not NULL-check dev->p, while device_is_bound() is the standard bound-state check used throughout driver core (driver_bound(), __device_attach()). Fixes: 94e7b1c5ff20 ("[PATCH] Add a klist to struct device_driver for the d= evices bound to it.") Reported-by: syzbot+87188222c77c0dbbdb4d@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D87188222c77c0dbbdb4d Signed-off-by: Nguyen Quang Le Kien --- drivers/base/dd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 60c005223..4154b4499 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -1354,7 +1354,8 @@ static void __device_release_driver(struct device *de= v, struct device *parent) device_unbind_cleanup(dev); device_links_driver_cleanup(dev); =20 - klist_remove(&dev->p->knode_driver); + if (device_is_bound(dev)) + klist_remove(&dev->p->knode_driver); device_pm_check_callbacks(dev); =20 bus_notify(dev, BUS_NOTIFY_UNBOUND_DRIVER); --=20 2.34.1