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:
e23ef22
)
ptp: Fix some locking bugs in ptp_read()
author
Dan Carpenter
<
[email protected]
>
Sun, 29 May 2011 19:54:07 +0000
(22:54 +0300)
committer
John Stultz
<
[email protected]
>
Thu, 2 Jun 2011 02:29:10 +0000
(19:29 -0700)
In ptp_read there is an unlock missing on an error path, and a double
unlock on another error path.
Signed-off-by: Dan Carpenter <
[email protected]
>
Acked-by: Richard Cochran <
[email protected]
>
Signed-off-by: John Stultz <
[email protected]
>
drivers/ptp/ptp_chardev.c
patch
|
blob
|
history
diff --git
a/drivers/ptp/ptp_chardev.c
b/drivers/ptp/ptp_chardev.c
index 93fa22de59773c51074103a06fd8c6118a843dd7..e7f301da290286153180fc5f1a9e02cdd9bb5f01 100644
(file)
--- 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;
}