diff options
-rw-r--r-- | include/net/bluetooth/l2cap.h | 6 | ||||
-rw-r--r-- | net/bluetooth/l2cap_sock.c | 6 |
2 files changed, 9 insertions, 3 deletions
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index 52899291f401..5ee3c689c863 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
@@ -252,6 +252,12 @@ struct l2cap_conn_rsp { | |||
252 | #define L2CAP_PSM_3DSP 0x0021 | 252 | #define L2CAP_PSM_3DSP 0x0021 |
253 | #define L2CAP_PSM_IPSP 0x0023 /* 6LoWPAN */ | 253 | #define L2CAP_PSM_IPSP 0x0023 /* 6LoWPAN */ |
254 | 254 | ||
255 | #define L2CAP_PSM_DYN_START 0x1001 | ||
256 | #define L2CAP_PSM_DYN_END 0xffff | ||
257 | #define L2CAP_PSM_AUTO_END 0x10ff | ||
258 | #define L2CAP_PSM_LE_DYN_START 0x0080 | ||
259 | #define L2CAP_PSM_LE_DYN_END 0x00ff | ||
260 | |||
255 | /* channel identifier */ | 261 | /* channel identifier */ |
256 | #define L2CAP_CID_SIGNALING 0x0001 | 262 | #define L2CAP_CID_SIGNALING 0x0001 |
257 | #define L2CAP_CID_CONN_LESS 0x0002 | 263 | #define L2CAP_CID_CONN_LESS 0x0002 |
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index 1bb551527044..f401592e5837 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c | |||
@@ -58,7 +58,7 @@ static int l2cap_validate_bredr_psm(u16 psm) | |||
58 | return -EINVAL; | 58 | return -EINVAL; |
59 | 59 | ||
60 | /* Restrict usage of well-known PSMs */ | 60 | /* Restrict usage of well-known PSMs */ |
61 | if (psm < 0x1001 && !capable(CAP_NET_BIND_SERVICE)) | 61 | if (psm < L2CAP_PSM_DYN_START && !capable(CAP_NET_BIND_SERVICE)) |
62 | return -EACCES; | 62 | return -EACCES; |
63 | 63 | ||
64 | return 0; | 64 | return 0; |
@@ -67,11 +67,11 @@ static int l2cap_validate_bredr_psm(u16 psm) | |||
67 | static int l2cap_validate_le_psm(u16 psm) | 67 | static int l2cap_validate_le_psm(u16 psm) |
68 | { | 68 | { |
69 | /* Valid LE_PSM ranges are defined only until 0x00ff */ | 69 | /* Valid LE_PSM ranges are defined only until 0x00ff */ |
70 | if (psm > 0x00ff) | 70 | if (psm > L2CAP_PSM_LE_DYN_END) |
71 | return -EINVAL; | 71 | return -EINVAL; |
72 | 72 | ||
73 | /* Restrict fixed, SIG assigned PSM values to CAP_NET_BIND_SERVICE */ | 73 | /* Restrict fixed, SIG assigned PSM values to CAP_NET_BIND_SERVICE */ |
74 | if (psm <= 0x007f && !capable(CAP_NET_BIND_SERVICE)) | 74 | if (psm < L2CAP_PSM_LE_DYN_START && !capable(CAP_NET_BIND_SERVICE)) |
75 | return -EACCES; | 75 | return -EACCES; |
76 | 76 | ||
77 | return 0; | 77 | return 0; |