Skip to content

Commit 181964e

Browse files
Al Virodavem330
authored andcommitted
fix a braino in cmsghdr_from_user_compat_to_kern()
commit 547ce4c ("switch cmsghdr_from_user_compat_to_kern() to copy_from_user()") missed one of the places where ucmlen should've been replaced with cmsg.cmsg_len, now that we are fetching the entire struct rather than doing it field-by-field. As the result, compat sendmsg() with several different-sized cmsg attached started to fail with EINVAL. Trivial to fix, fortunately. Fixes: 547ce4c ("switch cmsghdr_from_user_compat_to_kern() to copy_from_user()") Reported-by: Nick Bowler <[email protected]> Tested-by: Nick Bowler <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 11d2681 commit 181964e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/compat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg, struct sock *sk,
202202

203203
/* Advance. */
204204
kcmsg = (struct cmsghdr *)((char *)kcmsg + tmp);
205-
ucmsg = cmsg_compat_nxthdr(kmsg, ucmsg, ucmlen);
205+
ucmsg = cmsg_compat_nxthdr(kmsg, ucmsg, cmsg.cmsg_len);
206206
}
207207

208208
/*

0 commit comments

Comments
 (0)