aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Usyskin <alexander.usyskin@intel.com>2014-03-12 07:19:13 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-03-17 18:53:28 -0400
commitdbac4745270bb8a8c5f119d21ce25764e9d7557d (patch)
tree3c0a5fa053eba76b030f9bd451f8b75321ddb264
parent80260f2360d34912cd8cb18aca6eda20e9db2ef0 (diff)
mei: report consistently copy_from/to_user failures
Consistently display error on possible copy_from/to_user failures use dev_dbg so it cannot be abused to flood the kernel log Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/misc/mei/amthif.c4
-rw-r--r--drivers/misc/mei/main.c5
2 files changed, 6 insertions, 3 deletions
diff --git a/drivers/misc/mei/amthif.c b/drivers/misc/mei/amthif.c
index b75a7da1ca84..2052609b167a 100644
--- a/drivers/misc/mei/amthif.c
+++ b/drivers/misc/mei/amthif.c
@@ -244,8 +244,10 @@ int mei_amthif_read(struct mei_device *dev, struct file *file,
244 * the buf_idx may point beyond */ 244 * the buf_idx may point beyond */
245 length = min_t(size_t, length, (cb->buf_idx - *offset)); 245 length = min_t(size_t, length, (cb->buf_idx - *offset));
246 246
247 if (copy_to_user(ubuf, cb->response_buffer.data + *offset, length)) 247 if (copy_to_user(ubuf, cb->response_buffer.data + *offset, length)) {
248 dev_dbg(&dev->pdev->dev, "failed to copy data to userland\n");
248 rets = -EFAULT; 249 rets = -EFAULT;
250 }
249 else { 251 else {
250 rets = length; 252 rets = length;
251 if ((*offset + length) < cb->buf_idx) { 253 if ((*offset + length) < cb->buf_idx) {
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
index 4e069b88cc46..bc1c39e72648 100644
--- a/drivers/misc/mei/main.c
+++ b/drivers/misc/mei/main.c
@@ -280,6 +280,7 @@ copy_buffer:
280 length = min_t(size_t, length, cb->buf_idx - *offset); 280 length = min_t(size_t, length, cb->buf_idx - *offset);
281 281
282 if (copy_to_user(ubuf, cb->response_buffer.data + *offset, length)) { 282 if (copy_to_user(ubuf, cb->response_buffer.data + *offset, length)) {
283 dev_dbg(&dev->pdev->dev, "failed to copy data to userland\n");
283 rets = -EFAULT; 284 rets = -EFAULT;
284 goto free; 285 goto free;
285 } 286 }
@@ -400,7 +401,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
400 401
401 rets = copy_from_user(write_cb->request_buffer.data, ubuf, length); 402 rets = copy_from_user(write_cb->request_buffer.data, ubuf, length);
402 if (rets) { 403 if (rets) {
403 dev_err(&dev->pdev->dev, "failed to copy data from userland\n"); 404 dev_dbg(&dev->pdev->dev, "failed to copy data from userland\n");
404 rets = -EFAULT; 405 rets = -EFAULT;
405 goto out; 406 goto out;
406 } 407 }
@@ -565,7 +566,7 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
565 dev_dbg(&dev->pdev->dev, "copy connect data from user\n"); 566 dev_dbg(&dev->pdev->dev, "copy connect data from user\n");
566 if (copy_from_user(connect_data, (char __user *)data, 567 if (copy_from_user(connect_data, (char __user *)data,
567 sizeof(struct mei_connect_client_data))) { 568 sizeof(struct mei_connect_client_data))) {
568 dev_err(&dev->pdev->dev, "failed to copy data from userland\n"); 569 dev_dbg(&dev->pdev->dev, "failed to copy data from userland\n");
569 rets = -EFAULT; 570 rets = -EFAULT;
570 goto out; 571 goto out;
571 } 572 }