RE: [PATCH] exfat: fix random stack corruption after get_block

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

 



Hi Yuezhang,
> Subject: Re: [PATCH] exfat: fix random stack corruption after get_block
> 
> +                       /*
> +                        * No buffer_head is allocated.
> +                        * (1) bmap: It's enough to fill bh_result without
I/O.
> +                        * (2) read: The unwritten part should be filled
with 0
> +                        *           If a folio does not have any buffers,
> +                        *           let's returns -EAGAIN to fallback to
> +                        *           per-bh IO like
block_read_full_folio().
> +                        */
> +                       if (!folio_buffers(bh_result->b_folio)) {
> +                               err = -EAGAIN;
> +                               goto done;
> +                       }
> 
> bh_result is set as mapped by map_bh(), should we need to clear it if
> return an error?
I looked a little deeper into do_mpage_readpage() and
block_read_full_folio(), and from a security perspective, it seems that
unmap is necessary in all error situations. Otherwise, unwritten areas
may be exposed.

> 
> +
> +                       BUG_ON(size > sb->s_blocksize);
> 
> This check is equivalent to the following condition and is not necessary.
> 
>                 } else if (iblock == valid_blks &&
>                            (ei->valid_size & (sb->s_blocksize - 1))) {

Yes, I think so, I'll remove it with v2.

Thanks







[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux