Re: [PATCH v2 1/2] gpiolib: cdev: Fix &lr->wait.lock deadlock issue

From: andy@xxxxxxxxxx
Date: Mon Jun 26 2023 - 07:02:42 EST


On Mon, Jun 26, 2023 at 10:39:56AM +0000, YE Chengfeng wrote:
> linereq_put_event is called from both interrupt context (e.g.,
> edge_irq_thread) and process context (process_hw_ts_thread).
> Therefore, interrupt should be disabled before acquiring lock
> &lr->wait.lock inside linereq_put_event to avoid deadlock when
> the lock is held in process context and edge_irq_thread comes.
>
> Similarly, linereq_read_unlocked running in process context
> also acquies the same lock. It also need to disable interrupt
> otherwise deadlock could happen if the irq edge_irq_thread
> comes to execution while the lock is held.
>
> Fix the two potential deadlock issues by spin_lock_bh() and
> spin_lock_irq() separately.

Side note: You have two patches in something that seems to be the series,
but lacks the references in email headers. Whenever you send a series,
do not forget to add --thread to `git send-email`.

--
With Best Regards,
Andy Shevchenko