This Linux kernel change "udf: Fix crash on IO error during truncate" is included in the Linux 4.19.32 release. This change is authored by Jan Kara <jack [at] suse.cz> on Mon Mar 11 15:04:18 2019 +0100. The commit for this change in Linux stable tree is c72e90d (patch) which is from upstream commit d3ca465. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream d3ca465.
udf: Fix crash on IO error during truncate commit d3ca4651d05c0ff7259d087d8c949bcf3e14fb46 upstream. When truncate(2) hits IO error when reading indirect extent block the code just bugs with: kernel BUG at linux-4.15.0/fs/udf/truncate.c:249! ... Fix the problem by bailing out cleanly in case of IO error. CC: firstname.lastname@example.org Reported-by: jean-luc malet <email@example.com> Signed-off-by: Jan Kara <firstname.lastname@example.org> Signed-off-by: Greg Kroah-Hartman <email@example.com>
There are 3 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.
fs/udf/truncate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/udf/truncate.c b/fs/udf/truncate.c index b647f0b..94220ba 100644 --- a/fs/udf/truncate.c +++ b/fs/udf/truncate.c @@ -260,6 +260,9 @@ void udf_truncate_extents(struct inode *inode) epos.block = eloc; epos.bh = udf_tread(sb, udf_get_lb_pblock(sb, &eloc, 0)); + /* Error reading indirect block? */ + if (!epos.bh) + return; if (elen) indirect_ext_len = (elen + sb->s_blocksize - 1) >>