Bluetooth: GATT: Fix crash when using CONFIG_BT_CONN_DISABLE_SECURITY
When using CONFIG_BT_CONN_DISABLE_SECURITY bt_gatt_check_perm would ignore not only the security sensitive permissions but also access related ones causing crashes since the callback would be NULL. Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
5e2e7a0fcf
commit
e536b46a01
1 changed files with 4 additions and 4 deletions
|
@ -2130,10 +2130,6 @@ uint16_t bt_gatt_get_mtu(struct bt_conn *conn)
|
|||
uint8_t bt_gatt_check_perm(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
uint8_t mask)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_BT_CONN_DISABLE_SECURITY)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((mask & BT_GATT_PERM_READ) &&
|
||||
(!(attr->perm & BT_GATT_PERM_READ_MASK) || !attr->read)) {
|
||||
return BT_ATT_ERR_READ_NOT_PERMITTED;
|
||||
|
@ -2144,6 +2140,10 @@ uint8_t bt_gatt_check_perm(struct bt_conn *conn, const struct bt_gatt_attr *attr
|
|||
return BT_ATT_ERR_WRITE_NOT_PERMITTED;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_CONN_DISABLE_SECURITY)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
mask &= attr->perm;
|
||||
if (mask & BT_GATT_PERM_AUTHEN_MASK) {
|
||||
if (bt_conn_get_security(conn) < BT_SECURITY_L3) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue