All of lore.kernel.org
 help / color / mirror / Atom feed
* [syzbot] [pci?] WARNING in pci_scan_single_device (2)
@ 2026-01-21  0:08 syzbot
  2026-07-24 22:31 ` syzbot
  2026-07-25 10:06 ` Forwarded: [PATCH] PCI: Handle dev_set_name() failure in pci_setup_device() syzbot
  0 siblings, 2 replies; 4+ messages in thread
From: syzbot @ 2026-01-21  0:08 UTC (permalink / raw)
  To: bhelgaas, linux-kernel, linux-pci, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    983d014aafb1 kernel: modules: Add SPDX license identifier ..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=10658852580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=ae589cd0a6acd9be
dashboard link: https://syzkaller.appspot.com/bug?extid=87bb32e345aa80c0554b
compiler:       gcc (Debian 12.2.0-14+deb12u1) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/8a294469166c/disk-983d014a.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/f9504a6df5a7/vmlinux-983d014a.xz
kernel image: https://storage.googleapis.com/syzbot-assets/88a1d939d6af/bzImage-983d014a.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+87bb32e345aa80c0554b@syzkaller.appspotmail.com

------------[ cut here ]------------
WARNING: drivers/pci/probe.c:2800 at pci_device_add+0x105e/0x1490 drivers/pci/probe.c:2800, CPU#0: syz.5.1730/14510
Modules linked in:
CPU: 0 UID: 0 PID: 14510 Comm: syz.5.1730 Tainted: G     U       L      syzkaller #0 PREEMPT(full) 
Tainted: [U]=USER, [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025
RIP: 0010:pci_device_add+0x105e/0x1490 drivers/pci/probe.c:2800
Code: e5 04 83 e0 8f 09 e8 88 83 c0 00 00 00 e9 ef f2 ff ff e8 85 7a d6 fc 90 0f 0b 90 90 0f 0b 90 e9 ee f4 ff ff e8 73 7a d6 fc 90 <0f> 0b 90 e9 c1 f7 ff ff e8 65 7a d6 fc 90 0f 0b 90 e9 54 f7 ff ff
RSP: 0018:ffffc9000bb5f938 EFLAGS: 00010283
RAX: 000000000003659d RBX: 00000000fffffff4 RCX: ffffc90015bd3000
RDX: 0000000000080000 RSI: ffffffff84e7e38d RDI: 0000000000000005
RBP: ffff88801bae0400 R08: 0000000000000005 R09: 0000000000000000
R10: 00000000fffffff4 R11: ffffffff81000130 R12: ffff888142e87028
R13: ffff888142e87000 R14: 0000000000000001 R15: ffff888142ea2000
FS:  00007fa6b528e6c0(0000) GS:ffff8881248f9000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000020000058e000 CR3: 000000007e2d4000 CR4: 00000000003526f0
Call Trace:
 <TASK>
 pci_scan_single_device drivers/pci/probe.c:2824 [inline]
 pci_scan_single_device+0x252/0x310 drivers/pci/probe.c:2810
 pci_scan_slot+0x1c0/0x760 drivers/pci/probe.c:2907
 pci_scan_child_bus_extend+0x6b/0x7d0 drivers/pci/probe.c:3126
 pci_scan_child_bus drivers/pci/probe.c:3239 [inline]
 pci_rescan_bus+0x18/0x40 drivers/pci/probe.c:3530
 rescan_store+0xfb/0x130 drivers/pci/pci-sysfs.c:472
 bus_attr_store+0x74/0xb0 drivers/base/bus.c:172
 sysfs_kf_write+0xf2/0x150 fs/sysfs/file.c:142
 kernfs_fop_write_iter+0x3af/0x570 fs/kernfs/file.c:352
 new_sync_write fs/read_write.c:593 [inline]
 vfs_write+0x7d3/0x11d0 fs/read_write.c:686
 ksys_write+0x12a/0x250 fs/read_write.c:738
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xcd/0xf80 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fa6b438f7c9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fa6b528e038 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007fa6b45e5fa0 RCX: 00007fa6b438f7c9
RDX: 0000000000000001 RSI: 0000200000000200 RDI: 0000000000000003
RBP: 00007fa6b4413f91 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fa6b45e6038 R14: 00007fa6b45e5fa0 R15: 00007ffd9a287b48
 </TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [syzbot] [pci?] WARNING in pci_scan_single_device (2)
  2026-01-21  0:08 [syzbot] [pci?] WARNING in pci_scan_single_device (2) syzbot
@ 2026-07-24 22:31 ` syzbot
  2026-07-25 10:06 ` Forwarded: [PATCH] PCI: Handle dev_set_name() failure in pci_setup_device() syzbot
  1 sibling, 0 replies; 4+ messages in thread
From: syzbot @ 2026-07-24 22:31 UTC (permalink / raw)
  To: bhelgaas, kapoorarnav43, linux-kernel, linux-pci, syzkaller-bugs

syzbot has found a reproducer for the following issue on:

HEAD commit:    48a5a7ab8d6a Merge tag 'v7.2-rc4-smb3-client-fixes' of git..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=11c02499580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=145fa60d73086782
dashboard link: https://syzkaller.appspot.com/bug?extid=87bb32e345aa80c0554b
compiler:       gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1677d746580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=158932ea580000

Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/d900f083ada3/non_bootable_disk-48a5a7ab.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/8ed725bee82f/vmlinux-48a5a7ab.xz
kernel image: https://storage.googleapis.com/syzbot-assets/110c09c210d5/bzImage-48a5a7ab.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+87bb32e345aa80c0554b@syzkaller.appspotmail.com

 </TASK>
pci (null): [8086:2934] type 00 class 0x0c0300 conventional PCI endpoint
pci (null): BAR 4 [io  0xc0e0-0xc0ff]
------------[ cut here ]------------
ret < 0
WARNING: drivers/pci/probe.c:2768 at pci_device_add+0x133b/0x1810 drivers/pci/probe.c:2768, CPU#1: syz.0.17/5936
Modules linked in:
CPU: 1 UID: 0 PID: 5936 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
RIP: 0010:pci_device_add+0x133b/0x1810 drivers/pci/probe.c:2768
Code: e5 04 83 e0 8f 09 e8 88 83 c8 00 00 00 e9 28 f4 ff ff e8 18 a3 ae fc 90 0f 0b 90 90 0f 0b 90 e9 0e f7 ff ff e8 06 a3 ae fc 90 <0f> 0b 90 e9 7e fa ff ff e8 f8 a2 ae fc 90 0f 0b 90 e9 11 fa ff ff
RSP: 0018:ffffc900037a7928 EFLAGS: 00010293
RAX: 0000000000000000 RBX: 00000000ffffffea RCX: ffffffff855bb419
RDX: ffff888025a72540 RSI: ffffffff855bb99a RDI: ffff888025a72540
RBP: ffff88801c2e9000 R08: 0000000000000005 R09: 0000000000000000
R10: 00000000ffffffea R11: 0000000000000000 R12: ffff888022e6f028
R13: ffff888022e6f000 R14: 0000000000000001 R15: ffff888022e92000
FS:  0000555591741500(0000) GS:ffff8880d5ede000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055af1cf515a8 CR3: 000000003dca4000 CR4: 0000000000352ef0
Call Trace:
 <TASK>
 pci_scan_single_device drivers/pci/probe.c:2792 [inline]
 pci_scan_single_device+0x1d0/0x240 drivers/pci/probe.c:2778
 pci_scan_slot+0x1c9/0x7c0 drivers/pci/probe.c:2875
 pci_scan_child_bus_extend+0x6b/0x7b0 drivers/pci/probe.c:3094
 pci_scan_child_bus drivers/pci/probe.c:3207 [inline]
 pci_rescan_bus+0x18/0x40 drivers/pci/probe.c:3498
 rescan_store+0xfb/0x130 drivers/pci/pci-sysfs.c:473
 bus_attr_store+0x74/0xb0 drivers/base/bus.c:172
 sysfs_kf_write+0xf2/0x150 fs/sysfs/file.c:145
 kernfs_fop_write_iter+0x3e0/0x5f0 fs/kernfs/file.c:345
 new_sync_write fs/read_write.c:595 [inline]
 vfs_write+0x6ac/0x1050 fs/read_write.c:687
 ksys_write+0x12a/0x250 fs/read_write.c:739
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fe44799de99
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffce5639058 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007fe447c25fa0 RCX: 00007fe44799de99
RDX: 0000000000000001 RSI: 0000200000000800 RDI: 0000000000000004
RBP: 00007ffce56390c0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007fe447c25fac R14: 00007fe447c25fa0 R15: 00007fe447c25fa0
 </TASK>


---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Forwarded: [PATCH] PCI: Handle dev_set_name() failure in pci_setup_device()
  2026-01-21  0:08 [syzbot] [pci?] WARNING in pci_scan_single_device (2) syzbot
  2026-07-24 22:31 ` syzbot
@ 2026-07-25 10:06 ` syzbot
  1 sibling, 0 replies; 4+ messages in thread
From: syzbot @ 2026-07-25 10:06 UTC (permalink / raw)
  To: linux-kernel, syzkaller-bugs

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: [PATCH] PCI: Handle dev_set_name() failure in pci_setup_device()
Author: rihyeon8648@gmail.com

#syz test

pci_setup_device() calls dev_set_name() but ignores its return value.
dev_set_name() allocates the name with kvasprintf() and can fail, leaving
dev->kobj.name NULL.

Enumeration then continues with an unnamed device.  device_add() rejects
it with -EINVAL because dev_name() returns NULL and pci_bus_type has no
->dev_name callback, but pci_device_add() only WARNs about that failure:

  pci (null): [8086:2934] type 00 class 0x0c0300 conventional PCI endpoint
  pci (null): BAR 4 [io  0xc0e0-0xc0ff]
  ------------[ cut here ]------------
  ret < 0
  WARNING: drivers/pci/probe.c:2768 at pci_device_add+0x133b/0x1810
  Call Trace:
   pci_scan_single_device+0x1d0/0x240
   pci_scan_slot+0x1c9/0x7c0
   pci_scan_child_bus_extend+0x6b/0x7b0
   pci_rescan_bus+0x18/0x40
   rescan_store+0xfb/0x130

The device was already put on bus->devices before device_add() ran and is
not removed from it, so pci_bus_add_devices() later in the same
pci_rescan_bus() call picks it up and hands it to __device_attach(), which
dereferences dev->p.  device_add() freed dev->p on its error path, so this
is a NULL dereference:

  Oops: general protection fault, probably for non-canonical address ...
  KASAN: null-ptr-deref in range [0x0000000000000108-0x000000000000010f]
  RIP: 0010:__device_attach+0xb0/0x4d0
  Call Trace:
   device_initial_probe+0xaf/0xd0
   pci_bus_add_device+0xc5/0x100
   pci_bus_add_devices+0x9a/0x1f0
   pci_rescan_bus+0x2a/0x40
   rescan_store+0xfb/0x130
  Kernel panic - not syncing: Fatal exception

Propagate the error instead.  pci_setup_device() already returns int and
both callers, pci_scan_device() and pci_iov_scan_device(), release the
device on failure, so no caller changes are needed.  Release the OF node
first, matching the existing error path for an unknown header type.

Reported-by: syzbot+87bb32e345aa80c0554b@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=87bb32e345aa80c0554b
Fixes: eebfcfb52ce7 ("PCI: handle pci_name() being const")
Signed-off-by: Rihyeon Kim <rihyeon8648@gmail.com>
---
 drivers/pci/probe.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index dd0abbc63e18..474c6cb327be 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2052,9 +2052,13 @@ int pci_setup_device(struct pci_dev *dev)
 	 */
 	dev->msi_addr_mask = DMA_BIT_MASK(64);
 
-	dev_set_name(&dev->dev, "%04x:%02x:%02x.%d", pci_domain_nr(dev->bus),
-		     dev->bus->number, PCI_SLOT(dev->devfn),
-		     PCI_FUNC(dev->devfn));
+	err = dev_set_name(&dev->dev, "%04x:%02x:%02x.%d",
+			   pci_domain_nr(dev->bus), dev->bus->number,
+			   PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
+	if (err) {
+		pci_release_of_node(dev);
+		return err;
+	}
 
 	class = pci_class(dev);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [syzbot] [pci?] WARNING in pci_scan_single_device (2)
       [not found] <20260725100645.221918-1-rihyeon8648@gmail.com>
@ 2026-07-25 10:32 ` syzbot
  0 siblings, 0 replies; 4+ messages in thread
From: syzbot @ 2026-07-25 10:32 UTC (permalink / raw)
  To: linux-kernel, rihyeon8648, syzkaller-bugs

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: syzbot+87bb32e345aa80c0554b@syzkaller.appspotmail.com
Tested-by: syzbot+87bb32e345aa80c0554b@syzkaller.appspotmail.com

Tested on:

commit:         0ce37745 Merge tag 'block-7.2-20260724' of git://git.k..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=164dc7b1580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=145fa60d73086782
dashboard link: https://syzkaller.appspot.com/bug?extid=87bb32e345aa80c0554b
compiler:       gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
patch:          https://syzkaller.appspot.com/x/patch.diff?x=15612449580000

Note: testing is done by a robot and is best-effort only.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-07-25 10:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-21  0:08 [syzbot] [pci?] WARNING in pci_scan_single_device (2) syzbot
2026-07-24 22:31 ` syzbot
2026-07-25 10:06 ` Forwarded: [PATCH] PCI: Handle dev_set_name() failure in pci_setup_device() syzbot
     [not found] <20260725100645.221918-1-rihyeon8648@gmail.com>
2026-07-25 10:32 ` [syzbot] [pci?] WARNING in pci_scan_single_device (2) syzbot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.