]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
udf: Fix crash on IO error during truncate
authorJan Kara <jack@suse.cz>
Mon, 11 Mar 2019 14:04:18 +0000 (15:04 +0100)
committerSeth Forshee <seth.forshee@canonical.com>
Mon, 1 Apr 2019 20:00:59 +0000 (15:00 -0500)
BugLink: https://bugs.launchpad.net/bugs/1822671
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: stable@vger.kernel.org
Reported-by: jean-luc malet <jeanluc.malet@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
fs/udf/truncate.c

index b647f0bd150c46ba6b202989052b1849bb60c4c5..94220ba8562858e7fa30dfef8734da506b24dfa0 100644 (file)
@@ -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) >>