|
|
@@ -227,11 +227,11 @@ static struct f2fs_xattr_entry *__find_inline_xattr(struct inode *inode,
|
|
|
{
|
|
|
struct f2fs_xattr_entry *entry;
|
|
|
unsigned int inline_size = inline_xattr_size(inode);
|
|
|
+ void *max_addr = base_addr + inline_size;
|
|
|
|
|
|
list_for_each_xattr(entry, base_addr) {
|
|
|
- if ((void *)entry + sizeof(__u32) > base_addr + inline_size ||
|
|
|
- (void *)XATTR_NEXT_ENTRY(entry) + sizeof(__u32) >
|
|
|
- base_addr + inline_size) {
|
|
|
+ if ((void *)entry + sizeof(__u32) > max_addr ||
|
|
|
+ (void *)XATTR_NEXT_ENTRY(entry) > max_addr) {
|
|
|
*last_addr = entry;
|
|
|
return NULL;
|
|
|
}
|
|
|
@@ -242,6 +242,13 @@ static struct f2fs_xattr_entry *__find_inline_xattr(struct inode *inode,
|
|
|
if (!memcmp(entry->e_name, name, len))
|
|
|
break;
|
|
|
}
|
|
|
+
|
|
|
+ /* inline xattr header or entry across max inline xattr size */
|
|
|
+ if (IS_XATTR_LAST_ENTRY(entry) &&
|
|
|
+ (void *)entry + sizeof(__u32) > max_addr) {
|
|
|
+ *last_addr = entry;
|
|
|
+ return NULL;
|
|
|
+ }
|
|
|
return entry;
|
|
|
}
|
|
|
|