From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:49276 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753665AbdDRMt3 (ORCPT ); Tue, 18 Apr 2017 08:49:29 -0400 Subject: Patch "x86/intel_rdt: Fix locking in rdtgroup_schemata_write()" has been added to the 4.10-stable tree To: jolsa@kernel.org, a.p.zijlstra@chello.nl, efault@gmx.de, fenghua.yu@intel.com, gregkh@linuxfoundation.org, peterz@infradead.org, shli@fb.com, tglx@linutronix.de Cc: , From: Date: Tue, 18 Apr 2017 14:49:00 +0200 Message-ID: <149251974059255@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled x86/intel_rdt: Fix locking in rdtgroup_schemata_write() to the 4.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: x86-intel_rdt-fix-locking-in-rdtgroup_schemata_write.patch and it can be found in the queue-4.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >>From 7f00f388712b29005782bad7e4b25942620f3b9c Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Tue, 11 Apr 2017 09:14:46 +0200 Subject: x86/intel_rdt: Fix locking in rdtgroup_schemata_write() From: Jiri Olsa commit 7f00f388712b29005782bad7e4b25942620f3b9c upstream. The schemata lock is released before freeing the resource's temporary tmp_cbms allocation. That's racy versus another write which allocates and uses new temporary storage, resulting in memory leaks, freeing in use memory, double a free or any combination of those. Move the unlock after the release code. Fixes: 60ec2440c63d ("x86/intel_rdt: Add schemata file") Signed-off-by: Jiri Olsa Cc: Fenghua Yu Cc: Peter Zijlstra Cc: Peter Zijlstra Cc: Mike Galbraith Cc: Shaohua Li Link: http://lkml.kernel.org/r/20170411071446.15241-1-jolsa@kernel.org Signed-off-by: Thomas Gleixner Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/intel_rdt_schemata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/kernel/cpu/intel_rdt_schemata.c +++ b/arch/x86/kernel/cpu/intel_rdt_schemata.c @@ -200,11 +200,11 @@ ssize_t rdtgroup_schemata_write(struct k } out: - rdtgroup_kn_unlock(of->kn); for_each_enabled_rdt_resource(r) { kfree(r->tmp_cbms); r->tmp_cbms = NULL; } + rdtgroup_kn_unlock(of->kn); return ret ?: nbytes; } Patches currently in stable-queue which might be from jolsa@kernel.org are queue-4.10/x86-intel_rdt-fix-locking-in-rdtgroup_schemata_write.patch