From patchwork Thu Sep 6 08:05:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Khlebnikov X-Patchwork-Id: 10589989 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4BF5F13BB for ; Thu, 6 Sep 2018 08:05:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F6462A60C for ; Thu, 6 Sep 2018 08:05:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 23ABD2A61E; Thu, 6 Sep 2018 08:05:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 870932A60C for ; Thu, 6 Sep 2018 08:05:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728170AbeIFMkE (ORCPT ); Thu, 6 Sep 2018 08:40:04 -0400 Received: from forwardcorp1o.cmail.yandex.net ([37.9.109.47]:34529 "EHLO forwardcorp1o.cmail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727704AbeIFMkE (ORCPT ); Thu, 6 Sep 2018 08:40:04 -0400 Received: from mxbackcorp1o.mail.yandex.net (mxbackcorp1o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::301]) by forwardcorp1o.cmail.yandex.net (Yandex) with ESMTP id 5F57B20F6E; Thu, 6 Sep 2018 11:05:48 +0300 (MSK) Received: from smtpcorp1j.mail.yandex.net (smtpcorp1j.mail.yandex.net [2a02:6b8:0:1619::137]) by mxbackcorp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id HPtLJuXnAE-5mcSkKYD; Thu, 06 Sep 2018 11:05:48 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1536221148; bh=wesgbHGvb8z/mVqlP4nJEKXvVpfLEYIyDwVg1Hd8XBA=; h=Subject:From:To:Date:Message-ID; b=p3m6VZSzMHJxnqOrKhx/ER+vWXmVFor1rViZqdUTkOaK1IHyfB6LoYAZ1zBJY+sQH 8PS/bOdM8ihXb0JxTeY2BXiIcAlRddu6lVuOE9HNHOFKZOIM79/ZRl5nALjxfRw5RI YRGsCrwwtwwyzc8uwtiCFnXL3t1IcmaEEPo3neQY= Received: from dynamic-red.dhcp.yndx.net (dynamic-red.dhcp.yndx.net [2a02:6b8:0:40c:ac1b:4357:f84c:a04a]) by smtpcorp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id NJ0ediWL8L-5lOq0lcm; Thu, 06 Sep 2018 11:05:47 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1536221148; bh=wesgbHGvb8z/mVqlP4nJEKXvVpfLEYIyDwVg1Hd8XBA=; h=Subject:From:To:Date:Message-ID; b=p3m6VZSzMHJxnqOrKhx/ER+vWXmVFor1rViZqdUTkOaK1IHyfB6LoYAZ1zBJY+sQH 8PS/bOdM8ihXb0JxTeY2BXiIcAlRddu6lVuOE9HNHOFKZOIM79/ZRl5nALjxfRw5RI YRGsCrwwtwwyzc8uwtiCFnXL3t1IcmaEEPo3neQY= Authentication-Results: smtpcorp1j.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Subject: [PATCH] block: bfq: swap puts in bfqg_and_blkg_put From: Konstantin Khlebnikov To: linux-block@vger.kernel.org, Jens Axboe , Paolo Valente , linux-kernel@vger.kernel.org Date: Thu, 06 Sep 2018 11:05:44 +0300 Message-ID: <153622114435.533797.15694137158197822778.stgit@buzz> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix trivial use-after-free. This could be last reference to bfqg. Signed-off-by: Konstantin Khlebnikov Fixes: 8f9bebc33dd7 ("block, bfq: access and cache blkg data only when safe") Acked-by: Paolo Valente --- block/bfq-cgroup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c index 58c6efa9f9a9..9fe5952d117d 100644 --- a/block/bfq-cgroup.c +++ b/block/bfq-cgroup.c @@ -275,9 +275,9 @@ static void bfqg_and_blkg_get(struct bfq_group *bfqg) void bfqg_and_blkg_put(struct bfq_group *bfqg) { - bfqg_put(bfqg); - blkg_put(bfqg_to_blkg(bfqg)); + + bfqg_put(bfqg); } /* @stats = 0 */