udf: Warn if block mapping is done for in-ICB files
authorJan Kara <jack@suse.cz>
Tue, 28 Feb 2023 11:11:38 +0000 (12:11 +0100)
committerJan Kara <jack@suse.cz>
Mon, 6 Mar 2023 15:38:25 +0000 (16:38 +0100)
Now that address space operations are merge dfor in-ICB and normal
files, it is more likely some code mistakenly tries to map blocks for
in-ICB files. WARN and return error instead of silently returning
garbage.

Signed-off-by: Jan Kara <jack@suse.cz>
fs/udf/inode.c

index 0cb7d8f..2210e5e 100644 (file)
@@ -416,6 +416,9 @@ static int udf_map_block(struct inode *inode, struct udf_map_rq *map)
        int err;
        struct udf_inode_info *iinfo = UDF_I(inode);
 
+       if (WARN_ON_ONCE(iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB))
+               return -EFSCORRUPTED;
+
        map->oflags = 0;
        if (!(map->iflags & UDF_MAP_CREATE)) {
                struct kernel_lb_addr eloc;