From patchwork Fri Oct 20 00:41:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 155745 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp742953vqb; Thu, 19 Oct 2023 17:42:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG4/38Pn3ARrN4LSb8NkeUaY/LihDuwkajsxIlu60Yacj3OWLWNMvlYvDZUJfow2F6Z+TUs X-Received: by 2002:a05:6808:20a1:b0:3ae:251b:5552 with SMTP id s33-20020a05680820a100b003ae251b5552mr488697oiw.12.1697762524590; Thu, 19 Oct 2023 17:42:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697762524; cv=none; d=google.com; s=arc-20160816; b=u4Z0lcL+7Zh8BmKbumEyb+TVdaQpRJ2cxnVNtcufo4KE17AS7hj+NiZjugO75HfM7N MEnydJDEs8h+xxt0fctIwwO3WO/b14psQ9NmnkKz9gXH3f5aF1MpGu6QQoTnLtVcNVpy RRtQIyo2qCmA4Mfrc8IhhZTyFjk8smQKUdwY8hCtdZ6my6Hwc0Hsv1ABpVmmCZk4Hs8s L+Afvz338NvpPliwvIesnrGO+iOjuvy6KHmDKiFNerZgpnJPE7qHlL733frLhbCxfk59 76T88rPRa7izEoTUHVfM1U3JNpkV/+41LN4GZJlXtNBm3+ipEFvzhbySZt2pqOV/sCZF 2JHQ== 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 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id w129-20020a636287000000b0056c0e3c77f7si691117pgb.805.2023.10.19.17.42.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 17:42:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 3F62F82D1AA6; Thu, 19 Oct 2023 17:42:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346792AbjJTAli (ORCPT + 26 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 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 howler.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 (howler.vger.email [0.0.0.0]); Thu, 19 Oct 2023 17:42:02 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780233036672644772 X-GMAIL-MSGID: 1780233036672644772 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) Reviewed-by: Mukesh Ojha --- 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); }