xfs: fix possible inode corruption in directory scan

grub_xfs_iterate_dir did not restore first character after inline
name when match was found. Dependning on XFS format this character
could be inode number and we could return to the same node later in
find_file if processing cycled symlinks.

CID: 86724
This commit is contained in:
Andrei Borzenkov 2016-01-09 18:55:55 +03:00
parent bd60f5a207
commit aafd205c92

View file

@ -775,7 +775,10 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
c = de->name[de->len]; c = de->name[de->len];
de->name[de->len] = '\0'; de->name[de->len] = '\0';
if (iterate_dir_call_hook (ino, de->name, &ctx)) if (iterate_dir_call_hook (ino, de->name, &ctx))
{
de->name[de->len] = c;
return 1; return 1;
}
de->name[de->len] = c; de->name[de->len] = c;
de = grub_xfs_inline_next_de(dir->data, head, de); de = grub_xfs_inline_next_de(dir->data, head, de);