Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp49726imu; Thu, 8 Nov 2018 14:34:30 -0800 (PST) X-Google-Smtp-Source: AJdET5eYVZtKnDtqkuL4hZtZCYvcqRudHrLezjWrRRjEjaqLC0CQAkfpVnd8m44rSnITPdh2G+uy X-Received: by 2002:a62:96db:: with SMTP id s88-v6mr6275154pfk.109.1541716470038; Thu, 08 Nov 2018 14:34:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541716470; cv=none; d=google.com; s=arc-20160816; b=NcrhWFkD0Y+kWvK4JL5Muo2sm3VAUd1Ew8ru/dP95DdZfD1RHvwRICfLEUO91Ot6f5 33BQ4kB50SFzYTqrF7EFHe9cSwbJTwm9vfYyMpK7zHA/6emtTtvziqLCC7/yg0nqhgq1 LF6saDJZh3yn0rbG2dabwqqUXwryUoSZIpH6U+9P/CHu091f/xDB4jjklVEEXlbC3ATU q/j+TnS0ZPLVH2gr2AezBhcmtlXA+j7GBeUgjPLtpUNa365KVwLuHxI+kjgqFyl5JQ4b kgIX/nTaQ1Z1b3YYlD/FNva1QbXb9t02Hh89Y0SkDVEldK4TUk84XQ54WU3oZzpIahWb VtqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qQzfl++w3WdMnlklGNhLL5Fet2TWsYOrITSDNhT+n5Q=; b=0p15A8oRYQJw53k2j4Y8ACc/xv7P9b2ewQrh4pepfIbRwXeLGG3/2MHGpdNU0xSOEV aZX4Lkl8XIZbyO//BKIFmHPv1fOiycy2+YqIhZz3OVWvH5NrlLCthCW19VEJbocrQRYm ewPQuhhtfgopQ+3lEIJj1dQkVg7VCnslsoITIExhSszNUew4QCR1ziI9qBJ9BI15eHpY 268Kwi9YerhrdJKTmfCcDvoGRQ+tV2l8tVeEn6FIXaEghRYP80D8NZIESIaI7K54Y0D8 Q9omYXSHx6C4Sgifme35UEw7xhxP0mglZj0tDwyKXtRM/dyGaFYZ6DXNrSgMtdh6c/MC yB5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=q8HSH8sW; 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 u19-v6si5956053pfj.137.2018.11.08.14.34.14; Thu, 08 Nov 2018 14:34:30 -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; dkim=pass header.i=@kernel.org header.s=default header.b=q8HSH8sW; 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 S1727732AbeKIIKS (ORCPT + 99 others); Fri, 9 Nov 2018 03:10:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:56126 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730324AbeKIHhh (ORCPT ); Fri, 9 Nov 2018 02:37:37 -0500 Received: from localhost (unknown [208.72.13.198]) (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 A2C7620818; Thu, 8 Nov 2018 22:00:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541714408; bh=YJgSIwq/FHbuX/oxEIw8zmLh5sJhbf6uRrGthG7iKQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q8HSH8sWjq6kgIAJGcBy6z9zpvyI9xVKQzyYJo1pAa0HmYPfqvG1LbwwwU7QNKjlh dFRQwPmO3HVAatNsoA0bACeKFht0xz+wBDgUT0+2SysjlcsZKTnQPdCLhogii0OBbP MZlAR5gvy2Y/eqqZBkI5jJEWL5RgSs/kRLpIG6JA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leon Yu , Alexander Shishkin , "Peter Zijlstra (Intel)" , Arnaldo Carvalho de Melo , Arnaldo Carvalho de Melo , Jiri Olsa , Linus Torvalds , Stephane Eranian , Thomas Gleixner , Vince Weaver , Ingo Molnar , Sasha Levin Subject: [PATCH 4.4 039/114] perf/core: Dont leak event in the syscall error path Date: Thu, 8 Nov 2018 13:50:54 -0800 Message-Id: <20181108215104.648898045@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108215059.051093652@linuxfoundation.org> References: <20181108215059.051093652@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 201c2f85bd0bc13b712d9c0b3d11251b182e06ae ] In the error path, event_file not being NULL is used to determine whether the event itself still needs to be free'd, so fix it up to avoid leaking. Reported-by: Leon Yu Signed-off-by: Alexander Shishkin Signed-off-by: Peter Zijlstra (Intel) Cc: Arnaldo Carvalho de Melo Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Stephane Eranian Cc: Thomas Gleixner Cc: Vince Weaver Fixes: 130056275ade ("perf: Do not double free") Link: http://lkml.kernel.org/r/87twk06yxp.fsf@ashishki-desk.ger.corp.intel.com Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin --- kernel/events/core.c | 1 + 1 file changed, 1 insertion(+) --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -8532,6 +8532,7 @@ SYSCALL_DEFINE5(perf_event_open, f_flags); if (IS_ERR(event_file)) { err = PTR_ERR(event_file); + event_file = NULL; goto err_context; }