Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp708486rdb; Thu, 19 Oct 2023 17:41:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH7876iLDWuBQ1mvZ75xkYLlPe7OYMgYnYhZeJYWd+uTPKh9POnOpFQa3wDd/8yCWBJCGGq X-Received: by 2002:a05:6871:28e:b0:1ea:b1c:b859 with SMTP id i14-20020a056871028e00b001ea0b1cb859mr547488oae.35.1697762515399; Thu, 19 Oct 2023 17:41:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697762515; cv=none; d=google.com; s=arc-20160816; b=Tbj1N7mv/KzYsqBPaIY2R0u8qHm5iSUrdIqn1DH/S2Uzz9lAETUhTj/8OhKMZbKGvL C2g9lZS18wYk3RsCnqes/fxofShyO6zbwvZCaCeHTUBgtWKijdxK2dLxWTkaCxc+PPyW 9ehyXQYPAndRHnkOOpQhkJI2buJrIVhZW8a/+SK9Es0hGXfkq7E456bF0Lo8EAEOS5At 798Oyz2nhZVOBevwFaT6Jc0SLMbtCzPgXnGgVg/Aj7DXv2c/feb+7PgObfPghdvLYfLr /3mfBNs7EhaycAuPnWi0NdAjtCosmnAcpZs/ktvnzWcqrKqe4O2iTv5Gcgy3uoSljvm4 BVag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:subject:cc:to:from:date; bh=7b9uN3b7H9BI0xXFOdricW1mhlbMzwrwMW+/tpXXT60=; fh=90m8aL82WCN2vyJSEqod/otNhxdVipwGWBudO19eUek=; b=aatWPfOXITU4ICJCncTfNmZHYxANB8caFgbiEZHw3onSAEpbT7rtRP/axnil0iIwJu ihVqc3qvCiYu6OBENM48XCGOMXjHm2WQ09agneOPSbYDIv7rItsd/e9QnUevK2CXkFaL 7oIfAgx3Pk6DbSq6C/2j7VvyP/t8wngdOCpOHnD1g1JEjgbmjFl30wrKUkJ8jlI6Vnfl SYeUF6aIUug3pXuW3TQfL+hlBcXX+I2fTwh66NBygAsofTKZxTC/dlm0VFmmY+lC/1i7 fK8Uf9FNuhC2gL7tgKBYb8PdRsnJhVJVOu+0Us4ofeDMArvH80UCGYgEJDwadp6hdTYf artA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id az1-20020a056a02004100b005b4600b5738si730421pgb.261.2023.10.19.17.41.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 17:41:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id E02AC803E901; Thu, 19 Oct 2023 17:41:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346786AbjJTAli (ORCPT + 99 others); Thu, 19 Oct 2023 20:41:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233033AbjJTAlh (ORCPT ); Thu, 19 Oct 2023 20:41:37 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C88BFC0 for ; Thu, 19 Oct 2023 17:41:35 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEFF9C433C7; Fri, 20 Oct 2023 00:41:34 +0000 (UTC) Date: Thu, 19 Oct 2023 20:41:32 -0400 From: Steven Rostedt To: LKML , Linux Trace Kernel Cc: Masami Hiramatsu , Mark Rutland , Julia Lawall Subject: [PATCH] eventfs: Fix failure path in eventfs_create_events_dir() Message-ID: <20231019204132.6662fef0@gandalf.local.home> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email 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 (fry.vger.email [0.0.0.0]); Thu, 19 Oct 2023 17:41:53 -0700 (PDT) From: "Steven Rostedt (Google)" The failure path of allocating ei goes to a path that dereferences ei. Add another label that skips over the ei dereferences to do the rest of the clean up. Link: https://lore.kernel.org/all/70e7bace-561c-95f-1117-706c2c220bc@inria.fr/ Fixes: 5790b1fb3d67 ("eventfs: Remove eventfs_file and just use eventfs_inode") Reported-by: Julia Lawall Signed-off-by: Steven Rostedt (Google) --- fs/tracefs/event_inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c index 9f19b6608954..1885f1f1f339 100644 --- a/fs/tracefs/event_inode.c +++ b/fs/tracefs/event_inode.c @@ -735,7 +735,7 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry ei = kzalloc(sizeof(*ei), GFP_KERNEL); if (!ei) - goto fail; + goto fail_ei; inode = tracefs_get_inode(dentry->d_sb); if (unlikely(!inode)) @@ -781,6 +781,7 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry fail: kfree(ei->d_children); kfree(ei); + fail_ei: tracefs_failed_creating(dentry); return ERR_PTR(-ENOMEM); } -- 2.42.0