Re: Errors reported by Coverity in ext3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for your corrections.

Attached is a new patch against kernel 2.6.29.1.
I applied most of your corrections, see my comments inline.
Please review take #2.

Thanks,
Amir.

On Tue, Apr 21, 2009 at 1:14 AM, Andreas Dilger <adilger@xxxxxxx> wrote:
>
> Thanks for the patch, unfortunately it is a NACK, since there are a few
> bugs in the error handling, and some additional cleanups that can be done.
>
> More comments inline.
>
>> @@ -2302,7 +2310,9 @@ static int ext3_rename (struct inode * o
>>               BUFFER_TRACE(new_bh, "get write access");
>> -             ext3_journal_get_write_access(handle, new_bh);
>> +             retval = ext3_journal_get_write_access(handle, new_bh);
>> +             if (retval)
>> +                     goto end_rename;
>
> Similarly, this also needs a "brelse(new_bh)" before "goto end_rename".

brelse(new_bh) as well as brelse(dir_bh) are called on end_rename.

>
>> @@ -2360,7 +2370,14 @@ static int ext3_rename (struct inode * o
>>       ext3_update_dx_flag(old_dir);
>>       if (dir_bh) {
>>               BUFFER_TRACE(dir_bh, "get_write_access");
>> +             retval = ext3_journal_get_write_access(handle, dir_bh);
>> +             if (retval) {
>> +                     ext3_warning(old_dir->i_sb, "ext3_rename",
>> +                                     "Updating new directory (%lu) parent link, %d, error=%d",
>> +                                     new_dir->i_ino, new_dir->i_nlink, retval);
>> +             }
>> +     }
>
> At this point, if we cannot get write access to the directory buffer, it
> is really a bit too late to do much about it.  It may make more sense to
> instead call ext3_journal_get_write_access() right after ext3_bread() is
> called dor this buffer, so that the error can be checked and the rename
> aborted before any changes are made.
>

good idea. I moved it up.

> Note also that there are some places where ext3_journal_dirty_metadata()
> are called in these same code paths, but the error is not checked by the
> caller.
>

true, but as with the case above, handling errors before the changes
are made is much easier,
and I am only aiming for 'best effort' in this patch.

Attachment: ext3-namei-check-jbd-errors-2.6.29.1.patch
Description: Binary data


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux