Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp829339ybl; Wed, 11 Dec 2019 08:08:03 -0800 (PST) X-Google-Smtp-Source: APXvYqzfx07y8RJuLflGYqrpIKyJ9koOAyg2FgLa33inHLUA71M8vW4HAar1kPE1PlYzBYAt2TA6 X-Received: by 2002:a54:460c:: with SMTP id p12mr3483935oip.18.1576080483220; Wed, 11 Dec 2019 08:08:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576080483; cv=none; d=google.com; s=arc-20160816; b=W8sWTXofqcilWGAvqfV1CJtT+a4d3LU2gbyaYu143bkZM+JQbo71RQ5hEkKRxH9DPs /Jg/4E/Yd8NDPsChgVRDZasBFkwjl7xS02M0kO0GYk2pN6J/3xZ4PMf1vE4/B5rTGdjn sdGyYE+JEzmBu2gEwbfjYdtSzJihv5N+jaEdSjQZNZ0WB98dbdLmGVH9sO9LxTy9rOhw d9TTZdR8cahLdMwnygcShueL21placoIQOQleCR9awSTDozU9ySxD/fGlEB7vi7ESt2X CVrJ4UjIcSGCFWdH3iUfY+ttzbHgQ0oluOGPCS9R6xuK1vrYbAUUUUafzlrVgTRfWdIE mt9A== 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=tu4HYy2m32GB6wMAGpxCnh93NGNEzADp1dEkQjBqYW8=; b=knwZB2Mpj8p+8vYz6dXUgqOHGjBRWouHm8Z4VeivBG6hMnPYin+JjTxOvUFyPnxVGk wVHB/FAQ3T46Tk5wN7vQ4qr7e9QjSvmZM6JqkN8ZPQH9oxHMI6j75UnG2ZTUJ9G3FVfn vjb4kBP8JuZetOG7SDYCuXlS/ke3Et6qBYd4fKIKtqzqN/vF+WMaI93JfK9G9sQlIFFZ BttotsU6U0Z6tkXRwvKrznU37euPF5deNRktU5xqc2gBNndb7MkXTth/LByoPEJYYmCP rJ5nrPWNp6kCIX8zitrSfACKC2wBsvQ7qN0YXxAZ+i5KMOKGAhO9RcFRui3kXtaP2Ki+ 8RQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DoGOnSbD; 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 l84si1365100oig.5.2019.12.11.08.07.51; Wed, 11 Dec 2019 08:08:03 -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=DoGOnSbD; 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 S1731192AbfLKPMi (ORCPT + 99 others); Wed, 11 Dec 2019 10:12:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:33728 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731095AbfLKPMV (ORCPT ); Wed, 11 Dec 2019 10:12:21 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 E3E3424654; Wed, 11 Dec 2019 15:12:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077140; bh=3+7wmKB4YLchn/gq4IOx0SBRYWWn2klYIBGCU1dHamg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DoGOnSbDPDSoeQvkpA2CflPacQ+tice8Ok3UM56rJ+z6tKykCoMeThda4/sYOIqVQ gpJY+3JtehaQsURp4yW5HRKsFE0yQ/ydEPSh2AxoBaXiwNA7S83HqhgympBx3IIElP ft3tc7AdDTJ519R/cnecCzU7Fb4Vt2lwzQbs1XNo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Shishkin , "Peter Zijlstra (Intel)" , Arnaldo Carvalho de Melo , David Ahern , Jiri Olsa , Jiri Olsa , Linus Torvalds , Mark Rutland , Namhyung Kim , Stephane Eranian , Thomas Gleixner , Vince Weaver , Ingo Molnar , Sasha Levin Subject: [PATCH 5.3 031/105] perf/core: Consistently fail fork on allocation failures Date: Wed, 11 Dec 2019 16:05:20 +0100 Message-Id: <20191211150231.320144857@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150221.153659747@linuxfoundation.org> References: <20191211150221.153659747@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Alexander Shishkin [ Upstream commit 697d877849d4b34ab58d7078d6930bad0ef6fc66 ] Commit: 313ccb9615948 ("perf: Allocate context task_ctx_data for child event") makes the inherit path skip over the current event in case of task_ctx_data allocation failure. This, however, is inconsistent with allocation failures in perf_event_alloc(), which would abort the fork. Correct this by returning an error code on task_ctx_data allocation failure and failing the fork in that case. Signed-off-by: Alexander Shishkin Signed-off-by: Peter Zijlstra (Intel) Cc: Arnaldo Carvalho de Melo Cc: David Ahern Cc: Jiri Olsa Cc: Jiri Olsa Cc: Linus Torvalds Cc: Mark Rutland Cc: Namhyung Kim Cc: Stephane Eranian Cc: Thomas Gleixner Cc: Vince Weaver Link: https://lkml.kernel.org/r/20191105075702.60319-1-alexander.shishkin@linux.intel.com Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin --- 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 53173883513c1..25942e43b8d48 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -11719,7 +11719,7 @@ inherit_event(struct perf_event *parent_event, GFP_KERNEL); if (!child_ctx->task_ctx_data) { free_event(child_event); - return NULL; + return ERR_PTR(-ENOMEM); } } -- 2.20.1