aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/bluetooth/hci_core.h3
-rw-r--r--net/bluetooth/hci_core.c21
-rw-r--r--net/bluetooth/hci_event.c2
3 files changed, 14 insertions, 12 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 07c2da4854ab..c6becda8c466 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -81,6 +81,7 @@ struct hci_conn_hash {
81struct bdaddr_list { 81struct bdaddr_list {
82 struct list_head list; 82 struct list_head list;
83 bdaddr_t bdaddr; 83 bdaddr_t bdaddr;
84 u8 bdaddr_type;
84}; 85};
85 86
86struct bt_uuid { 87struct bt_uuid {
@@ -732,7 +733,7 @@ int hci_get_auth_info(struct hci_dev *hdev, void __user *arg);
732int hci_inquiry(void __user *arg); 733int hci_inquiry(void __user *arg);
733 734
734struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, 735struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev,
735 bdaddr_t *bdaddr); 736 bdaddr_t *bdaddr, u8 type);
736int hci_blacklist_clear(struct hci_dev *hdev); 737int hci_blacklist_clear(struct hci_dev *hdev);
737int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 738int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
738int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 739int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index b7c4ada1beb6..2376c3040194 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2158,13 +2158,15 @@ int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash,
2158 return 0; 2158 return 0;
2159} 2159}
2160 2160
2161struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr) 2161struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev,
2162 bdaddr_t *bdaddr, u8 type)
2162{ 2163{
2163 struct bdaddr_list *b; 2164 struct bdaddr_list *b;
2164 2165
2165 list_for_each_entry(b, &hdev->blacklist, list) 2166 list_for_each_entry(b, &hdev->blacklist, list) {
2166 if (bacmp(bdaddr, &b->bdaddr) == 0) 2167 if (!bacmp(&b->bdaddr, bdaddr) && b->bdaddr_type == type)
2167 return b; 2168 return b;
2169 }
2168 2170
2169 return NULL; 2171 return NULL;
2170} 2172}
@@ -2174,9 +2176,7 @@ int hci_blacklist_clear(struct hci_dev *hdev)
2174 struct list_head *p, *n; 2176 struct list_head *p, *n;
2175 2177
2176 list_for_each_safe(p, n, &hdev->blacklist) { 2178 list_for_each_safe(p, n, &hdev->blacklist) {
2177 struct bdaddr_list *b; 2179 struct bdaddr_list *b = list_entry(p, struct bdaddr_list, list);
2178
2179 b = list_entry(p, struct bdaddr_list, list);
2180 2180
2181 list_del(p); 2181 list_del(p);
2182 kfree(b); 2182 kfree(b);
@@ -2189,10 +2189,10 @@ int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type)
2189{ 2189{
2190 struct bdaddr_list *entry; 2190 struct bdaddr_list *entry;
2191 2191
2192 if (bacmp(bdaddr, BDADDR_ANY) == 0) 2192 if (!bacmp(bdaddr, BDADDR_ANY))
2193 return -EBADF; 2193 return -EBADF;
2194 2194
2195 if (hci_blacklist_lookup(hdev, bdaddr)) 2195 if (hci_blacklist_lookup(hdev, bdaddr, type))
2196 return -EEXIST; 2196 return -EEXIST;
2197 2197
2198 entry = kzalloc(sizeof(struct bdaddr_list), GFP_KERNEL); 2198 entry = kzalloc(sizeof(struct bdaddr_list), GFP_KERNEL);
@@ -2200,6 +2200,7 @@ int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type)
2200 return -ENOMEM; 2200 return -ENOMEM;
2201 2201
2202 bacpy(&entry->bdaddr, bdaddr); 2202 bacpy(&entry->bdaddr, bdaddr);
2203 entry->bdaddr_type = type;
2203 2204
2204 list_add(&entry->list, &hdev->blacklist); 2205 list_add(&entry->list, &hdev->blacklist);
2205 2206
@@ -2210,10 +2211,10 @@ int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type)
2210{ 2211{
2211 struct bdaddr_list *entry; 2212 struct bdaddr_list *entry;
2212 2213
2213 if (bacmp(bdaddr, BDADDR_ANY) == 0) 2214 if (!bacmp(bdaddr, BDADDR_ANY))
2214 return hci_blacklist_clear(hdev); 2215 return hci_blacklist_clear(hdev);
2215 2216
2216 entry = hci_blacklist_lookup(hdev, bdaddr); 2217 entry = hci_blacklist_lookup(hdev, bdaddr, type);
2217 if (!entry) 2218 if (!entry)
2218 return -ENOENT; 2219 return -ENOENT;
2219 2220
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 6c3b193951ad..e43de9876aa0 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1692,7 +1692,7 @@ static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
1692 &flags); 1692 &flags);
1693 1693
1694 if ((mask & HCI_LM_ACCEPT) && 1694 if ((mask & HCI_LM_ACCEPT) &&
1695 !hci_blacklist_lookup(hdev, &ev->bdaddr)) { 1695 !hci_blacklist_lookup(hdev, &ev->bdaddr, BDADDR_BREDR)) {
1696 /* Connection accepted */ 1696 /* Connection accepted */
1697 struct inquiry_entry *ie; 1697 struct inquiry_entry *ie;
1698 struct hci_conn *conn; 1698 struct hci_conn *conn;