From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Fri, 23 Sep 2016 15:56:48 -0400 Subject: [U-Boot] [U-Boot, v5, 01/16] ext4: fix possible crash on directory traversal, ignore deleted entries In-Reply-To: <95e94ed65e044cc8a9b8d57f524af8e2@rwthex-w2-b.rwth-ad.de> References: <95e94ed65e044cc8a9b8d57f524af8e2@rwthex-w2-b.rwth-ad.de> Message-ID: <20160923195648.GE4884@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tue, Sep 06, 2016 at 04:36:41AM +0200, Stefan Br?ns wrote: > The following command triggers a segfault in search_dir: > ./sandbox/u-boot -c 'host bind 0 ./sandbox/test/fs/3GB.ext4.img ; > ext4write host 0 0 /./foo 0x10' > > The following command triggers a segfault in check_filename: > ./sandbox/u-boot -c 'host bind 0 ./sandbox/test/fs/3GB.ext4.img ; > ext4write host 0 0 /. 0x10' > > "." is the first entry in the directory, thus previous_dir is NULL. The > whole previous_dir block in search_dir seems to be a bad copy from > check_filename(...). As the changed data is not written to disk, the > statement is mostly harmless, save the possible NULL-ptr reference. > > Typically a file is unlinked by extending the direntlen of the previous > entry. If the entry is the first entry in the directory block, it is > invalidated by setting inode=0. > > The inode==0 case is hard to trigger without crafted filesystems. It only > hits if the first entry in a directory block is deleted and later a lookup > for the entry (by name) is done. > > Signed-off-by: Stefan Br?ns > Reviewed-by: Lukasz Majewski Applied to u-boot/master, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: