Re: [PATCH] ocfs2: Publish the filecheck owner before adding sysfs attributes
From: Heming Zhao
Date: Mon Oct 12 2026 - 01:10:53 EST
On 10/11/26 23:40, Cen Zhang wrote:
Hi Heming,
Heming Zhao <heming.zhao@xxxxxxxx> 于2026年10月10日周六 15:38写道:
setting to NULL is unnecessary, it becomes a harmless dangling pointer here.
Other code looks good to me.
Thanks,
Heming
Thanks for reviewing this.
I checked the failure path again with the help of LLM, and I think clearing
fs_fcheck is still needed on this baseline. If kobject_init_and_add()
fails, the
function puts the kobject and frees fcheck. Its caller in
ocfs2_fill_super() then
jumps to out_dismount, which calls ocfs2_dismount_volume() and, in turn,
ocfs2_filecheck_remove_sysfs().
That last function returns early only when fs_fcheck is NULL. Leaving
the dangling pointer would make it operate on the already-put kobject
and access the freed fcheck in ocfs2_filecheck_sysfs_free().
I may still be missing something, but based on this path it seems the NULL
assignment is still needed. Would you agree, or did I overlook a case where
it is safe to leave it?
Thanks again for taking a look.
Best regards,
Cen Zhang
Thanks for the info, I will add my reviewed-by tag.
- Heming