Received: by 10.223.176.5 with SMTP id f5csp991330wra; Fri, 2 Feb 2018 09:21:12 -0800 (PST) X-Google-Smtp-Source: AH8x2255XRt313fJJOu6dk0y0a2gzzc4dGBjJe8eVoGTrnNgbShu8rLy5ygLXMWlUlKsJeciHoky X-Received: by 10.101.69.141 with SMTP id o13mr32663086pgq.204.1517592072699; Fri, 02 Feb 2018 09:21:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517592072; cv=none; d=google.com; s=arc-20160816; b=DKYhYGkMyRTaSRdjGjugGHZskIOjnRFFaRYBQ6hEoeDw/p6n6+bbfAlaxtb920VFXp ZMEcfj48EkC3mtaIrURgJ0LzFMPXL4dqtKcPv9M3H81Hi/VGUcGag9pA4JnZFTy+voyT NqaGIaTIc9/0DyEzEyfqz1aUusgYFJjxdAWLoJmcSIGeJ+MwvO6P8ibaxwF+Tmkudj+C frKwyOuokp2DN69ltSHDQVkzydRe74H1y9ybuqKYEFyBxzck+O/C2m8J9kgwLDtyvxVX qAHTGt6dF8l8R4kOgiDjmsgkbMZPWJ5qxdeBGuLp2Ljuwp36cCL/LJBGd0sJUA+ATBsZ pieg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=fWWMvpKlsqSxrUGFE4wQbAHZclU8DHj2OLJcyo8Ny6A=; b=hNs9iHCuE5uNX36cof+KCnomfSku/JpuIPHlb+nkAOYeyWdbYzpbpKdn+KZwplHF0D /5UVwaj+z6R/ezPLm345UBshE8sV53lFM/Trz86h6fTZhYoKzmJf+E21YwC3pGtnedeQ Wlz7VtxgrzhBudZIU3uw0cVrKf5LubtQqVhef/jsy8BBxi9JWCQ/74mxQf3fbM91/mcS XW4jGr226evr2ZF+RMpALozLgN95+25Rq8bqgtQZitVVvYMJtnlOy1C8ohPx1QN8oubv ho+YDrsyEhhhWpkFrjcHhwmf8CcDs2HACGMZiOl3A3O3p+dAIFCEcU1kYLF9aZYpK4ln ZEyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g3-v6si2105154pld.270.2018.02.02.09.20.58; Fri, 02 Feb 2018 09:21:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752573AbeBBRT6 (ORCPT + 99 others); Fri, 2 Feb 2018 12:19:58 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:38980 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753458AbeBBRMW (ORCPT ); Fri, 2 Feb 2018 12:12:22 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 319B6EF7; Fri, 2 Feb 2018 17:12:21 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vasily Averin , Peter Zijlstra , Alexander Shishkin , Arnaldo Carvalho de Melo , Hari Bathini , Jiri Olsa , Linus Torvalds , Namhyung Kim , Thomas Gleixner , Ingo Molnar , Sasha Levin Subject: [PATCH 4.14 116/156] perf/core: Fix memory leak triggered by perf --namespace Date: Fri, 2 Feb 2018 17:58:17 +0100 Message-Id: <20180202140845.420181724@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140840.242829545@linuxfoundation.org> References: <20180202140840.242829545@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Vasily Averin [ Upstream commit 0e18dd12064e07519f7cbff4149ca7fff620cbed ] perf with --namespace key leaks various memory objects including namespaces 4.14.0+ pid_namespace 1 12 2568 12 8 user_namespace 1 39 824 39 8 net_namespace 1 5 6272 5 8 This happen because perf_fill_ns_link_info() struct patch ns_path: during initialization ns_path incremented counters on related mnt and dentry, but without lost path_put nobody decremented them back. Leaked dentry is name of related namespace, and its leak does not allow to free unused namespace. Signed-off-by: Vasily Averin Acked-by: Peter Zijlstra Cc: Alexander Shishkin Cc: Arnaldo Carvalho de Melo Cc: Hari Bathini Cc: Jiri Olsa Cc: Linus Torvalds Cc: Namhyung Kim Cc: Thomas Gleixner Fixes: commit e422267322cd ("perf: Add PERF_RECORD_NAMESPACES to include namespaces related info") Link: http://lkml.kernel.org/r/c510711b-3904-e5e1-d296-61273d21118d@virtuozzo.com Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- kernel/events/core.c | 1 + 1 file changed, 1 insertion(+) --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -6756,6 +6756,7 @@ static void perf_fill_ns_link_info(struc ns_inode = ns_path.dentry->d_inode; ns_link_info->dev = new_encode_dev(ns_inode->i_sb->s_dev); ns_link_info->ino = ns_inode->i_ino; + path_put(&ns_path); } }