lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6890bec9-df97-fe42-a2b4-0b8ce1701464@quicinc.com>
Date:   Thu, 1 Jun 2023 04:32:06 -0700
From:   "Bao D. Nguyen" <quic_nguyenb@...cinc.com>
To:     <quic_asutoshd@...cinc.com>, <quic_cang@...cinc.com>,
        <bvanassche@....org>, <mani@...nel.org>,
        <stanley.chu@...iatek.com>, <adrian.hunter@...el.com>,
        <beanhuo@...ron.com>, <avri.altman@....com>,
        <martin.petersen@...cle.com>
CC:     <linux-scsi@...r.kernel.org>,
        Alim Akhtar <alim.akhtar@...sung.com>,
        "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        Alice Chao <alice.chao@...iatek.com>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1 1/1] ufs: mcq: Fix the variable wraparound logic

Please ignore this duplicate patch. My apologies.

Thanks,
Bao

On 6/1/2023 4:27 AM, Bao D. Nguyen wrote:
> If the hwq's queue depth is not a multiple of 4s, the
> logic used for wrapping around the increase-by-1 sq_head_slot
> variable in ufshcd_mcq_sqe_search() will give an incorrect
> result because the binary expression of the mask is not
> a uniform of all 1s.
> 
> Signed-off-by: Bao D. Nguyen <quic_nguyenb@...cinc.com>
> ---
>   drivers/ufs/core/ufs-mcq.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
> index 66ac02e..8e5bc88 100644
> --- a/drivers/ufs/core/ufs-mcq.c
> +++ b/drivers/ufs/core/ufs-mcq.c
> @@ -585,7 +585,6 @@ static bool ufshcd_mcq_sqe_search(struct ufs_hba *hba,
>   {
>   	struct ufshcd_lrb *lrbp = &hba->lrb[task_tag];
>   	struct utp_transfer_req_desc *utrd;
> -	u32 mask = hwq->max_entries - 1;
>   	__le64  cmd_desc_base_addr;
>   	bool ret = false;
>   	u64 addr, match;
> @@ -610,7 +609,10 @@ static bool ufshcd_mcq_sqe_search(struct ufs_hba *hba,
>   			ret = true;
>   			goto out;
>   		}
> -		sq_head_slot = (sq_head_slot + 1) & mask;
> +
> +		sq_head_slot++;
> +		if (sq_head_slot == hwq->max_entries)
> +			sq_head_slot = 0;
>   	}
>   
>   out:

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ