From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from integral2.. (unknown [36.80.217.41]) by gnuweeb.org (Postfix) with ESMTPSA id CD9D17E3BA; Sun, 17 Apr 2022 18:56:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1650221821; bh=RFtg7BoSogQqJ3qbQ59LPrzum9EvKnWpLcNv0rGtvq4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cqHbTrLAEbwlpZUNB52HM3REYAh3Vg6BVvtWRrGWcCn3b/+Rdd1582v5khnfX3+D6 RTgo/tCZ8fVu7ezeYhY/seTU28SSIHYjJYvVEPUEZ4Um68TCUYcKR9hBmU3jSqwqlV om+uCh1u/EkwJyxzMCKg0l5Zvcr8XvwnSr3QuzdsQfR+z4chfFWvqsyfUzpfOZ97jD KonQKsW9nojWeqZ+OZwMftBynbjx2d1FmTkgD/96nQa8tKruNz8wlCw0GIYugmxO7w 9O2R9lj79n5kmE8qHAFdh9/Ychv3JoUI4Uq4eP4IR626zmMN87Xfvm6mBZZlqpoPj/ qKKHTPTUR/3Gg== From: Ammar Faizi To: Steven Rostedt , Ingo Molnar Cc: Ammar Faizi , GNU/Weeb Mailing List , Linux Kernel Mailing List , Linux Trace Devel Mailing List Subject: [RESEND PATCH 1/2] tracing: Return -EINVAL if WARN_ON(!glob) triggered in event_hist_trigger_parse() Date: Mon, 18 Apr 2022 01:56:29 +0700 Message-Id: <20220417185630.199062-2-ammarfaizi2@gnuweeb.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220417185630.199062-1-ammarfaizi2@gnuweeb.org> References: <20220417185630.199062-1-ammarfaizi2@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: If `WARN_ON(!glob)` is ever triggered, we will still continue executing the next lines. This will trigger the more serious problem, a NULL pointer dereference bug. Just return -EINVAL if @glob is NULL. Signed-off-by: Ammar Faizi --- kernel/trace/trace_events_hist.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index 44db5ba9cabb..0b99ad68e3fa 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -6186,7 +6186,8 @@ static int event_hist_trigger_parse(struct event_command *cmd_ops, lockdep_assert_held(&event_mutex); - WARN_ON(!glob); + if (WARN_ON(!glob)) + return -EINVAL; if (strlen(glob)) { hist_err_clear(); -- Ammar Faizi