Re: [PATCH] ext3/4: fix uninitialized bs in ext3/4_xattr_set_handle()

From: Kalpak Shah
Date: Tue May 13 2008 - 04:57:21 EST


Hi Eric,

On Mon, 2008-05-12 at 19:18 -0500, Eric Sandeen wrote:
> Tiger Yang wrote:
> > Hi,
> > I met a bug when I try to replace a xattr entry in ibody with a big size
> > value. But in ibody there has no space for the new value. So it should
> > set new xattr entry in block and remove the old xattr entry in ibody.
> >
> > Best regards,
> > tiger
> >
>
> Tiger, do you have a testcase handy to demonstrate this?

Attached is a simple script to reproduce the problem.

>
> Is the new, large out-of-inode xattr unique so that it does not match
> any existing attribute block, I assume?

I don't quite understand what you mean but the problem is that in
ext3_xattr_set_handle(), the EA being replaced is found in the
inode-body (by function ext3_xattr_ibody_find) and hence
ext3_xattr_block_find() is not called initially. So in this test-case
when we have to delete an EA from the inode and add it into the external
block, bs turns out to be uninitialized and therefore a new EA block
gets allocated instead of the existing one being used.

Thanks,
Kalpak

>
> Thanks,
>
> -Eric
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html

Attachment: reproducer.sh
Description: application/shellscript