mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
[PATCH] Fix 32bit sendmsg() flaw
When we copy 32bit ->msg_control contents to kernel, we walk the same userland data twice without sanity checks on the second pass. Second version of this patch: the original broke with 64-bit arches running 32-bit-compat-mode executables doing sendmsg() syscalls with unaligned CMSG data areas Another thing is that we use kmalloc() to allocate and sock_kfree_s() to free afterwards; less serious, but also needs fixing. Signed-off-by: Al Viro <[email protected]> Signed-off-by: David Woodhouse <[email protected]> Signed-off-by: Chris Wright <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
5aa3b610a7
commit
8920e8f94c
3 changed files with 29 additions and 20 deletions
|
|
@ -1745,10 +1745,11 @@ asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags)
|
|||
goto out_freeiov;
|
||||
ctl_len = msg_sys.msg_controllen;
|
||||
if ((MSG_CMSG_COMPAT & flags) && ctl_len) {
|
||||
err = cmsghdr_from_user_compat_to_kern(&msg_sys, ctl, sizeof(ctl));
|
||||
err = cmsghdr_from_user_compat_to_kern(&msg_sys, sock->sk, ctl, sizeof(ctl));
|
||||
if (err)
|
||||
goto out_freeiov;
|
||||
ctl_buf = msg_sys.msg_control;
|
||||
ctl_len = msg_sys.msg_controllen;
|
||||
} else if (ctl_len) {
|
||||
if (ctl_len > sizeof(ctl))
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue