Skip to contentSkip to conversation

udf: Validate extended attribute space is large enough

PATCH New Jan Kara 1 participant 1 message Oct 23

Subsystems (2)
lore
Share & tools
lore

Jan Kara

author reviewer
#0 lore raw

PATCH 1/1 udf: Validate extended attribute space is large enough

When there is extended attributes space in ICB, there must be at least enough space for the header of this space. Otherwise the fs is corrupted and other offset validity checks could underflow.

Fixes 127b0d87649f ("udf: Avoid confusion of missing and corrupted extended attributes")
---
 fs/udf/inode.c | 5 +++++
 1 file changed, 5 insertions(+)

I plan to merge this fix through my tree.

fs/udf/inode.c +5 -0
index bacf2a86161e..88b1c7d351e1 100644
@@ -1607,6 +1607,11 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode)
 	 */
 	if (iinfo->i_lenEAttr > bs || iinfo->i_lenAlloc > bs)
 		goto out;
+	/* We need to have space at least for generic descriptor */
+	if (iinfo->i_lenEAttr && iinfo->i_lenEAttr <
+					sizeof(struct extendedAttrHeaderDesc))
+		goto out;
+
 	/* Now do exact checks */
 	if (udf_file_entry_alloc_offset(inode) + iinfo->i_lenAlloc > bs)
 		goto out;
Signature · 1 line
2.51.0