Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp733165rdb; Fri, 26 Jan 2024 09:03:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IE00Liqf8grCXNRKvPp0s66RkOP9aFav1GcUoViEgmGy4r6H3YjDYtbsJxsqe9WCJrtg1WL X-Received: by 2002:a05:6a00:18a2:b0:6d9:8f4f:5fe0 with SMTP id x34-20020a056a0018a200b006d98f4f5fe0mr115452pfh.12.1706288585650; Fri, 26 Jan 2024 09:03:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706288585; cv=pass; d=google.com; s=arc-20160816; b=p99/1sxWD8zhodnMjzi9WB/sMtIoZ0Z+O7AyVORGvKQsANpSq+HnGgJpV4+4FAG7q+ hlK6rKDTqGf2OfOfVTgCDO2QMIQavwHb61uJKUz6f3RPwM1QkioCGo9T7ojbHSLvnrZb 7DeE/a5bBTOobmk0ndT/ZMuV5VmTHlfHVQwYyDs4idcTgH2p3av1A7Pcc5F8YXlZMK3J Tlb9iU3zn9rf82ixsgIGe/8Tw35IwX9w7OrXuTg/xz/zIkgVLjlKIUog8Ss1zg40UUPU qVeKIs9aYyQnWaw1cCdUga2wP5JL1SC36D+KTbhUzSqoblGHbTQfM4p0QQrPOJHb7oTD Ufug== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date; bh=tsJRnsV4zYM0tVwHlp/xGvESSq/kDDmEU1joiPAcaWI=; fh=RgzLGBoasBFBaYzygqDfqjTbi/jF4k8V6Y1cJQMO4QE=; b=E2JZWL+iGTU25QUpgPoWS/uikONCiBS9V9+x8koHPdf5UVHO6LEgYwUXPHsmgPLUw+ 8qdfC/vZigBOjACbEMoZWdZOTHb5evu64L420kCin/Uq3yPZxXxBONIU6PsfP2xXXKJ1 nNhcr6mvqpVQ+wXQT8O7TZ0TxZ/sX4byDZVA/K8WhoB3JvZQHdBDTw0Mxen9ig1E/I+u P8bzRE18mr++cnvJZmmEskbsBX+mbj/+QwIyXR5e1YXquMw51PqFlzIkBopJIr6+D5CI bc8vdA0rs4g3Q3Y+Am82WwdvukLfe67N6OVO7xaY9kJ/K5gwhzlUrFKxxIShaHYTNE/W VLdg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-40387-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40387-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id a192-20020a6390c9000000b005cd8938b10csi1373123pge.631.2024.01.26.09.03.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 09:03:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40387-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-40387-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40387-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 771ADB25B16 for ; Fri, 26 Jan 2024 16:59:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A75A01E86F; Fri, 26 Jan 2024 16:58:55 +0000 (UTC) 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 2F5C06AB8; Fri, 26 Jan 2024 16:58:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706288335; cv=none; b=j73BI82G7WlZxPP1H8rUd88HMdbk5dgZ2f4fhTQn9Z2wGjqKytoQuAfPRNrwzNtsGnnmoyRz0NUNQa9owv2bfl6nCcNTMO+IMmOPuQrJkZyBg6tOdH639eiNyq+ExrfYtqbGn01yRNak/yqHiWNb5JfmBa6LumnqKv7vOrQ43ZI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706288335; c=relaxed/simple; bh=tGTdIK79gYWJVyCe3WNR9g7OUuQ+QOfQOES6vlTFBz8=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=N8Fn7096tcSMQp/pEGQWLRjEqlVrRbJuiW1zWM1veJxba93LWh2tcoVjoZ4kUnqDitpW+RXCcKUqZX3IvfAFV03zSKNhSdhnix1+0rAtPmBke2q7Z7mSpYSvCfvC2e+s5tit+qdYDBJvKJ/mWYsAyP019cxtuZlqE86ZPeOd+c4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D894FC43394; Fri, 26 Jan 2024 16:58:53 +0000 (UTC) Date: Fri, 26 Jan 2024 11:58:56 -0500 From: Steven Rostedt To: "Masami Hiramatsu (Google)" Cc: Vincent Donnefort , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, mathieu.desnoyers@efficios.com, kernel-team@android.com Subject: Re: [PATCH] tracing/trigger: Fix to return error if failed to alloc snapshot Message-ID: <20240126115856.2884e889@gandalf.local.home> In-Reply-To: <170622977792.270660.2789298642759362200.stgit@devnote2> References: <170622977792.270660.2789298642759362200.stgit@devnote2> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 26 Jan 2024 09:42:58 +0900 "Masami Hiramatsu (Google)" wrote: > From: Masami Hiramatsu (Google) > > Fix register_snapshot_trigger() to return error code if it failed to > allocate a snapshot instead of 0 (success). Unless that, it will register > snapshot trigger without an error. > > Fixes: 0bbe7f719985 ("tracing: Fix the race between registering 'snapshot' event trigger and triggering 'snapshot' operation") > Cc: stable@vger.kernel.org > Signed-off-by: Masami Hiramatsu (Google) Thanks Masami, I'll apply this. -- Steve > --- > kernel/trace/trace_events_trigger.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c > index 46439e3bcec4..b33c3861fbbb 100644 > --- a/kernel/trace/trace_events_trigger.c > +++ b/kernel/trace/trace_events_trigger.c > @@ -1470,8 +1470,10 @@ register_snapshot_trigger(char *glob, > struct event_trigger_data *data, > struct trace_event_file *file) > { > - if (tracing_alloc_snapshot_instance(file->tr) != 0) > - return 0; > + int ret = tracing_alloc_snapshot_instance(file->tr); > + > + if (ret < 0) > + return ret; > > return register_trigger(glob, data, file); > }