From nobody Tue Oct 06 07:51:31 2026 X-Original-To: dev-commits-src-branches@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 4hzT3S0Yv6z6cWJS for ; Tue, 06 Oct 2026 07:51:32 +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 4hzT3R2tJLz4H8w for ; Tue, 06 Oct 2026 07:51:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791273091; 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=+QYWwj72jT+nSVHm7tV8MhdQKminfT87Aq445YS9PQY=; b=oD54u2rsQ8hADVQUxCV0DilzsXaWV3jbP2eSa0VFIA8INqNskKgNWnilTTXDNRm/ipzHTZ +k/1PAliCm19/JDR3CYZgPxdDgJJNNKY5ojQbgeCOuGi6nnUNPviqZgad9sQrznweIchEJ YYN8YbGVuDChdWc7yDRlZIwUTR46nRjrNW2c1YpettvUz0S1O9ti2l2xCn8R6wUFsNxJwT Xi4rtQN74cEDiwO/qSGbB0WTb9ZY9Rpci6fCUlQOkTuCLS9SduwVT1j4nGF6pP9NihRqVN N0X1JJ+faZgE1CbjkGowmK8Rttvf/ub6LfB+gqr+nIX0WCtJfpJwCT6ybe4YLQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1791273091; b=JesAZUMGXGMxfMq5o4N7P6hNieWmJLFftVhezdD2Hew/AimeBZnl5lzUf53yo0huzlWv64 A4wIuWgNNHrgmBK+TveUIHUJG4eTB8qmkJu84Yhm+/xjRwwH8UIqrbnxdicUeBKhAFXrKW 7AaFGgy4pT+Gg9KWkybRddUsACMTgm2VfwYXM97TWj9tuUf29sW8qp2G2BA3AZTBYJ/Wor cn4HQ3dNt6eINKTZokhpq2NamCDEqLxbJevi/y4faJFFx4qnXMzIazMIGI0U7SqOrh2M38 +svVY+mF4k8nJ6IkGarQSxqkZvIyNyQXjFetvNiy2K/Y7lCvgKh9z8mcvumPbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791273091; 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=+QYWwj72jT+nSVHm7tV8MhdQKminfT87Aq445YS9PQY=; b=qXAfYKvu52F4VB77spuj9IMQLzf/rj5fv54Kc73oP16imutolGJDRI2E2DpFF7QFfonqLW M0xTSiN9G0VO4p2KR2hkzldKhYugYlV+iK30cfIABfH2R93x6bz8/jEMHX5fcGUFGnjXeo bTnnmn59ljYKZsFobEQWAipWRFN3WJGIiFDi6oxR6rFUzTIdVkz5mhV/MBIvXbqAo30WE8 PKq9o7ts+GJ0BpejCO739UKbmmtnG5XmCK+i52ShVYeoz2IQQ913ENXgiACCQJxEd0/gvi Xzct9guG3AgMrAUlN95/jFUZ1lN8hH1S2d9II9uSUKLznUoKb7GH0CGZ1wfSLg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hzT3R1lWwzx0C for ; Tue, 06 Oct 2026 07:51:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 18932 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 06 Oct 2026 07:51:31 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jaeyoon Choi Subject: git: 36e915b5eacb - stable/15 - ufshci: handle a recovery reset before the SIM attach List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/stable/15 X-Git-Reftype: branch X-Git-Commit: 36e915b5eacb667a7f65aa6b89083022cf675bff Auto-Submitted: auto-generated Date: Tue, 06 Oct 2026 07:51:31 +0000 Message-Id: <6ac4a883.18932.4cdf3a9c@gitrepo.freebsd.org> The branch stable/15 has been updated by jaeyoon: URL: https://cgit.FreeBSD.org/src/commit/?id=36e915b5eacb667a7f65aa6b89083022cf675bff commit 36e915b5eacb667a7f65aa6b89083022cf675bff Author: Jaeyoon Choi AuthorDate: 2026-08-27 05:03:02 +0000 Commit: Jaeyoon Choi CommitDate: 2026-10-06 06:28:06 +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 (cherry picked from commit e59d4ec66fcab3da813f593f52bb8f1577cbb403) --- 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,