lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1458489135-5016-1-git-send-email-chianglungyu@gmail.com>
Date:	Sun, 20 Mar 2016 23:52:15 +0800
From:	Leon Yu <chianglungyu@...il.com>
To:	linux-kernel@...r.kernel.org
Cc:	Leon Yu <chianglungyu@...il.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...hat.com>,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
	<stable@...r.kernel.org>
Subject: [PATCH] perf: fix event leak when perf_event_open() failed to create event_file

If something went wrong in anon_inode_getfile, event_file will be set to
non-zero error number and able to bypass the NULL test afterward.

Consolidate the error path by testing event_file with handly
IS_ERR_OR_NULL() helper since we do want to free event in both cases.

Signed-off-by: Leon Yu <chianglungyu@...il.com>
Fixes: 130056275ade ("perf: Do not double free")
Cc: <stable@...r.kernel.org> # v4.5
---
 kernel/events/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 6146148..5f2e19f 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -8617,7 +8617,7 @@ err_alloc:
 	 * If event_file is set, the fput() above will have called ->release()
 	 * and that will take care of freeing the event.
 	 */
-	if (!event_file)
+	if (IS_ERR_OR_NULL(event_file))
 		free_event(event);
 err_cpus:
 	put_online_cpus();
-- 
2.7.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ