android_kernel_xiaomi_sm7250/fs/udf
Jan Kara a23a59717f udf: Fix NULL ptr deref when converting from inline format
commit 7fc3b7c2981bbd1047916ade327beccb90994eee upstream.

udf_expand_file_adinicb() calls directly ->writepage to write data
expanded into a page. This however misses to setup inode for writeback
properly and so we can crash on inode->i_wb dereference when submitting
page for IO like:

  BUG: kernel NULL pointer dereference, address: 0000000000000158
  #PF: supervisor read access in kernel mode
...
  <TASK>
  __folio_start_writeback+0x2ac/0x350
  __block_write_full_page+0x37d/0x490
  udf_expand_file_adinicb+0x255/0x400 [udf]
  udf_file_write_iter+0xbe/0x1b0 [udf]
  new_sync_write+0x125/0x1c0
  vfs_write+0x28e/0x400

Fix the problem by marking the page dirty and going through the standard
writeback path to write the page. Strictly speaking we would not even
have to write the page but we want to catch e.g. ENOSPC errors early.

Reported-by: butt3rflyh4ck <butterflyhuangxx@gmail.com>
CC: stable@vger.kernel.org
Fixes: 52ebea749a ("writeback: make backing_dev_info host cgroup-specific bdi_writebacks")
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-08 18:23:03 +01:00
..
balloc.c udf: Drop unused arguments of udf_delete_aext() 2018-06-20 11:05:49 +02:00
dir.c udf: Fix crash after seekdir 2021-11-26 11:36:23 +01:00
directory.c udf: Provide function for calculating dir entry length 2018-06-20 11:05:49 +02:00
ecma_167.h udf: use __packed instead of __attribute__ ((packed)) 2017-01-10 11:29:11 +01:00
file.c udf: Apply uid/gid mount options also to new inodes & chown 2018-02-27 10:25:33 +01:00
ialloc.c udf: convert inode stamps to timespec64 2018-06-27 13:58:00 +02:00
inode.c udf: Fix NULL ptr deref when converting from inline format 2022-02-08 18:23:03 +01:00
Kconfig udf: Always require NLS support 2018-04-19 16:00:48 +02:00
lowlevel.c udf: atomically read inode size 2017-01-10 11:57:34 +01:00
Makefile switch udf to simple_fsync() 2009-06-11 21:36:13 -04:00
misc.c udf_get_extendedattr() had no boundary checks. 2021-09-22 11:47:50 +02:00
namei.c udf: Fix crash after seekdir 2021-11-26 11:36:23 +01:00
osta_udf.h udf: use __packed instead of __attribute__ ((packed)) 2017-01-10 11:29:11 +01:00
partition.c udf: Fix signed/unsigned format specifiers 2017-10-17 12:00:58 +02:00
super.c udf: Fix crash after seekdir 2021-11-26 11:36:23 +01:00
symlink.c statx: Add a system call to make enhanced file info available 2017-03-02 20:51:15 -05:00
truncate.c udf: Fix crash on IO error during truncate 2019-03-27 14:14:39 +09:00
udf_i.h udf: convert inode stamps to timespec64 2018-06-27 13:58:00 +02:00
udf_sb.h udf: Prevent write-unsupported filesystem to be remounted read-write 2018-11-21 09:19:12 +01:00
udfdecl.h udf: convert inode stamps to timespec64 2018-06-27 13:58:00 +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: Allow mounting volumes with incorrect identification strings 2018-12-05 19:32:06 +01:00