2009-11-24 11:27:35

by 홍신 shin hong

[permalink] [raw]
Subject: BUG? a suspected race bug at ext3_xattr_block_set()

Hello.
I am reporting a suspected data race bug from ext3/xattr.c in Linux 2.6.31.

In ext3_xattr_block_set(), it accesses bs->bh->b_data
while it does not hold lock_buffer(bs->bh).

However, there is no lock_buffer(bs->bh) and unlock_buffer(bs->bh)
for guarding the access (at line 794).

Due to the lack of synchronization, it seems that data race on
bs->bh->b_data might be possible.

Please examine the code to check whether it is problematic or not.
Thank you.

Sincerely
Shin Hong


2009-12-10 15:41:56

by Jan Kara

[permalink] [raw]
Subject: Re: BUG? a suspected race bug at ext3_xattr_block_set()

Hi,

> I am reporting a suspected data race bug from ext3/xattr.c in Linux 2.6.31.
Thank you for your report.

> In ext3_xattr_block_set(), it accesses bs->bh->b_data
> while it does not hold lock_buffer(bs->bh).
>
> However, there is no lock_buffer(bs->bh) and unlock_buffer(bs->bh)
> for guarding the access (at line 794).
Yes, but we don't really look at the content of bs->bh->b_data. We
just compare the pointers and for that we definitely don't need the
lock. So I don't see problem. If you still do, please tell me more
details (like a sample of code executions of two threads which race).
Thanks.

Honza
--
Jan Kara <[email protected]>
SuSE CR Labs