mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
ptp: Fix some locking bugs in ptp_read()
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 <error27@gmail.com> Acked-by: Richard Cochran <richard.cochran@omicron.at> Signed-off-by: John Stultz <john.stultz@linaro.org>
This commit is contained in:
parent
e23ef227d1
commit
fb5a18cf7c
1 changed files with 4 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue