[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230720184721.GC2667611@hu-bjorande-lv.qualcomm.com>
Date: Thu, 20 Jul 2023 11:47:21 -0700
From: Bjorn Andersson <quic_bjorande@...cinc.com>
To: Chengfeng Ye <dg573847474@...il.com>
CC: <agross@...nel.org>, <andersson@...nel.org>,
<konrad.dybcio@...aro.org>, <lee@...nel.org>,
<sboyd@...eaurora.org>, <srinivas.kandagatla@...aro.org>,
<linux-arm-msm@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] mfd: qcom-pm8xxx: Fix potential deadlock on
&chip->pm_irq_lock
On Thu, Jul 20, 2023 at 07:13:30AM +0000, Chengfeng Ye wrote:
> As &chip->pm_irq_lock is acquired by pm8xxx_irq_handler() under irq
> context, other process context code should disable irq before acquiring
> the lock.
>
> Since .irq_set_type and .irq_get_irqchip_state callbacks are generally
> executed from process context without irq disabled by default, the same
> lock acquision should disable irq.
>
> Possible deadlock scenario
> pm8xxx_irq_set_type()
> -> pm8xxx_config_irq()
> -> spin_lock(&chip->pm_irq_lock)
> <irq interrupt>
> -> pm8xxx_irq_handler()
> -> pm8xxx_irq_master_handler()
> -> pm8xxx_irq_block_handler()
> -> pm8xxx_read_block_irq()
> -> spin_lock(&chip->pm_irq_lock) (deadlock here)
>
> This flaw was found using an experimental static analysis tool we are
> developing for irq-related deadlock.
>
> Fix the potential deadlock by spin_lock_irqsave().
>
> Signed-off-by: Chengfeng Ye <dg573847474@...il.com>
Reviewed-by: Bjorn Andersson <quic_bjorande@...cinc.com>
Regards,
Bjorn
Powered by blists - more mailing lists