Re: [PATCH] EDAC/sysfs: Fix UAF in edac_device_register_sysfs_main_kobj()
From: Guangshuo Li
Date: Tue Apr 28 2026 - 12:09:18 EST
Hi Zhuo,
Thanks for reviewing.
On Tue, 28 Apr 2026 at 22:33, Zhuo, Qiuxu <qiuxu.zhuo@xxxxxxxxx> wrote:
>
>
> This looks incorrect - the flag is marked true on failure ???
>
> [...]
Yes, you're right.
The flag is intended to track whether kobject_init_and_add() has been
called, not whether the function is about to take the error path.
I'll move the assignment to immediately after the kobject_init_and_add()
call, inside the dev_root branch, so the error path only calls
kobject_put() when the kobject has actually been initialized.
Thanks for catching this.