[PATCH] erofs-utils: fix truncated uid/gid fields of extended inodes

Gao Xiang hsiangkao at linux.alibaba.com
Wed Sep 29 21:01:17 AEST 2021


Uid/gid of extended inodes was badly assigned with le16_to_cpu()
by mistake. It could cause truncated values if uid/gid >= 65536.
Fix it now.

Fixes: 6a61ce1450c5 ("erofs-utils: complete extended inode support")
Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
---
 lib/inode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/inode.c b/lib/inode.c
index 1538673aa0c6..6597a26f7ac4 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -466,8 +466,8 @@ static bool erofs_bh_flush_write_inode(struct erofs_buffer_head *bh)
 
 		u.die.i_ino = cpu_to_le32(inode->i_ino[0]);
 
-		u.die.i_uid = cpu_to_le16(inode->i_uid);
-		u.die.i_gid = cpu_to_le16(inode->i_gid);
+		u.die.i_uid = cpu_to_le32(inode->i_uid);
+		u.die.i_gid = cpu_to_le32(inode->i_gid);
 
 		u.die.i_ctime = cpu_to_le64(inode->i_ctime);
 		u.die.i_ctime_nsec = cpu_to_le32(inode->i_ctime_nsec);
-- 
2.24.4



More information about the Linux-erofs mailing list