[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1257005003-9889-1-git-send-email-giometti@linux.it>
Date: Sat, 31 Oct 2009 17:03:23 +0100
From: Rodolfo Giometti <giometti@...ux.it>
To: linux-kernel@...r.kernel.org
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Rodolfo Giometti <giometti@...ux.it>
Subject: [PATCH] pps: locking scheme fix up for PPS_GETPARAMS.
Signed-off-by: Rodolfo Giometti <giometti@...ux.it>
Tested-by: Reg Clemens <clemens@....com>
---
drivers/pps/pps.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c
index fea17e7..ca5183b 100644
--- 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;
--
1.6.3.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists