Re: confusion in validation of rec_len in ext2_add_link

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

 



On Tue, Dec 30, 2008 at 11:15 AM, Manish Katiyar <mkatiyar@xxxxxxxxx> wrote:
> Hi,
>
> I was trying to understand the purpose of the below check for
> validating rec_len in the function ext2_add_link(). Before reaching
> line 515 we call ext2_get_page() which checks for valid entries on the
> page and thus validates the rec_len too. And then we call the
> lock_page(), so is this check redundant

Got the answer here
http://lkml.indiana.edu/hypermail/linux/kernel/0204.1/0440.html

Thanks -
Manish

> or to avoid cases when
> something could have changed on the page between the lines 497 and 501
> ?
>
> ext2_add_link() {
>
> ........
> 497            page = ext2_get_page(dir, n, 0);
> 499                     if (IS_ERR(page))
> 500                     goto out;
> 501                 lock_page(page);
> .........
> 515                     if (de->rec_len == 0) {
> 516                             ext2_error(dir->i_sb, __func__,
> 517                                     "zero-length directory entry");
> 518                             err = -EIO;
> 519                             goto out_unlock;
> 520                     }
>
> ..........
> }
>
> Thanks -
> Manish
>
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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