udf: Restore i_lenAlloc when inode expansion fails
authorJan Kara <jack@suse.cz>
Tue, 18 Jan 2022 08:57:25 +0000 (09:57 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Feb 2022 17:16:24 +0000 (18:16 +0100)
commit3fdf975173dc5acbd6e25b451bcbd558ba9d839a
treed3a7c71b0ce476a8ad678cb220b7857d3b571e0e
parent6c9094d5c9d9acfd00d929f5ae25a60ee26fe54f
udf: Restore i_lenAlloc when inode expansion fails

commit ea8569194b43f0f01f0a84c689388542c7254a1f upstream.

When we fail to expand inode from inline format to a normal format, we
restore inode to contain the original inline formatting but we forgot to
set i_lenAlloc back. The mismatch between i_lenAlloc and i_size was then
causing further problems such as warnings and lost data down the line.

Reported-by: butt3rflyh4ck <butterflyhuangxx@gmail.com>
CC: stable@vger.kernel.org
Fixes: 7e49b6f2480c ("udf: Convert UDF to new truncate calling sequence")
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/udf/inode.c