aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2020-09-01 14:52:31 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-09-09 19:14:30 +0200
commit70d22582c3eb6d50c30574019777d546fbd5cc81 (patch)
tree4d768ef643cecf2e0f78e5d23917a82f65f7f036
parent57fd9f8eb60389e645256b17fce50b29b0f869ee (diff)
downloadlinux-yocto-70d22582c3eb6d50c30574019777d546fbd5cc81.tar.gz
linux-yocto-70d22582c3eb6d50c30574019777d546fbd5cc81.tar.bz2
linux-yocto-70d22582c3eb6d50c30574019777d546fbd5cc81.zip
blk-iocost: ioc_pd_free() shouldn't assume irq disabled
commit 5aeac7c4b16069aae49005f0a8d4526baa83341b upstream. ioc_pd_free() grabs irq-safe ioc->lock without ensuring that irq is disabled when it can be called with irq disabled or enabled. This has a small chance of causing A-A deadlocks and triggers lockdep splats. Use irqsave operations instead. Signed-off-by: Tejun Heo <tj@kernel.org> Fixes: 7caa47151ab2 ("blkcg: implement blk-iocost") Cc: stable@vger.kernel.org # v5.4+ Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--block/blk-iocost.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/block/blk-iocost.c b/block/blk-iocost.c
index 86ba6fd254e1..27c05e3caf75 100644
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -2094,14 +2094,15 @@ static void ioc_pd_free(struct blkg_policy_data *pd)
{
struct ioc_gq *iocg = pd_to_iocg(pd);
struct ioc *ioc = iocg->ioc;
+ unsigned long flags;
if (ioc) {
- spin_lock(&ioc->lock);
+ spin_lock_irqsave(&ioc->lock, flags);
if (!list_empty(&iocg->active_list)) {
propagate_active_weight(iocg, 0, 0);
list_del_init(&iocg->active_list);
}
- spin_unlock(&ioc->lock);
+ spin_unlock_irqrestore(&ioc->lock, flags);
hrtimer_cancel(&iocg->waitq_timer);
hrtimer_cancel(&iocg->delay_timer);