From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f71.google.com (mail-ot1-f71.google.com [209.85.210.71]) (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 E8FC83B0581 for ; Thu, 20 Aug 2026 06:13:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.71 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787206413; cv=none; b=nNqB1oar7gf9sAxnYuMTDY6sp5l2w11/DI8dh6o3l5eGGFR3MSizYEw9//fBxS/a+iuFswvJ6fJqH6HORKf6mOzOdfZcPR+g7RRGcGinoPZ4LvyCgV/LG/MIrIylYQnNQy6xpAjiBNgErZHl3HOutoAzfpqbPwB0JHkbI2wK+LQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787206413; c=relaxed/simple; bh=OQeTjzpMvqo4KevBiqLkM1uNdgNhP/uNzEBHrhVrnDc=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=HBY62dhPJqiMctJwwmljHqTBf8DX2rj+yWXARu/epunbVPLpBjgb3Sn1i7S1V7lJLpxyxchNMsG7EAGhsdTtvMEuQibW7gDrHixZpGpclD9MbJmoKpWPnVeW0Mtew4fxdOO/840hCwUTzbeq1kveqWkCxQQLlNjnDM2qFxo8lq4= 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.210.71 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-ot1-f71.google.com with SMTP id 46e09a7af769-7e9dc0f5900so1200142a34.0 for ; Wed, 19 Aug 2026 23:13:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787206408; x=1787811208; 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=OwaNoYGgQ2+mBXC7eMzWhrsNK6Okvcyl8C/8fNGKzyU=; b=jsBaJ8DUwAyhfWqHx7IG0JB+XgUZlkJbiwTjvAcLeDq1C8++8H4Gyl+R2wuaOr7KSi X49RM4cbxHWBFqRPYk9Ka8J5/B3wQ26DqfQmvSiM5MrRvufnIfT07oglgitOVucUJV9k v7gQDnhzfH09nUkxPFqchzbkrdt2EWp0YbebnjqDDYNseDp+BgxZAByxiSDvL7RiXc9E fv1krwMbEG9I/6I8E5XD5++sTXT6zriQ8syfQvew8NZ98vsf5aovpjnKfMnKDRSGDLiv CS8+P/P6Bjm/KSF0UQnZtpsnEoe3339aI+qezg/dQBpfMmalT+8uxPGAC7igjhGu9cZy favA== X-Gm-Message-State: AOJu0YwrwesNsZx/HxLd3t+o0DCDvNQ97IudQrBiRQogd8ojlAKp3IiZ mzY3tFvywk7vSRup09/z5jIwd+3y7yo6EI8jlFiop/q8t6+Sr9+bvAZYKY0vqeD0vBxjHbMWcUc /UO/8Qf4kQIGOVx9hzVeZHMvdp1SyeZ2QSjJILgoO1tz3CDvK0RDmgPYP840= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a4a:d1ba:0:b0:6aa:e367:a3e2 with SMTP id 006d021491bc7-6b1492fca45mr3072230eaf.19.1787206408057; Wed, 19 Aug 2026 23:13:28 -0700 (PDT) Date: Wed, 19 Aug 2026 23:13:28 -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: <6a869b08.ae6ddae5.3da009.0018.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. Only remove the node if the device is actually bound, mirroring the check device_is_bound() already provides for the driver core. This matches the existing guard on knode_bus in bus_remove_device(). 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..4154b4499 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 (device_is_bound(dev)) + klist_remove(&dev->p->knode_driver); device_pm_check_callbacks(dev); bus_notify(dev, BUS_NOTIFY_UNBOUND_DRIVER); -- 2.34.1