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=1796384080; b=25h6Ntyra0F/2ni8JvgfeJYua197Ti8ejD+Br5m1K+8rgxCkBmpnPIRRW5A0VDCATX7Y WtoNzF/ncjDmaTOVJsm6DKHA2wHVGs9vqYFuwEWrW+t7c7Q7vUOBxVsZJgGxQGJ5jw39O YZAQe02B1n3s4CqmaPASWWWH+uDWgab001UXpBAQ74RYWEjNHBh64wvobQeTfvUn86yDv 5iJUNOPXy4JmDBWbvk0qlxLbt2Ee7w84TX6nexgNw4T11MW7sRkBAZFy7N8QYNVE17iNI PvX3qpl61TCHcfSmLmlFsO+1lUH+Y5sf369rjrEIeSNPa4X+syHw49uncQb8f8KMBRw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384080; 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=sedcB/Oh+5LGhqvaMja6E4zNVzR0EkfjyvVuaWMBtnw=; b=VK+56mqLBoekyx8QiGchnMDwMjBQIXXtrxCOQzUVP8KZZYmp3NTPNGQ28OKdkrUcsAaH NhESOOuwuuMOfzCitb9bnKp8UJjVZTVyYcyBHeBBhc0aA5uNKJ9FTgGoKw3pQUp8o9UlR UgqB/olHj+Kpo8tNzyHBuTPezBpAf9/W4L8x3OU5ygom/QQycVQE43cVV98qPy56HMMzo DPSQr2iGL4rIcdvOfJNBtJJW9zCP3nzjCuI1RG0901ggUcNCCTG2BX5qOEa2d0/NOe+w7 spIej3lpZv3ARPlFLmqlAfcTFhRYQhK3KxwIRtkcTgf3pFiqIurvJzbrixPuj+mTtEw== 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=djZaIpIF; 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 6DD5F606A322; Fri, 4 Dec 2026 11:34:40 +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=djZaIpIF Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5FD21F000CE; Fri, 4 Dec 2026 11:34:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384080; bh=sedcB/Oh+5LGhqvaMja6E4zNVzR0EkfjyvVuaWMBtnw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=djZaIpIFzDpByOzj7jT14Nh9SFTWb4G/TnNYShWLjTxXLBiOTmLiOmV7Vo6+k9Q5j bFr1do0PV/Sbut0Y1EjwtTGJ9KW6PjUj3chZIO6Oe08OC++ttPrjfujH4hcocwfSLM iCdp1NVqmez96if/DZU9DaE+HF/HzvBM26kxSJ8k= 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.12 486/555] scsi: target: core: Parse APTPL res_type and res_scope as hex Date: Fri, 4 Dec 2026 19:08:49 +0900 Message-ID: <20261204100627.625814797@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-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 @@ -2041,8 +2041,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"}, @@ -2144,13 +2144,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;