Re: [syzbot] [nvme?] BUG: corrupted list in nvmet_fc_remove_port

From: Hillf Danton

Date: Mon Oct 12 2026 - 06:39:38 EST


> Date: Sun, 11 Oct 2026 10:32:37 -0700 [thread overview]
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: a5ebb76233b7 Merge tag 'edac_urgent_for_v7.3_rc7' of git:/..
> git tree: upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=1494923e580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=df4bbab1c2172b9f
> dashboard link: https://syzkaller.appspot.com/bug?extid=c98b21427617af7f547a
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=126a0f15580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=166a0f15580000

#syz test

--- x/drivers/nvme/target/fc.c
+++ y/drivers/nvme/target/fc.c
@@ -2915,23 +2915,26 @@ nvmet_fc_add_port(struct nvmet_port *por
static void
nvmet_fc_remove_port(struct nvmet_port *port)
{
- struct nvmet_fc_port_entry *pe = port->priv;
+ struct nvmet_fc_port_entry *pe;
struct nvmet_fc_tgtport *tgtport = NULL;
unsigned long flags;

spin_lock_irqsave(&nvmet_fc_tgtlock, flags);
- if (pe->tgtport && nvmet_fc_tgtport_get(pe->tgtport))
+ pe = port->priv;
+ port->priv = NULL;
+ if (pe && pe->tgtport && nvmet_fc_tgtport_get(pe->tgtport))
tgtport = pe->tgtport;
spin_unlock_irqrestore(&nvmet_fc_tgtlock, flags);

- nvmet_fc_portentry_unbind(pe);
-
if (tgtport) {
/* terminate any outstanding associations */
__nvmet_fc_free_assocs(tgtport);
nvmet_fc_tgtport_put(tgtport);
}

+ if (!pe)
+ return;
+ nvmet_fc_portentry_unbind(pe);
kfree(pe);
}

--