diff options
author | Vegard Nossum <vegard.nossum@gmail.com> | 2008-11-30 12:17:19 +0100 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2008-11-30 12:17:19 +0100 |
commit | c6bf514c6e0171c5b731beffaa0c4463e2335f3d (patch) | |
tree | a7a2a7ac9f39175173b1835901e9763762adddd8 /net/bluetooth | |
parent | 7644d63d1348ec044ccd8f775fefe5eb7cbcac69 (diff) | |
download | op-kernel-dev-c6bf514c6e0171c5b731beffaa0c4463e2335f3d.zip op-kernel-dev-c6bf514c6e0171c5b731beffaa0c4463e2335f3d.tar.gz |
Bluetooth: Fix leak of uninitialized data to userspace
struct hci_dev_list_req {
__u16 dev_num;
struct hci_dev_req dev_req[0]; /* hci_dev_req structures */
};
sizeof(struct hci_dev_list_req) == 4, so the two bytes immediately
following "dev_num" will never be initialized. When this structure
is copied to userspace, these uninitialized bytes are leaked.
Fix by using kzalloc() instead of kmalloc(). Found using kmemcheck.
Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/hci_core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 278a3ac..7bb0f1c 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -756,7 +756,7 @@ int hci_get_dev_list(void __user *arg) size = sizeof(*dl) + dev_num * sizeof(*dr); - if (!(dl = kmalloc(size, GFP_KERNEL))) + if (!(dl = kzalloc(size, GFP_KERNEL))) return -ENOMEM; dr = dl->dev_req; |