[Bug 259024] ext2_search_dirblock() loops forever if e2d_reclen is zero

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 09 Oct 2021 11:22:39 UTC

            Bug ID: 259024
           Summary: ext2_search_dirblock() loops forever if e2d_reclen is
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: rtm@lcs.mit.edu

Created attachment 228539
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=228539&action=edit
An ext3 disk image that causes ext2_search_dirblock() to loop forever.

The code in ext2_search_dirblock() that handles e2d_reclen == 0
doesn't increment ep, and thus loops forever. 

I've attached a demo:

% gunzip ext34.img.gz
% sudo mdconfig -f ext34.img
% sudo mount -t ext2fs -o ro /dev/md0 /mnt
% sudo cp /mnt/a /dev/null
<the lookup never finishes>

FreeBSD unmatched 14.0-CURRENT FreeBSD 14.0-CURRENT #0
main-n249571-b5f90655ea3: Thu Sep 23 06:10:05 UTC 2021    
root@releng1.nyi.freebsd.org:/usr/obj/usr/src/riscv.riscv64/sys/GENERIC  riscv

You are receiving this mail because:
You are the assignee for the bug.