From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2AA120B00 for ; Mon, 6 Nov 2023 13:09:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="hX22/2tt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F11EC433C8; Mon, 6 Nov 2023 13:09:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1699276194; bh=309VSENfDluKqrfKZkqNF5iqCL2NeIVeILycttmy4Zo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hX22/2ttvdEbDYLaKWMYkevxAHQgRSCpiBt+8dY+6Ug7Pps2q9tRnh7t2U9Ni6XG7 mu517HLFPPnKrMo1i687cZA67EFtaPgm1nJV+i9vVw3GPk/UhTY88gjl4lUmF6b9Fg sVb9+ClFYO3Z1DLR97fHv40mabN///bOz+RvMySw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dan Carpenter , "Peter Zijlstra (Intel)" , Ingo Molnar Subject: [PATCH 4.19 21/61] perf/core: Fix potential NULL deref Date: Mon, 6 Nov 2023 14:03:17 +0100 Message-ID: <20231106130300.333033585@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231106130259.573843228@linuxfoundation.org> References: <20231106130259.573843228@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Peter Zijlstra commit a71ef31485bb51b846e8db8b3a35e432cc15afb5 upstream. Smatch is awesome. Fixes: 32671e3799ca ("perf: Disallow mis-matched inherited group reads") Reported-by: Dan Carpenter Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- kernel/events/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -11629,7 +11629,8 @@ static int inherit_group(struct perf_eve if (IS_ERR(child_ctr)) return PTR_ERR(child_ctr); } - leader->group_generation = parent_event->group_generation; + if (leader) + leader->group_generation = parent_event->group_generation; return 0; }