Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Rodolfo Giometti and committed by
Linus Torvalds
cbf83cc5 69fd8d24

+8 -3
+8 -3
drivers/pps/pps.c
··· 71 71 case PPS_GETPARAMS: 72 72 pr_debug("PPS_GETPARAMS: source %d\n", pps->id); 73 73 74 - /* Return current parameters */ 75 - err = copy_to_user(uarg, &pps->params, 76 - sizeof(struct pps_kparams)); 74 + spin_lock_irq(&pps->lock); 75 + 76 + /* Get the current parameters */ 77 + params = pps->params; 78 + 79 + spin_unlock_irq(&pps->lock); 80 + 81 + err = copy_to_user(uarg, &params, sizeof(struct pps_kparams)); 77 82 if (err) 78 83 return -EFAULT; 79 84