Messages in this thread | | | Date | Tue, 05 Jan 2021 09:07:24 +0800 | From | Can Guo <> | Subject | Re: [PATCH 2/2] scsi: ufs: Protect PM ops and err_handler from user access through sysfs |
| |
On 2021-01-05 04:05, Bean Huo wrote: > On Sat, 2021-01-02 at 05:59 -0800, Can Guo wrote: >> + * @shutting_down: flag to check if shutdown has been invoked > > I am not much sure if this flag is need, since once PM going in > shutdown path, what will be returnded by pm_runtime_get_sync()? > > If pm_runtime_get_sync() will fail, just check its return. >
That depends. During/after shutdown, for UFS's case only, pm_runtime_get_sync(hba->dev) will most likely return 0, because it is already RUNTIME_ACTIVE, pm_runtime_get_sync() will directly return 0... meaning you cannot count on it.
Check Stanley's change - https://lore.kernel.org/patchwork/patch/1341389/
Can Guo.
> Hi Rafael > would you please help us confirm this? > > thanks, > Bean > > >> + * @host_sem: semaphore used to serialize concurrent contexts >> * @eh_wq: Workqueue that eh_work works on >> * @eh_work: Worker to handle UFS errors that require s/w attention >> * @eeh_work: Worker to handle exception events >> @@ -751,7 +753,8 @@ struct ufs_hba { >> u32 intr_mask; >> u16 ee_ctrl_mask; >> bool is_powered; >> - struct semaphore eh_sem; >> + bool shutting_down; >> + struct semaphore host_sem;
| |