summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2015-06-10 20:28:33 +0300
committerMarcel Holtmann <marcel@holtmann.org>2015-06-11 01:22:54 +0200
commit835a6a2f8603237a3e6cded5a6765090ecb06ea5 (patch)
tree1c882aae5e672842db6f8f593f9bbd40eecea5fd
parentd446278c408bdebd4103090740ce908c5d6b5ab0 (diff)
downloadop-kernel-dev-835a6a2f8603237a3e6cded5a6765090ecb06ea5.zip
op-kernel-dev-835a6a2f8603237a3e6cded5a6765090ecb06ea5.tar.gz
Bluetooth: Stop sabotaging list poisoning
list_del() poisons pointers with special values, no need to overwrite them. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r--net/bluetooth/l2cap_core.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 07bd316..51594fb 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1601,7 +1601,7 @@ int l2cap_register_user(struct l2cap_conn *conn, struct l2cap_user *user)
hci_dev_lock(hdev);
- if (user->list.next || user->list.prev) {
+ if (!list_empty(&user->list)) {
ret = -EINVAL;
goto out_unlock;
}
@@ -1631,12 +1631,10 @@ void l2cap_unregister_user(struct l2cap_conn *conn, struct l2cap_user *user)
hci_dev_lock(hdev);
- if (!user->list.next || !user->list.prev)
+ if (list_empty(&user->list))
goto out_unlock;
list_del(&user->list);
- user->list.next = NULL;
- user->list.prev = NULL;
user->remove(conn, user);
out_unlock:
@@ -1651,8 +1649,6 @@ static void l2cap_unregister_all_users(struct l2cap_conn *conn)
while (!list_empty(&conn->users)) {
user = list_first_entry(&conn->users, struct l2cap_user, list);
list_del(&user->list);
- user->list.next = NULL;
- user->list.prev = NULL;
user->remove(conn, user);
}
}
OpenPOWER on IntegriCloud