提交 fb5a18cf 编写于 作者: D Dan Carpenter 提交者: John Stultz

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: NDan Carpenter <error27@gmail.com>
Acked-by: NRichard Cochran <richard.cochran@omicron.at>
Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
上级 e23ef227
......@@ -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;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册