linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] eventfs: Fix failure path in eventfs_create_events_dir()
@ 2023-10-20  0:41 Steven Rostedt
  2023-10-23  9:20 ` Mukesh Ojha
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2023-10-20  0:41 UTC (permalink / raw)
  To: LKML, Linux Trace Kernel; +Cc: Masami Hiramatsu, Mark Rutland, Julia Lawall

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

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 <julia.lawall@inria.fr>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] eventfs: Fix failure path in eventfs_create_events_dir()
  2023-10-20  0:41 [PATCH] eventfs: Fix failure path in eventfs_create_events_dir() Steven Rostedt
@ 2023-10-23  9:20 ` Mukesh Ojha
  0 siblings, 0 replies; 2+ messages in thread
From: Mukesh Ojha @ 2023-10-23  9:20 UTC (permalink / raw)
  To: Steven Rostedt, LKML, Linux Trace Kernel
  Cc: Masami Hiramatsu, Mark Rutland, Julia Lawall



On 10/20/2023 6:11 AM, Steven Rostedt wrote:
> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> 
> 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 <julia.lawall@inria.fr>
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

Reviewed-by: Mukesh Ojha <quic_mojha@quicinc.com>

-Mukesh

> ---
>   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);
>   }

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-23  9:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-20  0:41 [PATCH] eventfs: Fix failure path in eventfs_create_events_dir() Steven Rostedt
2023-10-23  9:20 ` Mukesh Ojha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).