[char-misc-next 3/5] mei: mei_write correct checks for copy_from_user
From: Alexander Usyskin 1. return -EFUALT when copy_from_user fails 2. display error message on failure in error level Signed-off-by: Alexander Usyskin Signed-off-by: Tomas Winkler --- drivers/misc/mei/main.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index 173ff09..5ff810b 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c @@ -404,8 +404,11 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf, goto out; rets = copy_from_user(write_cb->request_buffer.data, ubuf, length); - if (rets) + if (rets) { + dev_err(>pdev->dev, "failed to copy data from userland\n"); + rets = -EFAULT; goto out; + } if (cl == >iamthif_cl) { rets = mei_amthif_write(dev, write_cb); @@ -567,7 +570,7 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data) dev_dbg(>pdev->dev, "copy connect data from user\n"); if (copy_from_user(connect_data, (char __user *)data, sizeof(struct mei_connect_client_data))) { - dev_dbg(>pdev->dev, "failed to copy data from userland\n"); + dev_err(>pdev->dev, "failed to copy data from userland\n"); rets = -EFAULT; goto out; } -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[char-misc-next 3/5] mei: mei_write correct checks for copy_from_user
From: Alexander Usyskin alexander.usys...@intel.com 1. return -EFUALT when copy_from_user fails 2. display error message on failure in error level Signed-off-by: Alexander Usyskin alexander.usys...@intel.com Signed-off-by: Tomas Winkler tomas.wink...@intel.com --- drivers/misc/mei/main.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index 173ff09..5ff810b 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c @@ -404,8 +404,11 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf, goto out; 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; + } if (cl == dev-iamthif_cl) { rets = mei_amthif_write(dev, write_cb); @@ -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); if (copy_from_user(connect_data, (char __user *)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; goto out; } -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/