提交 cbf83cc5 编写于 作者: R Rodolfo Giometti 提交者: Linus Torvalds

pps: locking scheme fix up for PPS_GETPARAMS

Userland programs may read/write PPS parameters at same time and these
operations may corrupt PPS data.
Signed-off-by: NRodolfo Giometti <giometti@linux.it>
Tested-by: NReg Clemens <clemens@dwf.com>
Cc: <stable@kernel.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 69fd8d24
......@@ -71,9 +71,14 @@ static long pps_cdev_ioctl(struct file *file,
case PPS_GETPARAMS:
pr_debug("PPS_GETPARAMS: source %d\n", pps->id);
/* Return current parameters */
err = copy_to_user(uarg, &pps->params,
sizeof(struct pps_kparams));
spin_lock_irq(&pps->lock);
/* Get the current parameters */
params = pps->params;
spin_unlock_irq(&pps->lock);
err = copy_to_user(uarg, &params, sizeof(struct pps_kparams));
if (err)
return -EFAULT;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册