[LU-15601] osd_inode_iteration err ptr dereference, wrong bitmap checks in osd scrub Created: 28/Feb/22 Updated: 05/Mar/22 Resolved: 05/Mar/22 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | Lustre 2.15.0 |
| Fix Version/s: | Lustre 2.15.0 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Oleg Drokin | Assignee: | Andreas Dilger |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Severity: | 3 |
| Rank (Obsolete): | 9223372036854775807 |
| Description |
|
it looks like osd_inode_iteration and all around code in osd-ldiskfs/osd_scrub.c is incorrect osd_inode_iteration: param->bitmap = ldiskfs_read_inode_bitmap(param->sb, param->bg);
if (!param->bitmap) {
CERROR("%s: fail to read bitmap for %u, "
"scrub will stop, urgent mode\n",
osd_scrub2name(scrub), (__u32)param->bg);
RETURN(-EIO);
}
But the comment in ldiskfs_read_inode_bitmap() is incorrect: * Return buffer_head of bitmap on success or NULL.
*/
struct buffer_head *
ldiskfs_read_inode_bitmap(struct super_block *sb, ldiskfs_group_t block_group)
{
struct ldiskfs_group_desc *desc;
struct ldiskfs_sb_info *sbi = LDISKFS_SB(sb);
struct buffer_head *bh = NULL;
ldiskfs_fsblk_t bitmap_blk;
int err; desc = ldiskfs_get_group_desc(sb, block_group, NULL);
if (!desc)
return ERR_PTR(-EFSCORRUPTED);
...
return ERR_PTR(-EIO);
and so on. this is not the case in centos7, but on rhel8 is already affected |
| Comments |
| Comment by Andreas Dilger [ 28/Feb/22 ] |
|
Looks like the osd-ldiskfs code should be changed to use IS_ERR_OR_NULL() so it works with both kernels. |
| Comment by Gerrit Updater [ 01/Mar/22 ] |
|
"Andreas Dilger <adilger@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/46660 |
| Comment by Gerrit Updater [ 05/Mar/22 ] |
|
"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/46660/ |
| Comment by Peter Jones [ 05/Mar/22 ] |
|
Landed for 2.15 |