From nobody Wed Feb 18 16:55:11 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4fGN105S23z6STnk for ; Wed, 18 Feb 2026 16:55:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fGN1038krz3K2G for ; Wed, 18 Feb 2026 16:55:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1771433716; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pzHgSDC7Vzq0tD7PRUikRWbehp0TXlNsmNc/+Oz6nKU=; b=eGamAzd894TUSnRLAfTQl6VRBPxgRLuLisi6Zs4jMwgBuWll2y2A/xRw/iK055ktX1Mdvt AHzgP9Z5QDEEDrTNekkoWI2iYjwFQVDBAQqSYG+vx9kOcEc8y7Rp4mf1aA2AgSlitBlYiE 60USBW34IzLOmp/pLZVOil284uHUxHcM0A0tVKwuANtcvx7bPenS3cn2ShQQnIXQxfBNGn el9bo/ovOg28b+y6imp+qBI23SfqPak/6cjrXdCZXFYDevciBIAhQT/YG9raEtXol4SU0d 4XFwCGVSwJM79n3Py/9CHlBtyzinTgpNaMKDxUECzQTZPLL+/pSOeJcrQD0hCw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1771433716; a=rsa-sha256; cv=none; b=E8VbondqMPCQh85Pd8PNZ+wzpNg/zDPXueGFY5W+5AgCHUi3rEtNmkXC4f5yXYH8v0iCyT uQTbkr1G0HoM1yTzlhgiUjOgLCsTInZ2ast1kAiCG9Vrw5JxzSASFJh94rL+dM9JTK0iVk +/JBlmCyYAt5EDsrWgD7cyZABfQKne8Ti0AFelBCnPENVqavxlEmrsqY7jBHyZbkSdZ0Yq oE4ZS/p6Sg/zhifGYNeekoMc7sR4mLReJvKPDfLA6mBe5LoH2M7wmbiB9vOnLGabdm9OAS P9Z5HGKsX/a4YZaZRwSoKgkmomIYkD3Iwvko66gVYLlIfCY6gAcc/9MGz6zPbg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1771433716; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pzHgSDC7Vzq0tD7PRUikRWbehp0TXlNsmNc/+Oz6nKU=; b=AoY/ys+2CAWro8qAaljLlJ0Y/JARxwWtKx6Tb3Ci1p/2gq4ueIwjqxiCP46RJan6AW57uC j6rpXPsfPVn2FoM5qkAQIOAiwNECsZF0PLrzSDsw1byU+J8+/fukF6TPpL9m+Fh26zaceC mimebplcuTPD56k5pB+KH1A5KKDM05oqNatQDyFMujhC/wyb4ngjN6P87f5TTET3GKCoRy /0KtOk7nJMofWhLlc51msT0AtHdi6BMNM9KaZLFn6TZY2H1PFqBiIXwJ7Avn9eDzD4LVrP wE0N/tb44kZNtsdb8JD7khZ5j/T1mkHePH5wd8a44rjVOWN14ZghH4CWonZysA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fGN0v2hjGz14P7 for ; Wed, 18 Feb 2026 16:55:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 362a7 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 18 Feb 2026 16:55:11 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: c8d63d63679f - main - nvme: fix panic if we boot w/o a namespace List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c8d63d63679fc0d8a67b33499a2a2edd444c8e2e Auto-Submitted: auto-generated Date: Wed, 18 Feb 2026 16:55:11 +0000 Message-Id: <6995eeef.362a7.15721196@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c8d63d63679fc0d8a67b33499a2a2edd444c8e2e commit c8d63d63679fc0d8a67b33499a2a2edd444c8e2e Author: Warner Losh AuthorDate: 2026-02-17 08:00:34 +0000 Commit: Warner Losh CommitDate: 2026-02-18 16:39:28 +0000 nvme: fix panic if we boot w/o a namespace If we format a drive, and then crash, we'll come back up. nvme_sim_ns device won't attach because we don't have a namespace. Some drives (all? I couldn't find it in the standard) send an AER with a namespace change, which causes a NULL dereference because s_sim wasn't initialized because we didn't attach. So, if we get into the ns_changed routine, bail early if we didn't attach. We'll attach later, and deal with the ns correctly if it's really there, or not attach one if it's not. Sponsored by: Netflix --- sys/dev/nvme/nvme_sim.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/dev/nvme/nvme_sim.c b/sys/dev/nvme/nvme_sim.c index 8b861cf3aa71..a59823847c39 100644 --- a/sys/dev/nvme/nvme_sim.c +++ b/sys/dev/nvme/nvme_sim.c @@ -405,6 +405,16 @@ nvme_sim_ns_added(device_t dev, struct nvme_namespace *ns) struct nvme_sim_softc *sc = device_get_softc(dev); union ccb *ccb; + /* + * If we have no namespaces, then we both do not attach the nvme_sim_ns + * device. And then get a ns changed AER as well to tell us about it + * (which is how we get here). If there's no device attached, then + * there's nothing to do. sc->s_sim will be NULL as well (since it + * only gets set when we attach). + */ + if (!device_is_attached(dev)) + return (0); + /* * We map the NVMe namespace idea onto the CAM unit LUN. For each new * namespace, scan or rescan the path to enumerate it.