From: Tomas Winkler <tomas.winkler@intel.com>
To: gregkh@linuxfoundation.org
Cc: arnd@arndb.de, linux-kernel@vger.kernel.org,
Alexander Usyskin <alexander.usyskin@intel.com>,
Tomas Winkler <tomas.winkler@intel.com>
Subject: [char-misc-next 3/5] mei: mei_write correct checks for copy_from_user
Date: Mon, 2 Sep 2013 03:11:02 +0300 [thread overview]
Message-ID: <1378080664-7274-4-git-send-email-tomas.winkler@intel.com> (raw)
In-Reply-To: <1378080664-7274-1-git-send-email-tomas.winkler@intel.com>
From: Alexander Usyskin <alexander.usyskin@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.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@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
next prev parent reply other threads:[~2013-09-02 0:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-02 0:10 [char-misc-next 0/5] mei driver small fixes and cleanups Tomas Winkler
2013-09-02 0:11 ` [char-misc-next 1/5] mei: mei_cl_link protect open_handle_count from overflow Tomas Winkler
2013-09-02 0:11 ` [char-misc-next 2/5] mei: make sure that me_clients_map big enough before copying Tomas Winkler
2013-09-02 0:11 ` Tomas Winkler [this message]
2013-09-02 0:11 ` [char-misc-next 4/5] mei: fix format compilation warrning on 32 bit architecture Tomas Winkler
2013-09-02 0:11 ` [char-misc-next 5/5] mei: revamp read and write length checks Tomas Winkler
2013-09-26 15:22 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1378080664-7274-4-git-send-email-tomas.winkler@intel.com \
--to=tomas.winkler@intel.com \
--cc=alexander.usyskin@intel.com \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®