Revert "ocfs2: strict bound check before memcmp in ocfs2_xattr_find_entry()"

This reverts commit e5a4f3990a.
This commit is contained in:
Ksawlii 2024-11-24 00:23:32 +01:00
parent 7534e491aa
commit 288d6adf78

View file

@ -1074,7 +1074,7 @@ static int ocfs2_xattr_find_entry(struct inode *inode, int name_index,
{
struct ocfs2_xattr_entry *entry;
size_t name_len;
int i, name_offset, cmp = 1;
int i, cmp = 1;
if (name == NULL)
return -EINVAL;
@ -1089,15 +1089,10 @@ static int ocfs2_xattr_find_entry(struct inode *inode, int name_index,
cmp = name_index - ocfs2_xattr_get_type(entry);
if (!cmp)
cmp = name_len - entry->xe_name_len;
if (!cmp) {
name_offset = le16_to_cpu(entry->xe_name_offset);
if ((xs->base + name_offset + name_len) > xs->end) {
ocfs2_error(inode->i_sb,
"corrupted xattr entries");
return -EFSCORRUPTED;
}
cmp = memcmp(name, (xs->base + name_offset), name_len);
}
if (!cmp)
cmp = memcmp(name, (xs->base +
le16_to_cpu(entry->xe_name_offset)),
name_len);
if (cmp == 0)
break;
entry += 1;