summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hidp/core.c
diff options
context:
space:
mode:
authorFabian Frederick2014-11-14 19:35:05 +0100
committerMarcel Holtmann2014-11-15 01:30:16 +0100
commita809eff11f81e2dcf1e792586ef70693c60d7dc8 (patch)
tree64b569a699a83caf4ef36ed40f3db693792ddd96 /net/bluetooth/hidp/core.c
parentBluetooth: Fix correct nesting for 6lowpan server channel (diff)
downloadkernel-qcow2-linux-a809eff11f81e2dcf1e792586ef70693c60d7dc8.tar.gz
kernel-qcow2-linux-a809eff11f81e2dcf1e792586ef70693c60d7dc8.tar.xz
kernel-qcow2-linux-a809eff11f81e2dcf1e792586ef70693c60d7dc8.zip
Bluetooth: hidp: replace kzalloc/copy_from_user by memdup_user
use memdup_user for rd_data import. Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hidp/core.c')
-rw-r--r--net/bluetooth/hidp/core.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index 1b7d605706aa..cc25d0b74b36 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -736,14 +736,10 @@ static int hidp_setup_hid(struct hidp_session *session,
struct hid_device *hid;
int err;
- session->rd_data = kzalloc(req->rd_size, GFP_KERNEL);
- if (!session->rd_data)
- return -ENOMEM;
+ session->rd_data = memdup_user(req->rd_data, req->rd_size);
+ if (IS_ERR(session->rd_data))
+ return PTR_ERR(session->rd_data);
- if (copy_from_user(session->rd_data, req->rd_data, req->rd_size)) {
- err = -EFAULT;
- goto fault;
- }
session->rd_size = req->rd_size;
hid = hid_allocate_device();