Commit d8b29efa authored by Alexander Usyskin's avatar Alexander Usyskin Committed by Greg Kroah-Hartman

mei: mei_write correct checks for copy_from_user

1. return -EFUALT when copy_from_user fails
2. display error message on failure in error level
Signed-off-by: default avatarAlexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 23f5a322
...@@ -404,8 +404,11 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf, ...@@ -404,8 +404,11 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
goto out; goto out;
rets = copy_from_user(write_cb->request_buffer.data, ubuf, length); rets = copy_from_user(write_cb->request_buffer.data, ubuf, length);
if (rets) if (rets) {
dev_err(&dev->pdev->dev, "failed to copy data from userland\n");
rets = -EFAULT;
goto out; goto out;
}
if (cl == &dev->iamthif_cl) { if (cl == &dev->iamthif_cl) {
rets = mei_amthif_write(dev, write_cb); rets = mei_amthif_write(dev, write_cb);
...@@ -567,7 +570,7 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data) ...@@ -567,7 +570,7 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
dev_dbg(&dev->pdev->dev, "copy connect data from user\n"); dev_dbg(&dev->pdev->dev, "copy connect data from user\n");
if (copy_from_user(connect_data, (char __user *)data, if (copy_from_user(connect_data, (char __user *)data,
sizeof(struct mei_connect_client_data))) { sizeof(struct mei_connect_client_data))) {
dev_dbg(&dev->pdev->dev, "failed to copy data from userland\n"); dev_err(&dev->pdev->dev, "failed to copy data from userland\n");
rets = -EFAULT; rets = -EFAULT;
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment