Re: [PATCH 1/2] scsi: target: fix hexadecimal CHAP_I handling

John Garry <[email protected]> Mon, 8 Jun 2026 16:12:01 +0100
Newsgroups org.kernel.vger.target-devel,org.kernel.vger.linux-scsi
Organization Oracle Corporation
Message-ID <[email protected]>
> ---
>   drivers/target/iscsi/iscsi_target_auth.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c
> index a3ad2d244dbee..5858cc3089796 100644
> --- a/drivers/target/iscsi/iscsi_target_auth.c
> +++ b/drivers/target/iscsi/iscsi_target_auth.c
> @@ -438,9 +438,11 @@ static int chap_server_compute_hash(
>   	}
>   
>   	if (type == HEX)
> -		ret = kstrtoul(&identifier[2], 0, &id);
> +		ret = kstrtoul(identifier, 16, &id);
> +	else if (type == DECIMAL)
> +		ret = kstrtoul(identifier, 10, &id);
>   	else
> -		ret = kstrtoul(identifier, 0, &id);
> +		ret = -EINVAL;

Only hex for decimal are supported, so I am not sure if much point in 
this check.

Regardless of that:

Reviewed-by: John Garry <[email protected]>

>   
>   	if (ret < 0) {
>   		pr_err("kstrtoul() failed for CHAP identifier: %d\n", ret);