From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796382719; b=HHgN+yw1ca+l6AMVaberCGzv/09JjkVMqzEu0M9zxkrfd1dYcaygcFzIDaS4geD55lO7 ilUbCaClY4odl+f7dxppjgkJAiNnHHe/Utnt2gZ7RV5G7tRLEysfLrCUwLwGtOV8RpaEG /kNWZhRpd3TRQUpImkPyJcBLfwhn+IuIMtr6wcIxAdq31o2h+wBnKQQ5QYueEdsTKVSzs Q+frZ7Llo2KFkZ13wpuj3cZI6ZGPrJXVAgAKcqe2MpNBS4YE1lDsIvuGiImVIxhnXwRRV X7mj/+2WMIcERipBuHwauE0PrGzM1W/u28KcDp3ubfMJ1nCXCAx/2Nn7RNClhSAFfkw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382719; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=7zpnaPNBlTZrengo4Q2DumLD3sDZu7hyX/zsO5NjgW0=; b=Ec07Em8r0cJhWNYQnwY18O+KB23NfvSD221xBH+lh/Uxo+e37jYEUK3Lnrmv25kGGWUm reXWomFOgLiCYIG2Firht3tZM9IEu95hB0XFi0I2+PUd3WMEC2NDl+ddCOMMQlJTiTohE ElQJocnkS6is88DjWIl/oB8S7RL2d6SJzatz2ax4ijYRR5vj/r6ivVav/ypwpmhypdbMc kFGIJJ60VO02PlYnnZy7Z00mYuNN9lm+F+IlxbfQuLAOh+ysXMcYA2LNW3MTMPtQA2af1 ot/dBTCTFrZZSldR0ulNFFOhCfsEx7ZqXJMJJ+pH+wGuxG9UHHaXyf9OH1geiaTp+lw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=DdWiGS96; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CBCDD606A322; Fri, 4 Dec 2026 11:11:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=DdWiGS96 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47B0D1F000C2; Fri, 4 Dec 2026 11:11:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382719; bh=7zpnaPNBlTZrengo4Q2DumLD3sDZu7hyX/zsO5NjgW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=DdWiGS96fLap7n7edS9jtyQTtEA9aVMbtjV+VrsEqNwDAOJVb315XiNV1PvuZrPp4 cIroGyymx3XajLDEOsW+/QoLFejGlXxgphGRaWgLMcM825M+Bgn+YVFMyVshDJTitV iBBguMc3nbHFtNwu5prir8zFTf/BrytCvaOpar6U= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ciro Iriarte , "Martin K. Petersen (Oracle)" Subject: [PATCH 6.18 574/703] scsi: target: core: Parse APTPL res_type and res_scope as hex Date: Fri, 4 Dec 2026 19:07:53 +0900 Message-ID: <20261204100643.032259200@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ciro Iriarte commit 08f08a6d49efc422258edba802faa4fc7677309e upstream. core_scsi3_update_aptpl_buf() saves the reservation holder's type and scope to the APTPL metadata file as zero-padded hex ("res_type=%02x", "res_scope=%02x"), but target_pr_res_aptpl_metadata_store() reads them back with "%d" tokens and match_int(), which parse with base 0. A leading zero selects octal, so match_token() parses only the "0" of "res_type=08", the trailing "8" makes the token not match, and the field is ignored as unknown. An Exclusive Access - All Registrants holder (type 0x8) is left with type 0 and the write fails with -EINVAL and Illegal PR type: 0x00 for reservation holder Userspace that restores APTPL state by writing the saved records back to pr/res_aptpl_metadata (rtslib-fb does this when it recreates a storage object) therefore loses every type 8 reservation across a target restart, and with rtslib the storage object creation fails. The other valid types (1, 3, 5, 6, 7) and scope 0 only work because their octal and decimal values coincide. Keep the on-disk format and parse both fields as hex. The valid type and scope values have the same hex and decimal representation, so records written in decimal by hand keep working. Fixes: c66ac9db8d4a ("[SCSI] target: Add LIO target core v4.0.0-rc6") Cc: stable@vger.kernel.org Signed-off-by: Ciro Iriarte Link: https://patch.msgid.link/ea903e6c-09b5-4a11-80e8-6e1387f39ef5@gmail.com Signed-off-by: Martin K. Petersen (Oracle) Signed-off-by: Greg Kroah-Hartman --- drivers/target/target_core_configfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c @@ -2039,8 +2039,8 @@ static match_table_t tokens = { {Opt_initiator_sid, "initiator_sid=%s"}, {Opt_sa_res_key, "sa_res_key=%s"}, {Opt_res_holder, "res_holder=%d"}, - {Opt_res_type, "res_type=%d"}, - {Opt_res_scope, "res_scope=%d"}, + {Opt_res_type, "res_type=%x"}, + {Opt_res_scope, "res_scope=%x"}, {Opt_res_all_tg_pt, "res_all_tg_pt=%d"}, {Opt_mapped_lun, "mapped_lun=%u"}, {Opt_target_fabric, "target_fabric=%s"}, @@ -2142,13 +2142,13 @@ static ssize_t target_pr_res_aptpl_metad res_holder = arg; break; case Opt_res_type: - ret = match_int(args, &arg); + ret = match_hex(args, &arg); if (ret) goto out; type = (u8)arg; break; case Opt_res_scope: - ret = match_int(args, &arg); + ret = match_hex(args, &arg); if (ret) goto out; break;