From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753347AbdCNU4P (ORCPT ); Tue, 14 Mar 2017 16:56:15 -0400 Received: from terminus.zytor.com ([65.50.211.136]:50014 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752191AbdCNU4M (ORCPT ); Tue, 14 Mar 2017 16:56:12 -0400 Date: Tue, 14 Mar 2017 13:55:16 -0700 From: tip-bot for Jiri Olsa Message-ID: Cc: hpa@zytor.com, tglx@linutronix.de, peterz@infradead.org, fenghua.yu@intel.com, shli@fb.com, a.p.zijlstra@chello.nl, linux-kernel@vger.kernel.org, mingo@kernel.org, efault@gmx.de, jolsa@kernel.org Reply-To: fenghua.yu@intel.com, shli@fb.com, mingo@kernel.org, linux-kernel@vger.kernel.org, a.p.zijlstra@chello.nl, efault@gmx.de, jolsa@kernel.org, hpa@zytor.com, tglx@linutronix.de, peterz@infradead.org In-Reply-To: <1489501253-20248-1-git-send-email-jolsa@kernel.org> References: <1489501253-20248-1-git-send-email-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/intel_rdt: Put group node in rdtgroup_kn_unlock Git-Commit-ID: 49ec8f5b6ae3ab60385492cad900ffc8a523c895 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 49ec8f5b6ae3ab60385492cad900ffc8a523c895 Gitweb: http://git.kernel.org/tip/49ec8f5b6ae3ab60385492cad900ffc8a523c895 Author: Jiri Olsa AuthorDate: Tue, 14 Mar 2017 15:20:53 +0100 Committer: Thomas Gleixner CommitDate: Tue, 14 Mar 2017 21:51:58 +0100 x86/intel_rdt: Put group node in rdtgroup_kn_unlock The rdtgroup_kn_unlock waits for the last user to release and put its node. But it's calling kernfs_put on the node which calls the rdtgroup_kn_unlock, which might not be the group's directory node, but another group's file node. This race could be easily reproduced by running 2 instances of following script: mount -t resctrl resctrl /sys/fs/resctrl/ pushd /sys/fs/resctrl/ mkdir krava echo "krava" > krava/schemata rmdir krava popd umount /sys/fs/resctrl It triggers the slub debug error message with following command line config: slub_debug=,kernfs_node_cache. Call kernfs_put on the group's node to fix it. Fixes: 60cf5e101fd4 ("x86/intel_rdt: Add mkdir to resctrl file system") Signed-off-by: Jiri Olsa Cc: Fenghua Yu Cc: Peter Zijlstra Cc: Peter Zijlstra Cc: Mike Galbraith Cc: Shaohua Li Cc: stable@vger.kernel.org Link: http://lkml.kernel.org/r/1489501253-20248-1-git-send-email-jolsa@kernel.org Signed-off-by: Thomas Gleixner --- arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c index c05509d..9ac2a5c 100644 --- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c @@ -727,7 +727,7 @@ void rdtgroup_kn_unlock(struct kernfs_node *kn) if (atomic_dec_and_test(&rdtgrp->waitcount) && (rdtgrp->flags & RDT_DELETED)) { kernfs_unbreak_active_protection(kn); - kernfs_put(kn); + kernfs_put(rdtgrp->kn); kfree(rdtgrp); } else { kernfs_unbreak_active_protection(kn);