Re: [PATCH] ocfs2: remove entry once instead of null-ptr-dereference in ocfs2_xa_remove()

From: Andrew Kanner
Date: Sun Nov 03 2024 - 12:50:36 EST


On Fri, Nov 01, 2024 at 08:53:18PM +0800, Joseph Qi wrote:
> [...]
> > --- a/fs/ocfs2/xattr.c
> > +++ b/fs/ocfs2/xattr.c
> > @@ -2036,7 +2036,7 @@ static int ocfs2_xa_remove(struct ocfs2_xa_loc *loc,
> > rc = 0;
> > ocfs2_xa_cleanup_value_truncate(loc, "removing",
> > orig_clusters);
> > - if (rc)
> > + if (rc == 0)
>
> Seems in this case, we have to ignore rc and directly goto out?
>
> Thanks,
> Joseph

It looks so. After ocfs2_xa_value_truncate(loc, 0, ctxt) we might have
ocfs2_xa_value_clusters(loc) <= orig_clusters.

But we already do everything we should for '<' case in the following
ocfs2_xa_cleanup_value_truncate(). And probably should just return
error code for '=' case.

I'll send v2 with your suggestion. Thanks.

--
Andrew Kanner