From nobody Thu Aug 27 05:12:48 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 4hVqQn4Ztvz6qS0l for ; Thu, 27 Aug 2026 05:12:49 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hVqQn1kmsz3h6q for ; Thu, 27 Aug 2026 05:12:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1787807569; 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=2eAtoMMbzRCaS+8NFyHyv5McvoYm/DtFAWcHf1ooRC4=; b=h4YWj1TflyPPzp30gexmd693eulSWE2nBPdxSRHuMMGRYnuuOI0xlEXAf+AzzWo70vJUzV dp/xmmyK6XwfmTSPL4T0zN6HovlOTyckLpZwECg0+9gdKepYx5h4jbfvb6j7h2Z1Wz3G8y Q4/m/g0Ws1RkKb3GacjdYGH4Kg5V5rN7nZWAuAQi+LKDHTZJunj3SCwtMIpuNwhdSEku+t yjNl8WYzuoKA5G5lOKL7BBxm5kNMFrfF5i4iU1pDToKvs2HHuxRL4gRbm8RoNp5J9XOTVq f2YxpdLxkca3vnAuGjH8It9iDkYv5oG15MEUIMEerv7BK5kzmCPR5ipReBeM8Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1787807569; a=rsa-sha256; cv=none; b=yd6Tp47V0Nc6/Yb9OyL+sFEa3WwT+S7mThIMqoozLy2CH4n4GZzA0GIh9WosFQHD07QRoG qBDU19s/c+p0qcmPmH4fZDjI5LXmbd0aX+KfyfAyWpbFskFRez4pa5lUlr96moLjwSOzXi sUhRpWoZVxnufBOEaw5QpD/s38sH3NONpawjN/xLpTW7Wl5ueNNJxa8HXhbyMUp1w4I1jM vFMgtc/SMt8OtLtRkAWPIPsvJvGBgojXLN17vkIsJ14vDpYJDkS/UVu62kNVgRHuUHBkPe 1fwFG/3KOxubEXbhSP0XkraCSYv1cutiqHxhNuGmTc5EgnSTGLxYqDPR8s55kw== 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=1787807569; 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=2eAtoMMbzRCaS+8NFyHyv5McvoYm/DtFAWcHf1ooRC4=; b=s+ITWZEjcdDHizuQHurmDLDQdE0NKK8hMp7USy9jAcDYXrO0j9rMbg9Fck3E9wo5MVZotS n5qKVHhO5dUW5nZut+agcz54tUNi8snD8ahM8KJKJWog6PgiZKnYgQkniL/yQIjgj6h19o z/s9ZVtJ6XpCzxMNiQc6HeWxXYZeMPvvE9u65vVF6RkHvyRlhEdLz/imQ/my7MLh9WfKeL QefAiOqy6iEG7Ga1n1or9hlA/nh+f1h7mdPhmiEO3iCYOvXLkDcrhT6YrLXZ1U+/ve79yL WoIdqnfzklx+gJ+gOfEsKQkiGRqFSt3rv1eyJA1r8z+mr/BccXNh53sAP9HPbA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hVqQn01nxz18mw for ; Thu, 27 Aug 2026 05:12:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 41def by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 27 Aug 2026 05:12:48 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jaeyoon Choi Subject: git: e59d4ec66fca - main - ufshci: handle a recovery reset before the SIM attach 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 List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jaeyoon X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e59d4ec66fcab3da813f593f52bb8f1577cbb403 Auto-Submitted: auto-generated Date: Thu, 27 Aug 2026 05:12:48 +0000 Message-Id: <6a8fc750.41def.3be92b6a@gitrepo.freebsd.org> The branch main has been updated by jaeyoon: URL: https://cgit.FreeBSD.org/src/commit/?id=e59d4ec66fcab3da813f593f52bb8f1577cbb403 commit e59d4ec66fcab3da813f593f52bb8f1577cbb403 Author: Jaeyoon Choi AuthorDate: 2026-08-27 05:03:02 +0000 Commit: Jaeyoon Choi CommitDate: 2026-08-27 05:08:38 +0000 ufshci: handle a recovery reset before the SIM attach When the first start attempt fails early, the recovery reset runs the start sequence again without a SIM. That pass still looked up the WLUN, so it dereferenced a NULL SIM and panicked. Attach the SIM whenever it does not exist yet. Also make the WLUN lookup return NULL when there is no SIM. Reviewed by: imp (mentor) Sponsored by: Samsung Electronics Differential Revision: https://reviews.freebsd.org/D58947 --- sys/dev/ufshci/ufshci_ctrlr.c | 7 ++++--- sys/dev/ufshci/ufshci_sim.c | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sys/dev/ufshci/ufshci_ctrlr.c b/sys/dev/ufshci/ufshci_ctrlr.c index 2f930d55a295..69b6869e98e2 100644 --- a/sys/dev/ufshci/ufshci_ctrlr.c +++ b/sys/dev/ufshci/ufshci_ctrlr.c @@ -151,10 +151,11 @@ ufshci_ctrlr_start(struct ufshci_controller *ctrlr, bool resetting) /* TODO: Configure Background Operations */ /* - * If the reset is due to a timeout, it is already attached to the SIM - * and does not need to be attached again. + * A reset normally arrives after the SIM is attached. But if the + * first start attempt failed early, the reset path runs without a + * SIM. Attach it whenever it does not exist yet. */ - if (!resetting && ufshci_sim_attach(ctrlr) != 0) { + if (ctrlr->ufshci_sim == NULL && ufshci_sim_attach(ctrlr) != 0) { ufshci_ctrlr_fail(ctrlr); return; } diff --git a/sys/dev/ufshci/ufshci_sim.c b/sys/dev/ufshci/ufshci_sim.c index 2d9a425f6439..d9ea84961879 100644 --- a/sys/dev/ufshci/ufshci_sim.c +++ b/sys/dev/ufshci/ufshci_sim.c @@ -454,6 +454,10 @@ ufshci_sim_find_periph(struct ufshci_controller *ctrlr, uint8_t wlun) uint64_t scsi_lun; uint64_t timeout; + /* The reset path can get here before the SIM is attached. */ + if (ctrlr->ufshci_sim == NULL) + return (NULL); + scsi_lun = ufshci_sim_translate_ufs_to_scsi_lun(wlun); if (xpt_create_path(&path, /*periph*/ NULL,