From patchwork Tue Feb 6 12:09:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 197387 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1496635dyb; Tue, 6 Feb 2024 04:18:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IFin+XloxY9cis7pOE0uKEg/A2OmOc/mG0AXn1ztHVkr4LnMrebLgmQNZ06l+yoq3XrylTN X-Received: by 2002:a05:6122:4d10:b0:4c0:1afb:b4cc with SMTP id fi16-20020a0561224d1000b004c01afbb4ccmr2760079vkb.13.1707221915926; Tue, 06 Feb 2024 04:18:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707221915; cv=pass; d=google.com; s=arc-20160816; b=Fkcr1+xif0lYhi/6QG9MuoZ/hzHsS5+v86Dc6xX45Jbif+1S5T8BPMB+3izb5+LhQ5 IzmWevXWZOB0mXYkRw9Yhuy2I+diMq5DDh+60CGJmZHxyKsCIEKQ76EpcQHlD5GyD569 yGR/bq88Hbo0eHddPXnfLNcd9UvWRHwJxvgH7wL1oK9MKftB7EgX+WxsfEb5T7uC7QKN FOGhmcXfLcX28oo4my6H/rkMFJ9CWR39UCeh/r9l0rpfYl2diBlwQFNEMOafbMT2yieN 9HJmXv2JYk+SouRBBiqdpsIPTDUKkHJWzjglzowGZBsLqEMmlDOkR/JewiviTjsevTKT ZuAQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:subject:cc:to:from:date:user-agent:message-id; bh=Hfusfzjs0UZKElxuqb1X8cC1ErykGUVmsm2+3ArQrQo=; fh=BOxf5attRC46ACH3+g1OVz0NDaYUyKC2bLN2g+NW3AA=; b=l2vVbh3N+FeQ6Wo7Fxb93pyR7EXh+LXM3l2JyeAfJktMK69uNG4sWghdsetE8hehoS chpxanBUXoRuMRMk2s5WW/iORbDJOti8PzP43qbzBARpvVTp4IqrEnvgIiR2jZL+aqJn QG3//sYTq0OhnACG61sQV97fPBefnhWVMrC0dLWMGvhC/IY4jUf0BeCzlaC3npreJ07g ejHoJm64KXKEnU7GQfsCnnV9PI/gt0b2LdiBgo9twaLKf/1ekQlPzabZiQEFeKgv27yX 718cu5793zqTShS8Fc8Ef6+OXbPe8ZIvHB9/DfSrWoLVC74DW5hBwIVRHB193uXPs1wn tFbA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-54885-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54885-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCWVgaLy8QeJCb22ZsgGJ0aEFeIVNkbU0Q/6p9IXKQx9I8LZ3/uYjpceHzViqOpOGzLGj6H7hO8bfKBlvftJWo3R8KxP+Q== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id kd26-20020a056214401a00b006819bba47f3si2551945qvb.508.2024.02.06.04.18.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 04:18:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54885-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-54885-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54885-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 988A31C23CF4 for ; Tue, 6 Feb 2024 12:18:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8FAC513B282; Tue, 6 Feb 2024 12:09:25 +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 C33701353F4; Tue, 6 Feb 2024 12:09:19 +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=1707221359; cv=none; b=LXUQa516Csi2cv3g4WpoQVbwtqRfhQY1mvAut+90eCmpeCbGhXPrnkhuklbDKiNMWCXNZtLAKm6FtpIW0uVm/Occ0IC3b2k25VObh3J1aIEfEy5naLYy2wiAXrBtJuSyDTdvgr7fRin47iJzP1KWDqZvX6BtHgkKlyIw4rZ8jMI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707221359; c=relaxed/simple; bh=yxagGa01h2asUZexPZIm50VtsB5OwdxwdGuVM2gCW2Q=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=pH9bKuaCWChFkY6iw3xGpc3FdOqfbd6X0dGf+GOECCRBSzHpi6JBQ7gIN28NcSaFzz8veR+sHgwjoZ9d1gfqrTCvs0YO0hjyBUcTD3YShsgOPR6TO/GfQo64QqAc9Fo60ljk2x4y1wdUAbKZPxqIkTKADFH+gjrBwfe9GzIwBAg= 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 AE411C433B1; Tue, 6 Feb 2024 12:09:19 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1rXKGq-00000006b6L-0bJb; Tue, 06 Feb 2024 07:09:48 -0500 Message-ID: <20240206120948.003109160@rostedt.homelinux.com> User-Agent: quilt/0.67 Date: Tue, 06 Feb 2024 07:09:15 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Linus Torvalds , Greg Kroah-Hartman , Sasha Levin , Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Julia Lawall Subject: [v6.6][PATCH 10/57] eventfs: Fix failure path in eventfs_create_events_dir() References: <20240206120905.570408983@rostedt.homelinux.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790151927542280314 X-GMAIL-MSGID: 1790151927542280314 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/ Link: https://lore.kernel.org/linux-trace-kernel/20231019204132.6662fef0@gandalf.local.home Cc: Masami Hiramatsu Cc: Mark Rutland Fixes: 5790b1fb3d67 ("eventfs: Remove eventfs_file and just use eventfs_inode") Reported-by: Julia Lawall Signed-off-by: Steven Rostedt (Google) (cherry picked from commit 7e8ad67c9b5c11e990c320ed7e7563f2301672a7) --- 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); }