Skip to content

Commit

Permalink
fs: sysv: Fix sysv_nblocks() returns wrong value
Browse files Browse the repository at this point in the history
[ Upstream commit e0c49bd ]

sysv_nblocks() returns 'blocks' rather than 'res', which only counting
the number of triple-indirect blocks and causing sysv_getattr() gets a
wrong result.

[AV: this is actually a sysv counterpart of minixfs fix -
0fcd426de9d0 "[PATCH] minix block usage counting fix" in
historical tree; mea culpa, should've thought to check
fs/sysv back then...]

Fixes: 1da177e ("Linux-2.6.12-rc2")
Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Chen Zhongjin authored and gregkh committed Dec 31, 2022
1 parent b6dccca commit c8d1f3d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/sysv/itree.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ static unsigned sysv_nblocks(struct super_block *s, loff_t size)
res += blocks;
direct = 1;
}
return blocks;
return res;
}

int sysv_getattr(struct user_namespace *mnt_userns, const struct path *path,
Expand Down

0 comments on commit c8d1f3d

Please sign in to comment.