From nobody Thu Apr 9 21:50:52 2026 Received: from mail-dy1-f182.google.com (mail-dy1-f182.google.com [74.125.82.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E52FB385536 for ; Thu, 5 Mar 2026 16:36:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772728600; cv=none; b=m3X9nyijwyNEzDJLA5BFTJOq3o7XvsuDchvHhJNGAXSfikbRNK2VKTHvD1Xg7DSRzX1vMgb7hLSLVhcARnC53ZZxkTtJV6XJjnOhRp6J97QVSaYehhV25AIHwEzsNoMLKFyMtsMQPf5Q1/nb6wnnFzuau0qf7cmnMPNBwuRBPLI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772728600; c=relaxed/simple; bh=v118AX4HgprhO+qT/qoHmaGVhCeIdzF+22JtJi09CxY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=dXBddHXZIq8NcSbMs4uS2KqZX9U2xYIl+WWLsy/Va8Y2Ll7nMBP7yMAYrJzB69eHCLJf/Gj5puLOGefqrrSHrV63hw6S/bpSTWARSpyM/1q3gjp4u2OX2tv/mo1aM9eMaQPl04PU7Td5hPNUC1wfiW9k4VIFDndG77XSXBibyrU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OE183bDJ; arc=none smtp.client-ip=74.125.82.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OE183bDJ" Received: by mail-dy1-f182.google.com with SMTP id 5a478bee46e88-2bdd40d3c61so6778706eec.1 for ; Thu, 05 Mar 2026 08:36:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772728597; x=1773333397; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:from:to:cc:subject:date:message-id:reply-to; bh=+qaTlCrAMtHhaECSWz0WgyhgJNAs6je+1lHpGDkkHuY=; b=OE183bDJZ20bDKLvukZRLSuc/xq2ORZxvjYBP5d/k9IkXLxd/Tcb1l5v6LbVjODR4O yp+nxEwgxdIrfZHWz4+D8i12xVnD6yzMQOAmfB8bsWanp8i/V8ISGguCaQZgKLQreWLO b1TxantayTSdjwehSTfTk2mggYiq0Fy7Z+Cd7ivJN1EdHXoDpkeR0tIX9pU8VTgLBqAa q5LLcLvYR0TX0EOxR7RM79pDKEwQGSRWn6GWjSoeNt0kubrSCUiI0X3nFWqjpmSXJZ+x 1nQ8GY66R/S4P17yj7O50I4KKHbbqEDwamFvl6XawOuJQQapU2RZYY1w5YR1IUtCfHm1 w0Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772728597; x=1773333397; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=+qaTlCrAMtHhaECSWz0WgyhgJNAs6je+1lHpGDkkHuY=; b=o/9tRIb6ESwpf7Y/FQ+yctS70Yx9BHjzH3SNLWozOLsf/9H0kQ+/KfvEI54bC9BFVB L8Y8vkGFunNJ7azcDyTVrXr7nvuqT0HekeAxtr1eJResTYsbRSxXEZhRMVdINjhSkqIf lwcmBBxocHsxS2nC6ixUBipRMbl/z6fFFC/Fgy9s031FrFlF8BU5OCve4qVGZtS2DQWS wYVm1ywEMPcexy4DgMVfOcc7eiceHkq6XgnMHo9FF0KpMQWQCo7t+pStTCUaE01YclLm Z4Rq0EHM7lakZTcjxSCEg977dSttQ2yFoNnpYK7IfNQ9rjljo7PlvR9Y08H5VTama4fl WW1w== X-Forwarded-Encrypted: i=1; AJvYcCU7u6YW/2chan04j1pTedHBTToadDERoiYYb9pIbSdaCJ4W/LJcLhTqfHh1FUmCgf8B0PfWAmdsrh0IRzo=@vger.kernel.org X-Gm-Message-State: AOJu0Ywf4U7nXs+tKe9Ocqq8YtWPxvV2pULHxo+ue/OtkGecUPVoWAp5 7yorW+YCawYcvgQq0p8TS6vDRhz7dcTl16YgGO9fRnS0bsO4+C0kvKLD4HNCQrMx X-Gm-Gg: ATEYQzzZoPZPvVdeY/VoybZ18qVz57S4ZAgZX4IWQNtO6BN1bPdLot2zSES425lz7dE S+eN+2fck7+cUVpmIqna0jrXrDcD8TYlg+tBxPr19A51pvaJNDb6en0LjD0KCQl8b63HOdH1TqP 9/4oGo4BN+5ES6d3braCUw6QJPxPdcnO7DEkYd5hBEdIiWkd/npBYH8hA+wOcgG5E/EZh+Kjw6A ighxrOGsly28shyHldD5NfwwtazB8x8Qx+QYZeaEL37QDobeo1kJBFz5kCM4bypmN/lbZfp6YKX ufYG+RLnMolwQlZRsuC75R0qtp8OC7zgFB7FTKPd92YpFYNU3XjQH6Zz8AyLlQZxNuZqGPuy0qA zVmE51u0YcHHtbHy4eeoP5ia/avyItFyduMLd3cOBNP72yGJ4ENn1GyXXEn2dnUBLwmJkzyIS+A NUJCaOAdYV6K96GKCkY+G61boViQo8OIhEQof6 X-Received: by 2002:a05:7300:4307:b0:2ba:6fbb:5e7f with SMTP id 5a478bee46e88-2be311d3f6fmr2401154eec.35.1772728596864; Thu, 05 Mar 2026 08:36:36 -0800 (PST) Received: from server.roeck-us.net ([2600:1700:e321:62f0:da43:aeff:fecc:bfd5]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2be220eb5e5sm5640736eec.17.2026.03.05.08.36.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2026 08:36:36 -0800 (PST) Sender: Guenter Roeck From: Guenter Roeck To: Steven Rostedt Cc: Masami Hiramatsu , Mathieu Desnoyers , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Guenter Roeck , Miaoqian Lin Subject: [PATCH] tracing: Do not call trigger_data_free with NULL data pointer Date: Thu, 5 Mar 2026 08:36:33 -0800 Message-ID: <20260305163633.2782210-1-linux@roeck-us.net> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" If trigger_data_alloc() fails and returns NULL, event_hist_trigger_parse() jumps to the out_free error path. While kfree() safely handles a NULL pointer, trigger_data_free() does not. This causes a NULL pointer dereference in trigger_data_free() when evaluating data->cmd_ops->set_filter. Fix the problem by adding a new goto label and jumping to it if trigger_data_alloc() returns NULL. The problem was found by an experimental code review agent based on gemini-3.1-pro while reviewing backports into v6.18.y. Assisted-by: Gemini:gemini-3.1-pro Cc: Miaoqian Lin Cc: Steven Rostedt (Google) Fixes: 0550069cc25f ("tracing: Properly process error handling in event_his= t_trigger_parse()") Signed-off-by: Guenter Roeck --- kernel/trace/trace_events_hist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_h= ist.c index 73ea180cad55..a2abdfe19281 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -6874,7 +6874,7 @@ static int event_hist_trigger_parse(struct event_comm= and *cmd_ops, trigger_data =3D trigger_data_alloc(cmd_ops, cmd, param, hist_data); if (!trigger_data) { ret =3D -ENOMEM; - goto out_free; + goto out_destroy; } =20 ret =3D event_trigger_set_filter(cmd_ops, file, filter, trigger_data); @@ -6942,7 +6942,7 @@ static int event_hist_trigger_parse(struct event_comm= and *cmd_ops, remove_hist_vars(hist_data); =20 trigger_data_free(trigger_data); - +out_destroy: destroy_hist_data(hist_data); goto out; } --=20 2.45.2