From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E37EC001E0 for ; Mon, 23 Oct 2023 11:05:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233272AbjJWLFm (ORCPT ); Mon, 23 Oct 2023 07:05:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233280AbjJWLFl (ORCPT ); Mon, 23 Oct 2023 07:05:41 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68CEED7B for ; Mon, 23 Oct 2023 04:05:39 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD56FC433C7; Mon, 23 Oct 2023 11:05:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1698059139; bh=PcmpkqieuFKhZnlzCbhBWYpPlh0aADngdvPyJGq582I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xkhHeuYlKz36DXyUMsQg1b4NtZqmQnWRX2IABTSYov9dtUt75cPBEtt5w2m99GBeP 4adRz9yV1+WKvV+bv3SBP+r8EkV9CDVRu5J/hAGGIr9qbQXDVWEMgBj2MDRC2dBrhW zFr/W98JYsR4XpTS4uCWbpHGVtf2ulcaLuuawkYQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "wuqiang.matt" , "Masami Hiramatsu (Google)" Subject: [PATCH 6.5 059/241] fprobe: Fix to ensure the number of active retprobes is not zero Date: Mon, 23 Oct 2023 12:54:05 +0200 Message-ID: <20231023104835.349175234@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231023104833.832874523@linuxfoundation.org> References: <20231023104833.832874523@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 6.5-stable review patch. If anyone has any objections, please let me know. ------------------ From: Masami Hiramatsu (Google) commit 700b2b439766e8aab8a7174991198497345bd411 upstream. The number of active retprobes can be zero but it is not acceptable, so return EINVAL error if detected. Link: https://lore.kernel.org/all/169750018550.186853.11198884812017796410.stgit@devnote2/ Reported-by: wuqiang.matt Closes: https://lore.kernel.org/all/20231016222103.cb9f426edc60220eabd8aa6a@kernel.org/ Fixes: 5b0ab78998e3 ("fprobe: Add exit_handler support") Signed-off-by: Masami Hiramatsu (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/fprobe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/kernel/trace/fprobe.c +++ b/kernel/trace/fprobe.c @@ -189,7 +189,7 @@ static int fprobe_init_rethook(struct fp { int i, size; - if (num < 0) + if (num <= 0) return -EINVAL; if (!fp->exit_handler) { @@ -202,8 +202,8 @@ static int fprobe_init_rethook(struct fp size = fp->nr_maxactive; else size = num * num_possible_cpus() * 2; - if (size < 0) - return -E2BIG; + if (size <= 0) + return -EINVAL; fp->rethook = rethook_alloc((void *)fp, fprobe_exit_handler); if (!fp->rethook)