提交 e57ba9db 编写于 作者: D Dan Carpenter 提交者: Greg Kroah-Hartman

fbdev: sbuslib: use checked version of put_user()

[ Upstream commit d8bad911e5e55e228d59c0606ff7e6b8131ca7bf ]

I'm not sure why the code assumes that only the first put_user() needs
an access_ok() check.  I have made all the put_user() and get_user()
calls checked.
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Cc: Mathieu Malaterre <malat@debian.org>
Cc: Peter Malone <peter.malone@gmail.com>,
Signed-off-by: NBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
上级 964cd867
...@@ -106,11 +106,11 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, ...@@ -106,11 +106,11 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg,
struct fbtype __user *f = (struct fbtype __user *) arg; struct fbtype __user *f = (struct fbtype __user *) arg;
if (put_user(type, &f->fb_type) || if (put_user(type, &f->fb_type) ||
__put_user(info->var.yres, &f->fb_height) || put_user(info->var.yres, &f->fb_height) ||
__put_user(info->var.xres, &f->fb_width) || put_user(info->var.xres, &f->fb_width) ||
__put_user(fb_depth, &f->fb_depth) || put_user(fb_depth, &f->fb_depth) ||
__put_user(0, &f->fb_cmsize) || put_user(0, &f->fb_cmsize) ||
__put_user(fb_size, &f->fb_cmsize)) put_user(fb_size, &f->fb_cmsize))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
...@@ -125,10 +125,10 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, ...@@ -125,10 +125,10 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg,
unsigned int index, count, i; unsigned int index, count, i;
if (get_user(index, &c->index) || if (get_user(index, &c->index) ||
__get_user(count, &c->count) || get_user(count, &c->count) ||
__get_user(ured, &c->red) || get_user(ured, &c->red) ||
__get_user(ugreen, &c->green) || get_user(ugreen, &c->green) ||
__get_user(ublue, &c->blue)) get_user(ublue, &c->blue))
return -EFAULT; return -EFAULT;
cmap.len = 1; cmap.len = 1;
...@@ -165,10 +165,10 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, ...@@ -165,10 +165,10 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg,
u8 red, green, blue; u8 red, green, blue;
if (get_user(index, &c->index) || if (get_user(index, &c->index) ||
__get_user(count, &c->count) || get_user(count, &c->count) ||
__get_user(ured, &c->red) || get_user(ured, &c->red) ||
__get_user(ugreen, &c->green) || get_user(ugreen, &c->green) ||
__get_user(ublue, &c->blue)) get_user(ublue, &c->blue))
return -EFAULT; return -EFAULT;
if (index + count > cmap->len) if (index + count > cmap->len)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册