ext4: avoid hang when mounting non-journal filesystems with orphan list
authorTheodore Ts'o <tytso@mit.edu>
Thu, 27 Dec 2012 06:42:50 +0000 (01:42 -0500)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 26 Oct 2013 20:06:13 +0000 (21:06 +0100)
commit0cf9986114ab4e16bf36a51814a0f688c79961a7
tree8fc1f0467413eaca76d60328850089cc80f5ad1b
parentc60ce91cc52e53619bb919ad5ff8891b75c2a4dd
ext4: avoid hang when mounting non-journal filesystems with orphan list

commit 0e9a9a1ad619e7e987815d20262d36a2f95717ca upstream.

When trying to mount a file system which does not contain a journal,
but which does have a orphan list containing an inode which needs to
be truncated, the mount call with hang forever in
ext4_orphan_cleanup() because ext4_orphan_del() will return
immediately without removing the inode from the orphan list, leading
to an uninterruptible loop in kernel code which will busy out one of
the CPU's on the system.

This can be trivially reproduced by trying to mount the file system
found in tests/f_orphan_extents_inode/image.gz from the e2fsprogs
source tree.  If a malicious user were to put this on a USB stick, and
mount it on a Linux desktop which has automatic mounts enabled, this
could be considered a potential denial of service attack.  (Not a big
deal in practice, but professional paranoids worry about such things,
and have even been known to allocate CVE numbers for such problems.)

-js: This is a fix for CVE-2013-2015.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
Acked-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/ext4/namei.c