]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[Bluetooth] Restrict well known PSM to privileged users
authorMarcel Holtmann <marcel@holtmann.org>
Mon, 22 Jan 2007 21:00:45 +0000 (22:00 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 22 Jan 2007 21:00:45 +0000 (22:00 +0100)
The PSM values below 0x1001 of L2CAP are reserved for well known
services. Restrict the possibility to bind them to privileged
users.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/l2cap.c

index be5a6e60a3c4d095236aa626e2e74bc377dc54bc..f8c25d5001558dd777868454bd4d7681dd878039 100644 (file)
@@ -585,6 +585,12 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_
                goto done;
        }
 
+       if (la->l2_psm > 0 && btohs(la->l2_psm) < 0x1001 &&
+                               !capable(CAP_NET_BIND_SERVICE)) {
+               err = -EACCES;
+               goto done;
+       }
+               
        write_lock_bh(&l2cap_sk_list.lock);
 
        if (la->l2_psm && __l2cap_get_sock_by_addr(la->l2_psm, &la->l2_bdaddr)) {