提交 8e8505be 编写于 作者: C Clemens Ladisch 提交者: Linus Torvalds

[PATCH] hpet: fix HPET_INFO calls from kernel space

Fix a wrong memory access in hpet_ioctl_common().  It was not possible to use
the HPET_INFO ioctl from kernel space because it always called copy_to_user().
Signed-off-by: NClemens Ladisch <clemens@ladisch.de>
Cc: Bob Picco <bob.picco@hp.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 7811fb8f
......@@ -500,8 +500,12 @@ hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel)
readq(&timer->hpet_config) & Tn_PER_INT_CAP_MASK;
info.hi_hpet = devp->hd_hpets->hp_which;
info.hi_timer = devp - devp->hd_hpets->hp_dev;
if (copy_to_user((void __user *)arg, &info, sizeof(info)))
err = -EFAULT;
if (kernel)
memcpy((void *)arg, &info, sizeof(info));
else
if (copy_to_user((void __user *)arg, &info,
sizeof(info)))
err = -EFAULT;
break;
}
case HPET_EPI:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册