From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f199.google.com (mail-oi1-f199.google.com [209.85.167.199]) (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 1DA597478 for ; Thu, 20 Aug 2026 04:34:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787200475; cv=none; b=E+B0r+8/a16uez+1Af1gTdXzxtsfl/UlKlc5iBJb/qs1pGzRkw37JqpRuw2pB9MKkHgw6dfyBgrXP2ElaJm8vlACFjwBHt9aGFETrEbjk66m6zGtGkTKDUQSdw1QClAyN4OJ9Nu6KSaZuRGuEUGrEoNVf0wdXWECoPnXocNVqy0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787200475; c=relaxed/simple; bh=Qu8Nnlvy9nrnKr4iJyruw6I+w5xNY/1LsbJMItiXoU0=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=iQdfDiiEJXbqay+j87ZromJNu8AgVOqeyLKbYrizOFfEysw4fINMWLN5e+/TqaMUi1rG1x8UNzjsprnnHaFbvlb7FsqCzmcofctW6p45jysMsoJS4tvFyAqVV7fB7QZmQxcGWYcQSoI9nyCKU0UHeSv3aHuhWz+BERzezu9KS4c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.167.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-oi1-f199.google.com with SMTP id 5614622812f47-4b1bc2e44e0so2271161b6e.0 for ; Wed, 19 Aug 2026 21:34:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787200473; x=1787805273; h=content-type:to:from:subject:message-id:in-reply-to:date :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=JdeMZqxKSA7UW8f7dhKmsCnFQj2rvEXAyGcLvzVdSPw=; b=lAKuD9QBbuozRskgceOL3QlrNlPcUY33pLBIL8QzmWIIKPeosonopCW6JwkQOdwYwI uMsy2hZ3x3hrNPrIllZOslbBiuswUndJcYOsTyOdh3cMzuUdjbxSF8dUjPY2uh6IDndC o+NXMBoi+6rmOK6t0wDjCZ9aANL8MZxx6KmsMtYOHaBKLLIq/+pFoiYfSzUfoFK4ryF8 hPm9pjjUlBdIK4eZtdEZcma2+ZOpkYx8TVciHasNCtCts29z5SavvWyZvtFvRz9Jvjp/ inpOvZ5RvMhoTSV/BMyba4IkKP4/B27O/3oV8q1SOg5+l98FI35wuQSiKNCnVYhOND6i aATw== X-Gm-Message-State: AOJu0YyWeWVSf6GFipogCAcNTIXBlKoSU/Z/oRDqSYgm5WA4o2qMOuZY XjrBoxzxhV+pBMJlP5RDkWVC7Ec8n8u2d4QHWFh3gUqGubS3zY/etwIB8rbnv8XW3pTkuRltR0R eTcoD+uJMMliQEGkLrer1pxi5x5DEJ4ML+Br30AWuH+AUyfxKMQFmlitxas0= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6820:80c5:b0:6b1:409f:3829 with SMTP id 006d021491bc7-6b1409f4839mr8058032eaf.24.1787200473010; Wed, 19 Aug 2026 21:34:33 -0700 (PDT) Date: Wed, 19 Aug 2026 21:34:32 -0700 In-Reply-To: <6a85e576.f7a79266.2f965f.003f.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <6a8683d8.4d75e56a.c9a88.0030.GAE@google.com> Subject: Forwarded: [PATCH] driver core: avoid klist_remove() on unattached knode_driver From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Type: text/plain; charset="UTF-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] driver core: avoid klist_remove() on unattached knode_driver Author: khiemtranzo532001@gmail.com #syz test 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. Guard the klist_remove() with klist_node_attached(), mirroring the existing check in bus_remove_device() for knode_bus. Reported-by: syzbot+87188222c77c0dbbdb4d@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=87188222c77c0dbbdb4d 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..14752a5e5 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -1354,7 +1354,8 @@ static void __device_release_driver(struct device *dev, struct device *parent) device_unbind_cleanup(dev); device_links_driver_cleanup(dev); - klist_remove(&dev->p->knode_driver); + if (klist_node_attached(&dev->p->knode_driver)) + klist_remove(&dev->p->knode_driver); device_pm_check_callbacks(dev); bus_notify(dev, BUS_NOTIFY_UNBOUND_DRIVER); -- 2.34.1