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]
Message-ID: <5fe97f16-406c-c279-b108-d27bb2769ed6@intel.com>
Date:   Tue, 2 Mar 2021 10:14:42 +0200
From:   Adrian Hunter <adrian.hunter@...el.com>
To:     Avri Altman <Avri.Altman@....com>,
        "Martin K . Petersen" <martin.petersen@...cle.com>,
        "James E . J . Bottomley" <jejb@...ux.ibm.com>
Cc:     "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Alim Akhtar <alim.akhtar@...sung.com>,
        Bean Huo <huobean@...il.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 2/03/21 9:01 am, Avri Altman 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>
> I think that CanG recent series addressed that issue as well, can you take a look?
> https://lore.kernel.org/lkml/1614145010-36079-2-git-send-email-cang@codeaurora.org/

Yes, there it is mixed in with other changes.  However it is probably better
as a separate patch.  Can Guo, what do you think?

> 
> 
>> ---
>>  drivers/scsi/ufs/ufshcd.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
>> index 77161750c9fb..91a403afe038 100644
>> --- a/drivers/scsi/ufs/ufshcd.c
>> +++ b/drivers/scsi/ufs/ufshcd.c
>> @@ -7031,6 +7031,8 @@ static int ufshcd_reset_and_restore(struct ufs_hba
>> *hba)
>>         spin_unlock_irqrestore(hba->host->host_lock, flags);
>>
>>         do {
>> +               hba->ufshcd_state = UFSHCD_STATE_RESET;
>> +
>>                 /* Reset the attached device */
>>                 ufshcd_device_reset(hba);
>>
>> --
>> 2.17.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ