Skip to content

Commit

Permalink
[Bluetooth] Restrict well known PSM to privileged users
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Marcel Holtmann committed Jan 22, 2007
1 parent 7386397 commit 847641d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions net/bluetooth/l2cap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 847641d

Please sign in to comment.