udf: Avoid using stale lengthOfImpUse
authorJan Kara <jack@suse.cz>
Tue, 10 May 2022 10:36:04 +0000 (12:36 +0200)
committerJan Kara <jack@suse.cz>
Tue, 10 May 2022 11:30:32 +0000 (13:30 +0200)
commitc1ad35dd0548ce947d97aaf92f7f2f9a202951cf
tree8c521e3875bf2837889b9a7df519363ebe013870
parent846a3351ddfe4a86eede4bb26a205c3f38ef84d3
udf: Avoid using stale lengthOfImpUse

udf_write_fi() uses lengthOfImpUse of the entry it is writing to.
However this field has not yet been initialized so it either contains
completely bogus value or value from last directory entry at that place.
In either case this is wrong and can lead to filesystem corruption or
kernel crashes.

Reported-by: butt3rflyh4ck <butterflyhuangxx@gmail.com>
CC: stable@vger.kernel.org
Fixes: 979a6e28dd96 ("udf: Get rid of 0-length arrays in struct fileIdentDesc")
Signed-off-by: Jan Kara <jack@suse.cz>
fs/udf/namei.c