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: <26585f80038d25fc6ee9dddf07e66b93@codeaurora.org>
Date:   Thu, 19 Nov 2020 15:14:19 +0800
From:   Can Guo <cang@...eaurora.org>
To:     Stanley Chu <stanley.chu@...iatek.com>
Cc:     linux-scsi@...r.kernel.org, martin.petersen@...cle.com,
        avri.altman@....com, alim.akhtar@...sung.com, jejb@...ux.ibm.com,
        beanhuo@...ron.com, asutoshd@...eaurora.org,
        matthias.bgg@...il.com, bvanassche@....org,
        linux-mediatek@...ts.infradead.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        kuohong.wang@...iatek.com, peter.wang@...iatek.com,
        chun-hung.wu@...iatek.com, andy.teng@...iatek.com,
        chaotian.jing@...iatek.com, cc.chou@...iatek.com,
        jiajie.hao@...iatek.com, alice.chao@...iatek.com
Subject: Re: [PATCH v1] scsi: ufs: Fix race between shutdown and runtime
 resume flow

On 2020-11-19 14:29, Stanley Chu wrote:
> If UFS host device is in runtime-suspended state while
> UFS shutdown callback is invoked, UFS device shall be
> resumed for register accesses. Currently only UFS local
> runtime resume function will be invoked to wake up the host.
> This is not enough because if someone triggers runtime
> resume from block layer, then race may happen between
> shutdown and runtime resume flow, and finally lead to
> unlocked register access.
> 
> To fix this kind of issues, in ufshcd_shutdown(), use
> pm_runtime_get_sync() instead of resuming UFS device by
> ufshcd_runtime_resume() "internally" to let runtime PM
> framework manage the whole resume flow.
> 
> Fixes: 57d104c153d3 ("ufs: add UFS power management support")
> Signed-off-by: Stanley Chu <stanley.chu@...iatek.com>

Reviewed-by: Can Guo <cang@...eaurora.org>

> ---
>  drivers/scsi/ufs/ufshcd.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 80cbce414678..bb16cc04f106 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -8941,11 +8941,7 @@ int ufshcd_shutdown(struct ufs_hba *hba)
>  	if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba))
>  		goto out;
> 
> -	if (pm_runtime_suspended(hba->dev)) {
> -		ret = ufshcd_runtime_resume(hba);
> -		if (ret)
> -			goto out;
> -	}
> +	pm_runtime_get_sync(hba->dev);
> 
>  	ret = ufshcd_suspend(hba, UFS_SHUTDOWN_PM);
>  out:

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ