Skip to content

Commit

Permalink
Bluetooth: GATT: Add missing LESC_MASK for encrypt check The LE Secur…
Browse files Browse the repository at this point in the history
…e connection (LESC) mask also require encryption,

and some users have been using e.g. BT_GATT_PERM_READ_LESC
without BT_GATT_PERM_READ_ENCRYPT, and then the encryption
check in bt_gatt_check_perm was never properly applied.

cherry-picked from commit d9ff7eb
Signed-off-by: Yiheng Cao([email protected])
  • Loading branch information
Crispy-fried-chicken committed Aug 20, 2024
1 parent ac9c9d2 commit d21148f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion subsys/bluetooth/host/gatt.c
Original file line number Diff line number Diff line change
Expand Up @@ -3103,7 +3103,8 @@ uint8_t bt_gatt_check_perm(struct bt_conn *conn, const struct bt_gatt_attr *attr
* the error code “Insufficient Encryption”.
*/

if (mask & (BT_GATT_PERM_ENCRYPT_MASK | BT_GATT_PERM_AUTHEN_MASK)) {
if (mask & (BT_GATT_PERM_ENCRYPT_MASK | BT_GATT_PERM_AUTHEN_MASK |

Check warning on line 3106 in subsys/bluetooth/host/gatt.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

LEADING_SPACE

subsys/bluetooth/host/gatt.c:3106 please, no spaces at the start of a line

Check warning on line 3106 in subsys/bluetooth/host/gatt.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

SUSPECT_CODE_INDENT

subsys/bluetooth/host/gatt.c:3106 suspect code indent for conditional statements (2, 16)
BT_GATT_PERM_LESC_MASK)) {

Check failure on line 3107 in subsys/bluetooth/host/gatt.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

CODE_INDENT

subsys/bluetooth/host/gatt.c:3107 code indent should use tabs where possible

Check warning on line 3107 in subsys/bluetooth/host/gatt.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

LEADING_SPACE

subsys/bluetooth/host/gatt.c:3107 please, no spaces at the start of a line
#if defined(CONFIG_BT_SMP)
if (!conn->encrypt) {
if (bt_conn_ltk_present(conn)) {
Expand Down

0 comments on commit d21148f

Please sign in to comment.