]> git.baikalelectronics.ru Git - kernel.git/commit
udf: Avoid using stale lengthOfImpUse
authorJan Kara <jack@suse.cz>
Tue, 10 May 2022 10:36:04 +0000 (12:36 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 15 May 2022 18:18:52 +0000 (20:18 +0200)
commite8f99e6e86286656a4b36b8daafe38be6f8cbd78
tree6525b28a1648370a47d9d73b2b6c5f0165c4fa8a
parentbd6da8aaf08da1ac3776c6cd47b7d09c3e3601f3
udf: Avoid using stale lengthOfImpUse

commit bb7f57a07c60625db110f0c2b2ea9d6430800bfa upstream.

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: ad6b01e9c3fb ("udf: Get rid of 0-length arrays in struct fileIdentDesc")
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/udf/namei.c