From patchwork Tue Oct 24 10:24:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 157369 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1841955vqx; Tue, 24 Oct 2023 03:24:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IESHKM7u8qYn3LGKISmTWmZ0bjjQGjF2GWpJHWhJrWWhdtw3qqq/LarWawZkJ9OXCu5ahCJ X-Received: by 2002:a05:6870:8585:b0:1e9:c2b7:2c99 with SMTP id f5-20020a056870858500b001e9c2b72c99mr13124124oal.33.1698143065032; Tue, 24 Oct 2023 03:24:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698143064; cv=none; d=google.com; s=arc-20160816; b=Gz/d5iKzVkQC+OKVqLtBCl/KjHPVV4OWzux+cv7rHaulOGgks/qzMIjRUrjnlO1xtZ m5Mudd0m9JnsfAfE7fLCR1Yqj7q9s4DtQMI7DsvIPPTVX2t7cj5kURVu661oobyZ80S/ 66nz6IXE4Yb4Ht5s6+V6S6oyrhB4wAQp0LnPBIUwMHQ2HVAnYEoY4rECMS0w99Oed0c4 DG43O3kpuGjfSZHxqDMveh2DeLzm/7TY1qBHbR6n2LokWtRk9H2gIdSxqSm7IOjFL81r CTUHdVf2CmeEz1y0UKEgvBM6r5oua+FWPLbwJrJepYpB4gPrPM9V/SxBgNRkGSJM2Jrr CoMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:cc:subject:to:reply-to:sender:from :dkim-signature:dkim-signature:date; bh=28aCRziD+yYu6Y2lzKh3gDPEavBxokK82RLhoT7NNw0=; fh=XNCctox6uLNxVqn5LEyBPQTXJdERXSqjtLaZ4hO6j/A=; b=nztzx/hjxY9GJn8Zr6pWn8wsvGu9L6o38coBgsRoi3pK82RHWflqwKWnQvOX/vYFh7 FE8fbmhS/5xHleHzAW8AnTb/SsJoCfhVpNUWHdbz5hFP/V0UzT3dqIMYkYBkqCYr9nw4 f1dWbeRN1/qDDa1d+am0BnPj209MJju4++k7E7uEYyECUYgJm4LvimkyJKD3v4v/8oB9 LJBkYiSgurLUqqJuicWR161wZEgTDY+Zj84NyB7AO4/Pa2KYf1z0vEo4pa0/70YP5w37 qPINwSkIi6FvAK3wA24n+mZwDU51qH28LWwsRFCcVUyTDb+90F72DMEXRYLMZXaJjEGd I1bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=k0j4X3y0; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id 20-20020a630114000000b005aa0e024d60si7926159pgb.25.2023.10.24.03.24.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 03:24:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=k0j4X3y0; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 34ADE803028A; Tue, 24 Oct 2023 03:24:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234306AbjJXKYW (ORCPT + 26 others); Tue, 24 Oct 2023 06:24:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234342AbjJXKYU (ORCPT ); Tue, 24 Oct 2023 06:24:20 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E54C109; Tue, 24 Oct 2023 03:24:18 -0700 (PDT) Date: Tue, 24 Oct 2023 10:24:15 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1698143056; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=28aCRziD+yYu6Y2lzKh3gDPEavBxokK82RLhoT7NNw0=; b=k0j4X3y0RWj8F8IZfJzspiSy22wT9AtOeRwUc2Gdo0hQDKVsvUyU1ijt6GNQ+Ve+mNQwHU Q2tpu9/HOqli7hBVCPwglmVhisiskrtj6lu8EuO+MPNRBNly/KyGIooWkGdR1relQrpO/b MlhPY/sPZJfvYYwQ8DcvZMgZjGhthUzUQEIfj8WV7NNuYO150UVLVhxhRXMO5AcjxdXuN6 6jhRqH2G7dGeACtH3foMjuXFjQYms1ayu5kfPOlJ8st5azQU/FWmAGkNRxvUftfjm755dR bccTpoY/zVDJ3tz6JbyyfSa3G4XRGr7PeckjLkzhDKqwEIqsJJvu6jfwa84UfQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1698143056; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=28aCRziD+yYu6Y2lzKh3gDPEavBxokK82RLhoT7NNw0=; b=AHNaJxUx0HOXnZm6Ab6cfR/0xHMsawNipE4JRLeg1BB4njUhJ5jgXuWR8eqQ/rTBemxIbM 0yNIn+7AexaI2/Cw== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/urgent] perf/core: Fix potential NULL deref Cc: Dan Carpenter , "Peter Zijlstra (Intel)" , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-ID: <169814305576.3135.13128124905427948151.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 24 Oct 2023 03:24:24 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780632062278750467 X-GMAIL-MSGID: 1780632062278750467 The following commit has been merged into the perf/urgent branch of tip: Commit-ID: a71ef31485bb51b846e8db8b3a35e432cc15afb5 Gitweb: https://git.kernel.org/tip/a71ef31485bb51b846e8db8b3a35e432cc15afb5 Author: Peter Zijlstra AuthorDate: Tue, 24 Oct 2023 11:42:21 +02:00 Committer: Ingo Molnar CommitterDate: Tue, 24 Oct 2023 12:15:12 +02:00 perf/core: Fix potential NULL deref 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 --- kernel/events/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index d0663b9..a2f2a95 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -13372,7 +13372,8 @@ static int inherit_group(struct perf_event *parent_event, !perf_get_aux_event(child_ctr, leader)) return -EINVAL; } - leader->group_generation = parent_event->group_generation; + if (leader) + leader->group_generation = parent_event->group_generation; return 0; }