On Mon, Mar 17, 2025 at 03:32:51PM -0700, Bart Van Assche wrote: > On 3/17/25 4:01 AM, ZhangHui wrote: > > On Android devices, we found that there is a probability that > > the ufs has been shut down but the thread is still deleting the > > key, which will cause the bus error. > > How does this patch guarantee that crypto keys are evicted before the > UFS driver has been shut down? This should be explained in detail in the > patch description. This modification does not guarantee that ufs has entered shutdown before evicting the key. Drivers should not make assumptions about the behavior of user access. If ufs has entered shutdown, evicting key flow will return -EBUSY. > > Let's fixed this issue by adding a lock in program_key flow. > > There are multiple synchronization objects owned by the UFS driver. Why > 'host_sem' and not any other synchronization object? > The host_sem is held in suspend/resume, shutdown and err hander flow, so I think host_sem is used to mutually exclude host controller power failure and access. thanks zhanghui