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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 01 Mar 2021 21:46:40 +0100
From:   Bean Huo <huobean@...il.com>
To:     Adrian Hunter <adrian.hunter@...el.com>,
        "Martin K . Petersen" <martin.petersen@...cle.com>,
        "James E . J . Bottomley" <jejb@...ux.ibm.com>
Cc:     linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
        Alim Akhtar <alim.akhtar@...sung.com>,
        Avri Altman <avri.altman@....com>,
        Can Guo <cang@...eaurora.org>,
        Asutosh Das <asutoshd@...eaurora.org>,
        Stanley Chu <stanley.chu@...iatek.com>
Subject: Re: [PATCH] scsi: ufs: Fix incorrect ufshcd_state after
 ufshcd_reset_and_restore()

On Mon, 2021-03-01 at 21:19 +0200, Adrian Hunter wrote:
> If ufshcd_probe_hba() fails it sets ufshcd_state to
> UFSHCD_STATE_ERROR,
> however, if it is called again, as it is within a loop in
> ufshcd_reset_and_restore(), and succeeds, then it will not set the
> state
> back to UFSHCD_STATE_OPERATIONAL unless the state was
> UFSHCD_STATE_RESET.
> 
> That can result in the state being UFSHCD_STATE_ERROR even though
> ufshcd_reset_and_restore() is successful and returns zero.
> 
> Fix by initializing the state to UFSHCD_STATE_RESET in the start of
> each
> loop in ufshcd_reset_and_restore().  If there is an error,
> ufshcd_reset_and_restore() will change the state to
> UFSHCD_STATE_ERROR,
> otherwise ufshcd_probe_hba() will have set the state appropriately.
> 
> Fixes: 4db7a2360597 ("scsi: ufs: Fix concurrency of error handler and
> other error recovery paths")
> Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>

We used to directly set hba->ufshcd_state = UFSHCD_STATE_OPERATIONAL at
the beginning of ufshcd_probe_hba(), and didn't have checkup if (hba-
>ufshcd_state == UFSHCD_STATE_RESET). Remove this checkup, also works,
but in This loop, it it better that, before going to reset flow,
ufshcd_state should be set UFSHCD_STATE_RESET.


Reviewed-by: Bean Huo <beanhuo@...ron.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ