Skip to content

Commit 31605bb

Browse files
mjbommargregkh
authored andcommitted
udf: reject descriptors with oversized CRC length
commit 55d41b0 upstream. udf_read_tagged() skips CRC verification when descCRCLength + sizeof(struct tag) exceeds the block size. A crafted UDF image can set descCRCLength to an oversized value to bypass CRC validation entirely; the descriptor is then accepted based solely on the 8-bit tag checksum, which is trivially recomputable. Reject such descriptors instead of silently accepting them. A legitimate single-block descriptor should never have a CRC length that exceeds the block. Fixes: 1da177e ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-4-6 Assisted-by: Codex:gpt-5-4 Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com> Link: https://patch.msgid.link/20260413211240.853662-1-michael.bommarito@gmail.com Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c25c9f3 commit 31605bb

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

fs/udf/misc.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,12 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block,
230230
}
231231

232232
/* Verify the descriptor CRC */
233-
if (le16_to_cpu(tag_p->descCRCLength) + sizeof(struct tag) > sb->s_blocksize ||
234-
le16_to_cpu(tag_p->descCRC) == crc_itu_t(0,
233+
if (le16_to_cpu(tag_p->descCRCLength) + sizeof(struct tag) > sb->s_blocksize) {
234+
udf_err(sb, "block %u: CRC length %u exceeds block size\n",
235+
block, le16_to_cpu(tag_p->descCRCLength));
236+
goto error_out;
237+
}
238+
if (le16_to_cpu(tag_p->descCRC) == crc_itu_t(0,
235239
bh->b_data + sizeof(struct tag),
236240
le16_to_cpu(tag_p->descCRCLength)))
237241
return bh;

0 commit comments

Comments
 (0)