Re: [PATCH] ocfs2: Publish the filecheck owner before adding sysfs attributes

From: Cen Zhang

Date: Sun Oct 11 2026 - 12:06:50 EST


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