Skip to contentSkip to conversation

pps: locking scheme fix up for PPS_GETPARAMS.

PATCH In review Rodolfo Giometti 2 participants 2 messages Oct 31, 2009 – Nov 3, 2009 PPS support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pps: locking scheme fix up for PPS_GETPARAMS.

---
 drivers/pps/pps.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
drivers/pps/pps.c +8 -3
index fea17e7..ca5183b 100644
@@ -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;
 
Signature · 1 line
1.6.3.3
#1 lore raw
Quoted 2 lines · On Sat, 31 Oct 2009 17:03:23 +0100 Rodolfo Giometti <[email protected]> wrote:

Please don't send unchangelogged patches.

Quoted 13 lines
drivers/pps/pps.c +1 -3
index fea17e7..ca5183b 100644
@@ -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);

drivers/pps/pps.c static long pps_cdev_ioctl(struct file *file, · line 84

Quoted 10 lines
drivers/pps/pps.c +7 -0
+
+		/* 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;
 

OK, I can see what the patch does and I can guess what sort of situations would trigger it. But that's really not good enough.

Put yourself in the position of someone who is hitting a PPS bug and wants to work out if your patch might fix it. Because the patch fails to describe the user-visible symptoms (ie: the bug) then that person is in the dark.

Also, someone (ie: me) needs to decide if this fix is to be backported into earlier kernels. With no description of the end-user impact, how can I possibly do that?