]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
udf: fix silent AED tagLocation corruption
authorSteven J. Magnani <magnani@ieee.org>
Thu, 7 Jan 2021 23:41:16 +0000 (17:41 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Mar 2021 15:34:30 +0000 (16:34 +0100)
commit9a0c8402fd341b6e4f87b6f049dd0bd2f6fafe03
tree1449706b1e11eedabe47763dac03961ec42e16ce
parent75593df99b8af54a2028e14da1584a5d748deec2
udf: fix silent AED tagLocation corruption

[ Upstream commit 63c9e47a1642fc817654a1bc18a6ec4bbcc0f056 ]

When extending a file, udf_do_extend_file() may enter following empty
indirect extent. At the end of udf_do_extend_file() we revert prev_epos
to point to the last written extent. However if we end up not adding any
further extent in udf_do_extend_file(), the reverting points prev_epos
into the header area of the AED and following updates of the extents
(in udf_update_extents()) will corrupt the header.

Make sure that we do not follow indirect extent if we are not going to
add any more extents so that returning back to the last written extent
works correctly.

Link: https://lore.kernel.org/r/20210107234116.6190-2-magnani@ieee.org
Signed-off-by: Steven J. Magnani <magnani@ieee.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/udf/inode.c