mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 03:06:10 +00:00
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: Rodolfo Giometti <giometti@linux.it> Tested-by: Reg Clemens <clemens@dwf.com> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
69fd8d2467
commit
cbf83cc5a2
1 changed files with 8 additions and 3 deletions
|
@ -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, ¶ms, sizeof(struct pps_kparams));
|
||||
if (err)
|
||||
return -EFAULT;
|
||||
|
||||
|
|
Loading…
Reference in a new issue