From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (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 A78BE37756A for ; Thu, 4 Jun 2026 18:22:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780597362; cv=none; b=hCNkj8gCeX6bBKBNwc+VBaXH3r9G0yJbzdoFj1/EOL2Pi9aDbDHQapCtf9I53h2z+exvJqlP9jfDP8AhN0OnZhWUiOvcV+bpMT1L5Cf7aCpH1vFK9+14DlHamPehWSnOaOpglykYlDRjmGpapPCVfta+Rwqm5AZ3FaPOYkp7oa8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780597362; c=relaxed/simple; bh=ZUIXUbkq9CBGBl58TAwO6tnCm3lHowZD0AFC0wgqMjs=; h=From:Content-Type:Mime-Version:Subject:Message-Id:Date:Cc:To; b=OxUc3O06IC9zcH0Qu7yAEr9MzQmVasWxGrs1o4YmXLgc7enFxh9jhjCCrYlRmtk6G9Usu5k21tt1XU4R/wXhqKVBOufGsBNO5Cr9RDkA5q0Za/bs1yHAbi6Y07dcCAn+fwmRkOx1NTT2JMt101yPa+T1Hl4psbEnOsMlu873Qos= 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=sAp5UySN; arc=none smtp.client-ip=209.85.222.170 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="sAp5UySN" Received: by mail-qk1-f170.google.com with SMTP id af79cd13be357-9159477c893so136549085a.0 for ; Thu, 04 Jun 2026 11:22:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780597359; x=1781202159; darn=vger.kernel.org; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=ZUIXUbkq9CBGBl58TAwO6tnCm3lHowZD0AFC0wgqMjs=; b=sAp5UySNMoHg1yYfjQ6eZ8G4ZHWuH8MGLxvEa/Azu/gSpH0o8EQTjxI8HjaThTyD6O tFNDUwKrFoYbbT02cjtZ9jpxI7z6dmiK0omkRFDJLoGlYzcHDILk9KzqrQ/5KQXQo/JY McnB4N2XrHjeEw8mlI5yZZtBPBgZahtCRD86Cbron7g1xmnfUFcBXuwkDIUZMCFT3CSi VDlj34GUcQ2k7qlOeWrlHYKapo1Ehg6hbLzq0TumgOX+gLi3p5ud1E/Pg9/I3a/R7L+1 09tUeVI/wh3iei6GQM+sm/mHWUtPJW2MqedVtBeLI8p0f3qoU+erSzft0MQ8EWhyB9uo JzkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780597359; x=1781202159; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ZUIXUbkq9CBGBl58TAwO6tnCm3lHowZD0AFC0wgqMjs=; b=Mgh9O7Wg2NTaxMPHDwA+bzn2Gl3t/uCeGv05lspVX4clgueoCAfzhwjbWFzCF3X1LD nbM+0X7rxjWtxD02cdPUI/4MeQp1QLuNBmuEM6UPRzajps12QAt1b7rnJkcbsOzI4ixd Je5QuYwcI+JDvi3TUteEx6xFG7wzc3Sh3vuafgahuxG//z/5A5sF06NnjAIlOasXg8Ve KFTiew6R0LrxFRG/IpH5UoGAZvw64QYo5+oxLK0gD5l9n9c7lpmm+qmM3wxusz8zTQoQ AXPLhonZ7QcimFUwg9EhCAk+aJx3K3iD73DttabCAO9Z+k3M2aDnVjkJDLtu50t1L1fE J2vg== X-Forwarded-Encrypted: i=1; AFNElJ/CTz/lEM6MJSqIfxiA0TeM5sFAVYpPQwJzvEQBML9tmE5b9noP70ELVxhwWrtIOn9WzLheAKQ+LAOA78Q=@vger.kernel.org X-Gm-Message-State: AOJu0YwHNRCHooN4q74Mh75WujJRVDlhz5pUObTuxJ2i8pFARhLbRmAM 2c/6niqurUkwsyIq7NWgdYCirxqEmSCNK7T83UurDif0yBPmENEKwXnE X-Gm-Gg: Acq92OEwM7MEtWQY6Shsy6STFEpgaynN69QZIxg9zTF/Rgx0wY1qa/cYHYHkOE7oTOt 3WmiWpb5/SsQTRyT8hEtWYSrKCGziAW92N5zO/407gx1pvpaKpNRSQS8I0IQQdTuD4KttnNqtW9 pYAXjFXP2DehWdnySZcwttABDNtxs2tOhFdGKCKa1ZNQ8N/BRJT67OGw7BmfeZwH64QlQR4w6MF JOW1t++L+wLjmz24sQ1y5duEj2j150U0Y8b+zTdnK1f8hKTQrDQ5C7C55UM3Ybqvky5DP2Jp57a /pSDyfXhpaLBbTqMP4v0lsThah9/0lFEHv0f0Jo6t/NjzvdxBcEskipWXFMpT8U3jlTQQbpjkhs uK+k2oGew/N486DP0GzgKjjrWK0nQqWR3AU+LpndwP8KSn7VYTbFeTv4wSGxaAejB1hcgHw3ToZ 28l7iBxuDA6LdViYVLgvXEDwVc0rmQpJI/ZIaL3b/pzLyBHwxZrsyIpk883wxlsUK3 X-Received: by 2002:a05:620a:29d0:b0:915:a811:1707 with SMTP id af79cd13be357-915a9c12fb0mr52063185a.5.1780597359541; Thu, 04 Jun 2026 11:22:39 -0700 (PDT) Received: from smtpclient.apple ([104.39.165.68]) by smtp.gmail.com with ESMTPSA id af79cd13be357-9158a00b474sm648962985a.10.2026.06.04.11.22.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Jun 2026 11:22:39 -0700 (PDT) From: Shuangpeng Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.600.51.1.1\)) Subject: [BUG] KASAN: slab-use-after-free in nvme_fc_fcpio_done Message-Id: Date: Thu, 4 Jun 2026 14:22:07 -0400 Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org To: justin.tee@broadcom.com, nareshgottumukkala83@gmail.com, paul.ely@broadcom.com, kbusch@kernel.org, axboe@kernel.dk, sagi@grimberg.me, hch@lst.de X-Mailer: Apple Mail (2.3864.600.51.1.1) Hi Kernel Maintainers, I hit the following KASAN report while testing current upstream kernel: KASAN: slab-use-after-free in nvme_fc_fcpio_done on upstream commit: e8c2f9fdadee7cbc75134dc463c1e0d856d6e5c7 (May 25 = 2026) This was found with nvme-fcloop. A previous fcloop-related report I sent = hit nvmet_fc_tgt_q_put on the target side: = https://lore.kernel.org/linux-nvme/56c826df-efe7-4c48-9142-c32c8e3415a8@gm= ail.com/ This report is different in that the freed object is the host-side nvme_fc_ctrl, freed through nvme_sysfs_delete() -> nvme_free_ctrl(), and = the later access happens in nvme_fc_fcpio_done() after fcloop calls the host completion path. To help trigger the bug more reliably, we applied a minimal diagnostic = patch that only adds delays and print statements. The reproducer and .config files are here. https://gist.github.com/shuangpengbai/b88810aba94d68ae11ac65b8d1e03a5b I=E2=80=99m happy to test debug patches or provide additional = information. Reported-by: Shuangpeng Bai [ 117.632186][ T1165] = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [ 117.632793][ T1165] BUG: KASAN: slab-use-after-free in = nvme_fc_fcpio_done (./drivers/nvme/host/nvme.h:473 = drivers/nvme/host/fc.c:2063) [ 117.634328][ T1165] Read of size 4 at addr ffff8881269fc3f4 by task = kworker/u9:2/1165 [ 117.634865][ T1165] [ 117.635075][ T1165] Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + = PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 [ 117.635078][ T1165] Workqueue: nvmet-wq fcloop_fcp_abort_recv_work [ 117.635098][ T1165] Call Trace: [ 117.635108][ T1165] [ 117.635111][ T1165] dump_stack_lvl (lib/dump_stack.c:94 = lib/dump_stack.c:120) [ 117.635145][ T1165] print_report (mm/kasan/report.c:378 = mm/kasan/report.c:482) [ 117.635201][ T1165] kasan_report (mm/kasan/report.c:595) [ 117.635207][ T1165] nvme_fc_fcpio_done (./drivers/nvme/host/nvme.h:473 = drivers/nvme/host/fc.c:2063) [ 117.635215][ T1165] fcloop_call_host_done = (drivers/nvme/target/fcloop.c:607) [ 117.635219][ T1165] process_scheduled_works (kernel/workqueue.c:3314 = kernel/workqueue.c:3397) [ 117.635232][ T1165] worker_thread (kernel/workqueue.c:3478) [ 117.635248][ T1165] kthread (kernel/kthread.c:436) [ 117.635258][ T1165] ret_from_fork (arch/x86/kernel/process.c:158) [ 117.635297][ T1165] ret_from_fork_asm (arch/x86/entry/entry_64.S:245) [ 117.635301][ T1165] [ 117.635302][ T1165] [ 117.644920][ T1165] Freed by task 8162 on cpu 1 at 117.604613s: [ 117.645351][ T1165] kasan_save_track (mm/kasan/common.c:57 = mm/kasan/common.c:78) [ 117.645683][ T1165] kasan_save_free_info (mm/kasan/generic.c:584) [ 117.646041][ T1165] __kasan_slab_free (mm/kasan/common.c:253 = mm/kasan/common.c:285) [ 117.646377][ T1165] kfree (./include/linux/kasan.h:235 mm/slub.c:2689 = mm/slub.c:6251 mm/slub.c:6566) [ 117.646664][ T1165] nvme_free_ctrl (drivers/nvme/host/core.c:5102) [ 117.646997][ T1165] device_release (drivers/base/core.c:2562) [ 117.647344][ T1165] kobject_put (lib/kobject.c:689 lib/kobject.c:720 = ./include/linux/kref.h:65 lib/kobject.c:737) [ 117.648052][ T1165] nvme_sysfs_delete (drivers/nvme/host/sysfs.c:401) [ 117.648392][ T1165] kernfs_fop_write_iter (fs/kernfs/file.c:352) [ 117.648769][ T1165] vfs_write (fs/read_write.c:595 = fs/read_write.c:688) [ 117.649088][ T1165] ksys_write (fs/read_write.c:740) [ 117.649390][ T1165] do_syscall_64 (arch/x86/entry/syscall_64.c:63 = arch/x86/entry/syscall_64.c:94) [ 117.649737][ T1165] entry_SYSCALL_64_after_hwframe = (arch/x86/entry/entry_64.S:121) [ 117.650124][ T1165] [ 117.650282][ T1165] The buggy address belongs to the object at = ffff8881269fc000 [ 117.650282][ T1165] which belongs to the cache kmalloc-4k of size 4096 [ 117.651226][ T1165] The buggy address is located 1012 bytes inside of [ 117.651226][ T1165] freed 4096-byte region [ffff8881269fc000, = ffff8881269fd000) Best, Shuangpeng