diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2007-02-21 00:25:10 +0100 |
---|---|---|
committer | Adrian Bunk <bunk@stusta.de> | 2007-02-21 00:25:10 +0100 |
commit | 82ea2673f38fd5987aa43351f81110e7c7acd32b (patch) | |
tree | 857bffb8e15c78536f84a101030d445e63e78869 | |
parent | 1042dac731e1ad848b69af31dd7b15a2e9c6f6f4 (diff) |
[Bluetooth] Restrict well known PSM to privileged users
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>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
-rw-r--r-- | net/bluetooth/l2cap.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index cb0054585dd..328f98846e0 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c @@ -440,6 +440,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)) { |