diff mbox

[Lucid,CVE-2013-1928] fs/compat_ioctl.c: VIDEO_SET_SPU_PALETTE missing error check

Message ID 1365772472-12151-1-git-send-email-luis.henriques@canonical.com
State New
Headers show

Commit Message

Luis Henriques April 12, 2013, 1:14 p.m. UTC
From: Kees Cook <keescook@chromium.org>

CVE-2013-1928

BugLink: http://bugs.launchpad.net/bugs/1167061

The compat ioctl for VIDEO_SET_SPU_PALETTE was missing an error check
while converting ioctl arguments.  This could lead to leaking kernel
stack contents into userspace.

Patch extracted from existing fix in grsecurity.

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: David Miller <davem@davemloft.net>
Cc: Brad Spengler <spender@grsecurity.net>
Cc: PaX Team <pageexec@freemail.hu>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 12176503366885edd542389eed3aaf94be163fdb)

Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/compat_ioctl.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Stefan Bader April 12, 2013, 1:53 p.m. UTC | #1

Tim Gardner April 12, 2013, 2:09 p.m. UTC | #2

diff mbox

Patch

diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index c30134b..98d3c58 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -234,6 +234,8 @@  static int do_video_set_spu_palette(unsigned int fd, unsigned int cmd, unsigned
 	up = (struct compat_video_spu_palette __user *) arg;
 	err  = get_user(palp, &up->palette);
 	err |= get_user(length, &up->length);
+	if (err)
+		return -EFAULT;
 
 	up_native = compat_alloc_user_space(sizeof(struct video_spu_palette));
 	err  = put_user(compat_ptr(palp), &up_native->palette);