linux-stable/fs/udf
Jan Kara 5875f87e2f udf: Fix crash after seekdir
commit a48fc69fe6 upstream.

udf_readdir() didn't validate the directory position it should start
reading from. Thus when user uses lseek(2) on directory file descriptor
it can trick udf_readdir() into reading from a position in the middle of
directory entry which then upsets directory parsing code resulting in
errors or even possible kernel crashes. Similarly when the directory is
modified between two readdir calls, the directory position need not be
valid anymore.

Add code to validate current offset in the directory. This is actually
rather expensive for UDF as we need to read from the beginning of the
directory and parse all directory entries. This is because in UDF a
directory is just a stream of data containing directory entries and
since file names are fully under user's control we cannot depend on
detecting magic numbers and checksums in the header of directory entry
as a malicious attacker could fake them. We skip this step if we detect
that nothing changed since the last readdir call.

Reported-by: Nathan Wilson <nate@chickenbrittle.com>
CC: stable@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-11-26 10:39:20 +01:00
..
balloc.c treewide: Remove uninitialized_var() usage 2020-07-16 12:35:15 -07:00
dir.c udf: Fix crash after seekdir 2021-11-26 10:39:20 +01:00
directory.c udf: Remove pointless union in udf_inode_info 2020-09-29 17:21:54 +02:00
ecma_167.h udf: Replace HTTP links with HTTPS ones 2020-07-14 14:37:39 +02:00
file.c udf: Remove pointless union in udf_inode_info 2020-09-29 17:21:54 +02:00
ialloc.c udf: Remove pointless union in udf_inode_info 2020-09-29 17:21:54 +02:00
inode.c udf: fix silent AED tagLocation corruption 2021-03-17 17:06:23 +01:00
Kconfig docs: filesystems: fix renamed references 2020-04-20 15:45:22 -06:00
lowlevel.c udf: stop using ioctl_by_bdev 2020-05-04 10:13:42 -06:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
misc.c udf_get_extendedattr() had no boundary checks. 2021-09-15 09:50:27 +02:00
namei.c udf: Fix crash after seekdir 2021-11-26 10:39:20 +01:00
osta_udf.h udf: osta_udf.h: delete a duplicated word 2020-07-27 10:58:55 +02:00
partition.c udf: Remove pointless union in udf_inode_info 2020-09-29 17:21:54 +02:00
super.c udf: Fix crash after seekdir 2021-11-26 10:39:20 +01:00
symlink.c udf: Remove pointless union in udf_inode_info 2020-09-29 17:21:54 +02:00
truncate.c udf: Fix spelling in EXT_NEXT_EXTENT_ALLOCDESCS 2020-01-08 11:11:46 +01:00
udf_i.h udf: Remove pointless union in udf_inode_info 2020-09-29 17:21:54 +02:00
udf_sb.h udf: Fix iocharset=utf8 mount option 2021-09-15 09:50:25 +02:00
udfdecl.h udf: augment UDF permissions on new inodes 2019-08-27 15:38:46 +02:00
udfend.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
udftime.c udf: convert inode stamps to timespec64 2018-06-27 13:58:00 +02:00
unicode.c udf: Fix iocharset=utf8 mount option 2021-09-15 09:50:25 +02:00