linux-stable/fs/udf
Jan Kara a312cbdb90 udf: Fix NULL ptr deref when converting from inline format
commit 7fc3b7c298 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:16:24 +01:00
..
balloc.c udf: Factor out code for creating indirect extent 2015-12-23 18:04:52 +01:00
dir.c block,fs: untangle fs.h and blk_types.h 2016-11-01 09:43:26 -06:00
directory.c udf: Detect incorrect directory size 2018-07-03 11:25:03 +02:00
ecma_167.h udf: use __packed instead of __attribute__ ((packed)) 2017-01-10 11:29:11 +01:00
file.c udf: Use i_size_read() in udf_adinicb_writepage() 2017-06-14 11:21:01 +02:00
ialloc.c fs: Replace current_fs_time() with current_time() 2016-09-27 21:06:22 -04:00
inode.c udf: Fix NULL ptr deref when converting from inline format 2022-02-08 18:16:24 +01:00
Kconfig
lowlevel.c udf: atomically read inode size 2017-01-10 11:57:34 +01:00
Makefile
misc.c udf_get_extendedattr() had no boundary checks. 2021-09-22 11:45:18 +02:00
namei.c udf: Fix NULL pointer dereference in udf_symlink function 2021-07-20 16:17:42 +02:00
osta_udf.h udf: use __packed instead of __attribute__ ((packed)) 2017-01-10 11:29:11 +01:00
partition.c udf: Use correct partition reference number for metadata 2016-05-19 13:00:35 +02:00
super.c udf: Check LVID earlier 2021-09-22 11:45:17 +02: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:13:52 +09:00
udf_i.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
udf_sb.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
udfdecl.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01: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 udf_disk_stamp_to_time() to use mktime64() 2017-06-14 11:21:02 +02:00
unicode.c udf: Allow mounting volumes with incorrect identification strings 2018-12-08 13:03:39 +01:00