Re: [PATCH v3] eventfs: Fix the NULL pointer dereference bug in eventfs_remove_rec()

2023-09-11 Thread Ruan Jinjie
On 2023/9/12 5:39, Steven Rostedt wrote: > On Mon, 11 Sep 2023 20:51:25 +0900 > Masami Hiramatsu (Google) wrote: > >> Instead, >> >> ef = eventfs_add_subsystem_dir(name, parent); >> if (IS_ERR(ef)) { >> ... >> } else >> dir->ef = ef; > > > Note, as

Re: [PATCH v3] eventfs: Fix the NULL pointer dereference bug in eventfs_remove_rec()

2023-09-11 Thread Ruan Jinjie
On 2023/9/11 19:51, Masami Hiramatsu (Google) wrote: > Hi Jinjie, > > On Mon, 11 Sep 2023 13:28:17 +0800 > Jinjie Ruan wrote: > >> Inject fault while probing btrfs.ko, if kstrdup() fails in >> eventfs_prepare_ef() in eventfs_add_dir(), it will return ERR_PTR >> to assign file->ef. But the

[PATCH v4] eventfs: Fix the NULL pointer dereference bug in eventfs_remove_rec()

2023-09-11 Thread Jinjie Ruan
Inject fault while probing btrfs.ko, if kstrdup() fails in eventfs_prepare_ef() in eventfs_add_dir(), it will return ERR_PTR to assign file->ef. But the eventfs_remove() check NULL in trace_module_remove_events(), which causes the below NULL pointer dereference. As both Masami and Steven suggest,

Re: [PATCH v3] eventfs: Fix the NULL pointer dereference bug in eventfs_remove_rec()

2023-09-11 Thread Steven Rostedt
On Mon, 11 Sep 2023 20:51:25 +0900 Masami Hiramatsu (Google) wrote: > Instead, > > ef = eventfs_add_subsystem_dir(name, parent); > if (IS_ERR(ef)) { > ... > } else > dir->ef = ef; Note, as the error has a goto out_free, it just needs to be:

Re: [PATCH v3] eventfs: Fix the NULL pointer dereference bug in eventfs_remove_rec()

2023-09-11 Thread Google
Hi Jinjie, On Mon, 11 Sep 2023 13:28:17 +0800 Jinjie Ruan wrote: > Inject fault while probing btrfs.ko, if kstrdup() fails in > eventfs_prepare_ef() in eventfs_add_dir(), it will return ERR_PTR > to assign file->ef. But the eventfs_remove() check NULL in > trace_module_remove_events(), which