* [patch 2/2] ptp: fix some locking bugs in ptp_read()
@ 2011-05-29 19:54 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2011-05-29 19:54 UTC (permalink / raw)
To: Richard Cochran
Cc: David S. Miller, John Stultz, Arnd Bergmann, open list, kernel-janitors
There was an unlock missing on an error path, and a double unlock on
another error path.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
index 93fa22d..e7f301da2 100644
--- a/drivers/ptp/ptp_chardev.c
+++ b/drivers/ptp/ptp_chardev.c
@@ -130,8 +130,10 @@ ssize_t ptp_read(struct posix_clock *pc,
return -ERESTARTSYS;
}
- if (ptp->defunct)
+ if (ptp->defunct) {
+ mutex_unlock(&ptp->tsevq_mux);
return -ENODEV;
+ }
spin_lock_irqsave(&queue->lock, flags);
@@ -151,10 +153,8 @@ ssize_t ptp_read(struct posix_clock *pc,
mutex_unlock(&ptp->tsevq_mux);
- if (copy_to_user(buf, event, cnt)) {
- mutex_unlock(&ptp->tsevq_mux);
+ if (copy_to_user(buf, event, cnt))
return -EFAULT;
- }
return cnt;
}
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [patch 2/2] ptp: fix some locking bugs in ptp_read()
@ 2011-05-29 19:54 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2011-05-29 19:54 UTC (permalink / raw)
To: Richard Cochran
Cc: David S. Miller, John Stultz, Arnd Bergmann, open list, kernel-janitors
There was an unlock missing on an error path, and a double unlock on
another error path.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
index 93fa22d..e7f301da2 100644
--- a/drivers/ptp/ptp_chardev.c
+++ b/drivers/ptp/ptp_chardev.c
@@ -130,8 +130,10 @@ ssize_t ptp_read(struct posix_clock *pc,
return -ERESTARTSYS;
}
- if (ptp->defunct)
+ if (ptp->defunct) {
+ mutex_unlock(&ptp->tsevq_mux);
return -ENODEV;
+ }
spin_lock_irqsave(&queue->lock, flags);
@@ -151,10 +153,8 @@ ssize_t ptp_read(struct posix_clock *pc,
mutex_unlock(&ptp->tsevq_mux);
- if (copy_to_user(buf, event, cnt)) {
- mutex_unlock(&ptp->tsevq_mux);
+ if (copy_to_user(buf, event, cnt))
return -EFAULT;
- }
return cnt;
}
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [patch 2/2] ptp: fix some locking bugs in ptp_read()
2011-05-29 19:54 ` Dan Carpenter
@ 2011-05-30 6:16 ` Richard Cochran
-1 siblings, 0 replies; 6+ messages in thread
From: Richard Cochran @ 2011-05-30 6:16 UTC (permalink / raw)
To: Dan Carpenter
Cc: Richard Cochran, David S. Miller, John Stultz, Arnd Bergmann,
open list, kernel-janitors, Thomas Gleixner
On Sun, May 29, 2011 at 10:54:07PM +0300, Dan Carpenter wrote:
> There was an unlock missing on an error path, and a double unlock on
> another error path.
Sloppy, sloppy me.
Again, please take this for 3.0-rc2.
Thanks,
Richard
> Signed-off-by: Dan Carpenter <error27@gmail.com>
>
> diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
> index 93fa22d..e7f301da2 100644
> --- a/drivers/ptp/ptp_chardev.c
> +++ b/drivers/ptp/ptp_chardev.c
> @@ -130,8 +130,10 @@ ssize_t ptp_read(struct posix_clock *pc,
> return -ERESTARTSYS;
> }
>
> - if (ptp->defunct)
> + if (ptp->defunct) {
> + mutex_unlock(&ptp->tsevq_mux);
> return -ENODEV;
> + }
>
> spin_lock_irqsave(&queue->lock, flags);
>
> @@ -151,10 +153,8 @@ ssize_t ptp_read(struct posix_clock *pc,
>
> mutex_unlock(&ptp->tsevq_mux);
>
> - if (copy_to_user(buf, event, cnt)) {
> - mutex_unlock(&ptp->tsevq_mux);
> + if (copy_to_user(buf, event, cnt))
> return -EFAULT;
> - }
>
> return cnt;
> }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch 2/2] ptp: fix some locking bugs in ptp_read()
@ 2011-05-30 6:16 ` Richard Cochran
0 siblings, 0 replies; 6+ messages in thread
From: Richard Cochran @ 2011-05-30 6:16 UTC (permalink / raw)
To: Dan Carpenter
Cc: Richard Cochran, David S. Miller, John Stultz, Arnd Bergmann,
open list, kernel-janitors, Thomas Gleixner
On Sun, May 29, 2011 at 10:54:07PM +0300, Dan Carpenter wrote:
> There was an unlock missing on an error path, and a double unlock on
> another error path.
Sloppy, sloppy me.
Again, please take this for 3.0-rc2.
Thanks,
Richard
> Signed-off-by: Dan Carpenter <error27@gmail.com>
>
> diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
> index 93fa22d..e7f301da2 100644
> --- a/drivers/ptp/ptp_chardev.c
> +++ b/drivers/ptp/ptp_chardev.c
> @@ -130,8 +130,10 @@ ssize_t ptp_read(struct posix_clock *pc,
> return -ERESTARTSYS;
> }
>
> - if (ptp->defunct)
> + if (ptp->defunct) {
> + mutex_unlock(&ptp->tsevq_mux);
> return -ENODEV;
> + }
>
> spin_lock_irqsave(&queue->lock, flags);
>
> @@ -151,10 +153,8 @@ ssize_t ptp_read(struct posix_clock *pc,
>
> mutex_unlock(&ptp->tsevq_mux);
>
> - if (copy_to_user(buf, event, cnt)) {
> - mutex_unlock(&ptp->tsevq_mux);
> + if (copy_to_user(buf, event, cnt))
> return -EFAULT;
> - }
>
> return cnt;
> }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch 2/2] ptp: fix some locking bugs in ptp_read()
2011-05-29 19:54 ` Dan Carpenter
@ 2011-06-01 10:18 ` Richard Cochran
-1 siblings, 0 replies; 6+ messages in thread
From: Richard Cochran @ 2011-06-01 10:18 UTC (permalink / raw)
To: Dan Carpenter
Cc: Richard Cochran, David S. Miller, John Stultz, Arnd Bergmann,
open list, kernel-janitors
On Sun, May 29, 2011 at 10:54:07PM +0300, Dan Carpenter wrote:
> There was an unlock missing on an error path, and a double unlock on
> another error path.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Richard Cochran <richard.cochran@omicron.at>
>
> diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
> index 93fa22d..e7f301da2 100644
> --- a/drivers/ptp/ptp_chardev.c
> +++ b/drivers/ptp/ptp_chardev.c
> @@ -130,8 +130,10 @@ ssize_t ptp_read(struct posix_clock *pc,
> return -ERESTARTSYS;
> }
>
> - if (ptp->defunct)
> + if (ptp->defunct) {
> + mutex_unlock(&ptp->tsevq_mux);
> return -ENODEV;
> + }
>
> spin_lock_irqsave(&queue->lock, flags);
>
> @@ -151,10 +153,8 @@ ssize_t ptp_read(struct posix_clock *pc,
>
> mutex_unlock(&ptp->tsevq_mux);
>
> - if (copy_to_user(buf, event, cnt)) {
> - mutex_unlock(&ptp->tsevq_mux);
> + if (copy_to_user(buf, event, cnt))
> return -EFAULT;
> - }
>
> return cnt;
> }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch 2/2] ptp: fix some locking bugs in ptp_read()
@ 2011-06-01 10:18 ` Richard Cochran
0 siblings, 0 replies; 6+ messages in thread
From: Richard Cochran @ 2011-06-01 10:18 UTC (permalink / raw)
To: Dan Carpenter
Cc: Richard Cochran, David S. Miller, John Stultz, Arnd Bergmann,
open list, kernel-janitors
On Sun, May 29, 2011 at 10:54:07PM +0300, Dan Carpenter wrote:
> There was an unlock missing on an error path, and a double unlock on
> another error path.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Richard Cochran <richard.cochran@omicron.at>
>
> diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
> index 93fa22d..e7f301da2 100644
> --- a/drivers/ptp/ptp_chardev.c
> +++ b/drivers/ptp/ptp_chardev.c
> @@ -130,8 +130,10 @@ ssize_t ptp_read(struct posix_clock *pc,
> return -ERESTARTSYS;
> }
>
> - if (ptp->defunct)
> + if (ptp->defunct) {
> + mutex_unlock(&ptp->tsevq_mux);
> return -ENODEV;
> + }
>
> spin_lock_irqsave(&queue->lock, flags);
>
> @@ -151,10 +153,8 @@ ssize_t ptp_read(struct posix_clock *pc,
>
> mutex_unlock(&ptp->tsevq_mux);
>
> - if (copy_to_user(buf, event, cnt)) {
> - mutex_unlock(&ptp->tsevq_mux);
> + if (copy_to_user(buf, event, cnt))
> return -EFAULT;
> - }
>
> return cnt;
> }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-06-01 10:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-29 19:54 [patch 2/2] ptp: fix some locking bugs in ptp_read() Dan Carpenter
2011-05-29 19:54 ` Dan Carpenter
2011-05-30 6:16 ` Richard Cochran
2011-05-30 6:16 ` Richard Cochran
2011-06-01 10:18 ` Richard Cochran
2011-06-01 10:18 ` Richard Cochran
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.