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=1796381317; b=F2CykpvxVpN8ZIA0a3LD1BJtSLaVpJ9y1HyaFF7RyHbeVCXVMjXQ9Xv8nanLXLMtuAbE 0Wb0k+AQNUJbASNAdSmtjRZfHpUY6UbwzNn1ZtlRlcLY+IB0DhIztqCsFx7hJRp5DUO2c V/FeDo8Ze9GTMOdpk/agGZmaq/EoRXGyaDUPHEwzI8eLUZSe9aXZANhUtDuU9JMEDWRsw M0oIJ15RFlWfZRZwOx3ANqhRfXqtrlUotKtVk5olj+XCdscCUYhToUNXqRjE8zsvZrWsA I/csmDCXgoRj5/ntS35evad09OCw1ZFmVhg62+6nFlGWfCufsgA4wbXB2nxon9Y/fxw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381317; 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=aLdZ+qeOn1YkYKZisIwm4v2jNEhOiU82Fz3OTf2Rm2M=; b=imXuaMYiobiyFtkc8z0GYvIxmuxFt5oilWFEecI13WHw3I3zqVrVj1XJtC76osehRvtz MSQv3MObimzrg8E6c6aqQ4HDhL8hYGmVukfc3Zqco8H6Aylm4Slef0jWFq0WGuggsLnqP 3tlT76zI2B4L5nT5dzr9bmWK3kFOGoi/YOKiqvxxzjfeO+c/hWUYNb/+jqicxm6oXIAav //WK7wzhAF1DKUuB+Pe92H0cotjOcXH+nAbgtqRqcJtaRRlgNiCEC9TsqYyw4ZJVfoeqM s3XUwheNEwBbREO1vSLLfNantkbcTq6mOh4ZZFbBiwZK54n2ha5c3LAuxV0iD2Gs8jA== 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=pvUjqDGs; 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 91962606A322; Fri, 4 Dec 2026 10:48:37 +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=pvUjqDGs Received: by smtp.kernel.org (Postfix) with ESMTPSA id 005C81F000CE; Fri, 4 Dec 2026 10:48:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381317; bh=aLdZ+qeOn1YkYKZisIwm4v2jNEhOiU82Fz3OTf2Rm2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=pvUjqDGsYqS0trQ3b/cQ6HxBXRqocL+BsPWCNWX1ta/glLDhGfZVD5IOePEwba/Gr MM1728LZZfJyUWhmkIXWJofs9wY2O1LWfyGmtY6E13R7rJimkiMXtq+VyKp8s1O30y +19c28JI2IwkDtvnsY1tjgTAvasB26l6qxAwiI5I= 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 7.3 650/742] scsi: target: core: Parse APTPL res_type and res_scope as hex Date: Fri, 4 Dec 2026 19:08:34 +0900 Message-ID: <20261204100652.357243653@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@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 7.3-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 @@ -2126,8 +2126,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"}, @@ -2229,13 +2229,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;