Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4155239pxk; Tue, 8 Sep 2020 12:05:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw47KNyhg6AslXZRPH/CwOWlY1CanhJtVJRct1VfeeE1xn02UnGCFSeUJuCS0TsEB/g13Uo X-Received: by 2002:a17:906:6411:: with SMTP id d17mr9073792ejm.93.1599591932266; Tue, 08 Sep 2020 12:05:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599591932; cv=none; d=google.com; s=arc-20160816; b=Gv3mLZJIaFijETLgMZpxweSjHMt7AjIUjOgwdZWhmL9V2p39kbiwrgLYklNMwDINCt b49YjR4QBCRWOKBipyyU5C2/ygz1joGbryV9cSjO3B7fhcMD9Ak6YB3srFrSYyT9umTi 5xlk3YyiC2FaUg0lJtPaKx57Udoe3nw8sXtOwwy7VXlTKOwU+9UffyPiMm5fS1sLxT3s FC58ClOx4MNEatfPm1gEllYb6RT4KwjACBsg7f+xWO6aBvhQRXK8/PgIrQsCJrOYMKRg Ixx90HnZBmlWo5TGUO7DSt8fPfRWLT11V5jTknX8AyHnrcIqbBSk4nSca24b+tShLQdZ pkqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5P6wxjdD7waPcQd3IpmPCcSgn8W0jyAQmUhBGN2Nw1E=; b=V6PfNhRRcs4kjgNdRFZ2hRvffAyc46dAgmQTtb+urQT6p/4/GyJaayhQ30vubr/EMv xzN0HzQTfoquieKxc+3bM7kNg6dXRM8FsvFE7om8x73IJA796WudzkpBNhypHEcYyOhp Lb25p3WWY0NwEP3wtWlLOYybvRrX/7rQROk+TzOb2gglolzqBeL4GrkNw9gG8zPd4Kpk Sd2RbY5tUy9+9VPFdc5P4vmGPa/ghSqefKTOsVPR8J7C9h+cGQnNnXtLmn3rOVrxeLaC T53XeSZAeFP12Q9uY2X7GIP32zH4WgcBzAkhXdXyjGxOVhluiFyCqS/b/12Rm4RbMDBB SGsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EXMZs8fn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s10si4750331ejr.574.2020.09.08.12.05.09; Tue, 08 Sep 2020 12:05:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EXMZs8fn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731687AbgIHTDT (ORCPT + 99 others); Tue, 8 Sep 2020 15:03:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:53538 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731267AbgIHQH0 (ORCPT ); Tue, 8 Sep 2020 12:07:26 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6575E23E26; Tue, 8 Sep 2020 15:47:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599580028; bh=bmQdkNH3AtKy4aJrZ0hiO2G1mnDDEJjfOONUdQ49HW8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EXMZs8fnm/ai3Eub59ODnLGc6FvEGfThXGFRqzEVPgXvS6xBr8vstD82wNsrmItCA qsqyr+MPl6ImnJCZiiaeAMEkOUClB0fz1r50OKup/RtiOFR2xCY+FyHSdJXs6aMg77 O67hVln+oGa6ZYSDBqDP2J4HLYcilG3f87GekqRc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tejun Heo , Jens Axboe Subject: [PATCH 5.4 110/129] blk-iocost: ioc_pd_free() shouldnt assume irq disabled Date: Tue, 8 Sep 2020 17:25:51 +0200 Message-Id: <20200908152235.335513954@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908152229.689878733@linuxfoundation.org> References: <20200908152229.689878733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tejun Heo 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 Fixes: 7caa47151ab2 ("blkcg: implement blk-iocost") Cc: stable@vger.kernel.org # v5.4+ Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/blk-iocost.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -2074,14 +2074,15 @@ static void ioc_pd_free(struct blkg_poli { 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);