net: bluetooth: ioctl entry to modify auth info.

According to the current distributed security logic between
kernel-userspace, the kernel is not aware of the level of
security that a link-key provides when userspace responds
to the link key request. Adding a ioctl entry which will
update the kernel space auth_key's level of security as soon
as userspace responds to the link key request.

CRs-fixed: 264601
Change-Id: I6765cce92a6f8b761742d57ea94e81502f6e7fcf
Signed-off-by: NaveenKumar <naveenr@codeaurora.org>
This commit is contained in:
NaveenKumar
2011-03-14 15:45:47 +05:30
committed by Stephen Boyd
parent b707f02ced
commit 375cef1458
5 changed files with 29 additions and 2 deletions

View File

@@ -5,6 +5,7 @@
* Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be) * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
* Copyright (C) 2001,2002 Andi Kleen, SuSE Labs * Copyright (C) 2001,2002 Andi Kleen, SuSE Labs
* Copyright (C) 2003 Pavel Machek (pavel@ucw.cz) * Copyright (C) 2003 Pavel Machek (pavel@ucw.cz)
* Copyright (c) 2011 Code Aurora Forum. All rights reserved.
* *
* These routines maintain argument size conversion between 32bit and 64bit * These routines maintain argument size conversion between 32bit and 64bit
* ioctls. * ioctls.
@@ -1214,6 +1215,7 @@ COMPATIBLE_IOCTL(HCIGETDEVINFO)
COMPATIBLE_IOCTL(HCIGETCONNLIST) COMPATIBLE_IOCTL(HCIGETCONNLIST)
COMPATIBLE_IOCTL(HCIGETCONNINFO) COMPATIBLE_IOCTL(HCIGETCONNINFO)
COMPATIBLE_IOCTL(HCIGETAUTHINFO) COMPATIBLE_IOCTL(HCIGETAUTHINFO)
COMPATIBLE_IOCTL(HCISETAUTHINFO)
COMPATIBLE_IOCTL(HCISETRAW) COMPATIBLE_IOCTL(HCISETRAW)
COMPATIBLE_IOCTL(HCISETSCAN) COMPATIBLE_IOCTL(HCISETSCAN)
COMPATIBLE_IOCTL(HCISETAUTH) COMPATIBLE_IOCTL(HCISETAUTH)

View File

@@ -1,6 +1,6 @@
/* /*
BlueZ - Bluetooth protocol stack for Linux BlueZ - Bluetooth protocol stack for Linux
Copyright (c) 2000-2001, 2010, Code Aurora Forum. All rights reserved. Copyright (c) 2000-2001, 2010-2011 Code Aurora Forum. All rights reserved.
Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
@@ -99,6 +99,7 @@ enum {
#define HCIGETCONNLIST _IOR('H', 212, int) #define HCIGETCONNLIST _IOR('H', 212, int)
#define HCIGETCONNINFO _IOR('H', 213, int) #define HCIGETCONNINFO _IOR('H', 213, int)
#define HCIGETAUTHINFO _IOR('H', 215, int) #define HCIGETAUTHINFO _IOR('H', 215, int)
#define HCISETAUTHINFO _IOR('H', 216, int)
#define HCISETRAW _IOW('H', 220, int) #define HCISETRAW _IOW('H', 220, int)
#define HCISETSCAN _IOW('H', 221, int) #define HCISETSCAN _IOW('H', 221, int)

View File

@@ -644,6 +644,7 @@ int hci_get_dev_info(void __user *arg);
int hci_get_conn_list(void __user *arg); int hci_get_conn_list(void __user *arg);
int hci_get_conn_info(struct hci_dev *hdev, void __user *arg); int hci_get_conn_info(struct hci_dev *hdev, void __user *arg);
int hci_get_auth_info(struct hci_dev *hdev, void __user *arg); int hci_get_auth_info(struct hci_dev *hdev, void __user *arg);
int hci_set_auth_info(struct hci_dev *hdev, void __user *arg);
int hci_inquiry(void __user *arg); int hci_inquiry(void __user *arg);
struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr);

View File

@@ -1139,3 +1139,23 @@ int hci_get_auth_info(struct hci_dev *hdev, void __user *arg)
return copy_to_user(arg, &req, sizeof(req)) ? -EFAULT : 0; return copy_to_user(arg, &req, sizeof(req)) ? -EFAULT : 0;
} }
int hci_set_auth_info(struct hci_dev *hdev, void __user *arg)
{
struct hci_auth_info_req req;
struct hci_conn *conn;
if (copy_from_user(&req, arg, sizeof(req)))
return -EFAULT;
hci_dev_lock_bh(hdev);
conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &req.bdaddr);
if (conn)
conn->auth_type = req.type;
hci_dev_unlock_bh(hdev);
if (!conn)
return -ENOENT;
return copy_to_user(arg, &req, sizeof(req)) ? -EFAULT : 0;
}

View File

@@ -1,6 +1,6 @@
/* /*
BlueZ - Bluetooth protocol stack for Linux BlueZ - Bluetooth protocol stack for Linux
Copyright (C) 2000-2001 Qualcomm Incorporated Copyright (c) 2000-2001, 2011, Code Aurora Forum. All rights reserved.
Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
@@ -297,6 +297,9 @@ static inline int hci_sock_bound_ioctl(struct sock *sk, unsigned int cmd, unsign
return -EACCES; return -EACCES;
return hci_blacklist_del(hdev, (void __user *) arg); return hci_blacklist_del(hdev, (void __user *) arg);
case HCISETAUTHINFO:
return hci_set_auth_info(hdev, (void __user *) arg);
default: default:
if (hdev->ioctl) if (hdev->ioctl)
return hdev->ioctl(hdev, cmd, arg); return hdev->ioctl(hdev, cmd, arg);