projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
69fd8d2
)
pps: locking scheme fix up for PPS_GETPARAMS
author
Rodolfo Giometti
<
[email protected]
>
Wed, 11 Nov 2009 22:26:52 +0000
(14:26 -0800)
committer
Linus Torvalds
<
[email protected]
>
Thu, 12 Nov 2009 15:26:00 +0000
(07:26 -0800)
Userland programs may read/write PPS parameters at same time and these
operations may corrupt PPS data.
Signed-off-by: Rodolfo Giometti <
[email protected]
>
Tested-by: Reg Clemens <
[email protected]
>
Cc: <
[email protected]
>
Signed-off-by: Andrew Morton <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
drivers/pps/pps.c
patch
|
blob
|
history
diff --git
a/drivers/pps/pps.c
b/drivers/pps/pps.c
index fea17e7805e9d5e846998c16d965711628e4bc8b..ca5183bdad85f1384845bc8a525652edaadd534d 100644
(file)
--- a/
drivers/pps/pps.c
+++ b/
drivers/pps/pps.c
@@
-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;