Skip to content

Commit ebe0603

Browse files
Dr. David Alan Gilbertkleikamp
authored andcommitted
jfs: Fix fortify moan in symlink
JFS has in jfs_incore.h: /* _inline may overflow into _inline_ea when needed */ /* _inline_ea may overlay the last part of * file._xtroot if maxentry = XTROOTINITSLOT */ union { struct { /* 128: inline symlink */ unchar _inline[128]; /* 128: inline extended attr */ unchar _inline_ea[128]; }; unchar _inline_all[256]; and currently the symlink code copies into _inline; if this is larger than 128 bytes it triggers a fortify warning of the form: memcpy: detected field-spanning write (size 132) of single field "ip->i_link" at fs/jfs/namei.c:950 (size 18446744073709551615) when it's actually OK. Copy it into _inline_all instead. Reported-by: [email protected] Signed-off-by: Dr. David Alan Gilbert <[email protected]> Reviewed-by: Kees Cook <[email protected]> Signed-off-by: Dave Kleikamp <[email protected]>
1 parent dee8744 commit ebe0603

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/jfs/namei.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ static int jfs_symlink(struct user_namespace *mnt_userns, struct inode *dip,
946946
if (ssize <= IDATASIZE) {
947947
ip->i_op = &jfs_fast_symlink_inode_operations;
948948

949-
ip->i_link = JFS_IP(ip)->i_inline;
949+
ip->i_link = JFS_IP(ip)->i_inline_all;
950950
memcpy(ip->i_link, name, ssize);
951951
ip->i_size = ssize - 1;
952952

0 commit comments

Comments
 (0)