Skip to contentSkip to conversation

udf: Check for IS_ERR in udf_get_pblock_meta25

PATCH In review Laura Abbott 2 participants 2 messages May 18, 2016 – May 19, 2016 UDF filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 udf: Check for IS_ERR in udf_get_pblock_meta25

udf_find_metadata_inode_efe returns an error pointer, not just NULL. Check the return with IS_ERR appropriately.

---
Came out of https://bugzilla.redhat.com/show_bug.cgi?id=1301295, I never heard back from the reporter so I've had this sitting around for a bit and haven't been able to confirm it fixes the crash. The logic makes sense for the crash though.

---
 fs/udf/partition.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/udf/partition.c +1 -1
index 5f861ed2..a8ee7fc 100644
@@ -329,7 +329,7 @@ uint32_t udf_get_pblock_meta25(struct super_block *sb, uint32_t block,
 		}
 
 		inode = mdata->s_mirror_fe;
-		if (!inode)
+		if (IS_ERR(inode))
 			return 0xFFFFFFFF;
 		retblk = udf_try_read_meta(inode, block, partition, offset);
 	}
Signature · 1 line
2.5.5
#1 lore raw
Quoted 9 lines · Laura Abbott

udf_find_metadata_inode_efe returns an error pointer, not just NULL. Check the return with IS_ERR appropriately.

---
Came out of https://bugzilla.redhat.com/show_bug.cgi?id=1301295, I never heard back from the reporter so I've had this sitting around for a bit and haven't been able to confirm it fixes the crash. The logic makes sense for the crash though.

Thanks for the patch. I've just merged a more comprehensive set of fixes from Alden which fix this issue as well.

Honza

Quoted 21 lines
---
 fs/udf/partition.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/udf/partition.c +1 -1
index 5f861ed2..a8ee7fc 100644
@@ -329,7 +329,7 @@ uint32_t udf_get_pblock_meta25(struct super_block *sb, uint32_t block,
 		}
 
 		inode = mdata->s_mirror_fe;
-		if (!inode)
+		if (IS_ERR(inode))
 			return 0xFFFFFFFF;
 		retblk = udf_try_read_meta(inode, block, partition, offset);
 	}
Signature · 1 line
2.5.5
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR