Message ID | 20200203161918.178616188@linuxfoundation.org |
---|---|
State | Superseded |
Headers | show
Return-Path: <SRS0=s+JW=3X=vger.kernel.org=stable-owner@kernel.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95001C35247 for <stable@archiver.kernel.org>; Mon, 3 Feb 2020 16:41:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5C5B120838 for <stable@archiver.kernel.org>; Mon, 3 Feb 2020 16:41:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580748113; bh=xYuZxASDJzRdJFvffnSMjjcEVkeHubuXhswIAaTn+kI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=jqMPYyRnTpLat+sbh9MSyPONhFBEUt5mOrTiJziCu6GdpUeqXUDq+r7cwr4PN94Bl t8lEEkVZr9eUM7oQU/DlnBe3MSwMfyDU8dEvPQj+sX5Ofg5TOnZMht75vX6lTbaa5b AsEWWuD+p0A4o3yJJK2ahDl/NvRtIlcCDKxO1abo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730771AbgBCQeU (ORCPT <rfc822;stable@archiver.kernel.org>); Mon, 3 Feb 2020 11:34:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:48602 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730466AbgBCQeT (ORCPT <rfc822;stable@vger.kernel.org>); Mon, 3 Feb 2020 11:34:19 -0500 Received: from localhost (unknown [104.132.45.99]) (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 C410421775; Mon, 3 Feb 2020 16:34:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580747658; bh=xYuZxASDJzRdJFvffnSMjjcEVkeHubuXhswIAaTn+kI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IS6nS03pV+alyfKdAxN9/KnTlCRia1gLbctAPUEMoBoFCoDsxki57e7AzdgEJ3+FS GtvD+218BTIdFt2X8utu2aXdHUjtQJdBLgCd+OSENwSmoX1ftYbpRgCJZ3Y9XFHVHd em0dQvZ2u+mOa+4DRKIaYn3/B6reeGeOYwVZJvgo= From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, stable@vger.kernel.org, Reinette Chatre <reinette.chatre@intel.com>, Xiaochen Shen <xiaochen.shen@intel.com>, Borislav Petkov <bp@suse.de>, Tony Luck <tony.luck@intel.com>, Thomas Gleixner <tglx@linutronix.de>, Sasha Levin <sashal@kernel.org> Subject: [PATCH 5.4 04/90] x86/resctrl: Fix use-after-free when deleting resource groups Date: Mon, 3 Feb 2020 16:19:07 +0000 Message-Id: <20200203161918.178616188@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200203161917.612554987@linuxfoundation.org> References: <20200203161917.612554987@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: <stable.vger.kernel.org> X-Mailing-List: stable@vger.kernel.org |
Series |
None
|
expand
|
diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index e4da26325e3ea..c7564294a12a8 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -2205,7 +2205,11 @@ static void free_all_child_rdtgrp(struct rdtgroup *rdtgrp) list_for_each_entry_safe(sentry, stmp, head, mon.crdtgrp_list) { free_rmid(sentry->mon.rmid); list_del(&sentry->mon.crdtgrp_list); - kfree(sentry); + + if (atomic_read(&sentry->waitcount) != 0) + sentry->flags = RDT_DELETED; + else + kfree(sentry); } } @@ -2243,7 +2247,11 @@ static void rmdir_all_sub(void) kernfs_remove(rdtgrp->kn); list_del(&rdtgrp->rdtgroup_list); - kfree(rdtgrp); + + if (atomic_read(&rdtgrp->waitcount) != 0) + rdtgrp->flags = RDT_DELETED; + else + kfree(rdtgrp); } /* Notify online CPUs to update per cpu storage and PQR_ASSOC MSR */ update_closid_rmid(cpu_online_mask, &rdtgroup_default);