Bluetooth: Fix wrong check
Checking for (!conn && conn->state != BT_CONN_CONNECTED) makes NULL dereference in a case conn is NULL. Change-Id: I73c93e4eefad046eecb76958184880ef8b72676e Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This commit is contained in:
parent
c6c89a8529
commit
d5c55b75ae
1 changed files with 3 additions and 3 deletions
|
@ -1192,7 +1192,7 @@ int bt_gatt_subscribe(struct bt_conn *conn, uint16_t handle,
|
|||
struct bt_gatt_subscribe_params *tmp;
|
||||
bool has_subscription = false;
|
||||
|
||||
if (!conn && conn->state != BT_CONN_CONNECTED) {
|
||||
if (!conn || conn->state != BT_CONN_CONNECTED) {
|
||||
return -ENOTCONN;
|
||||
}
|
||||
|
||||
|
@ -1230,7 +1230,7 @@ int bt_gatt_unsubscribe(struct bt_conn *conn, uint16_t handle,
|
|||
struct bt_gatt_subscribe_params *tmp;
|
||||
bool has_subscription = false, found = false;
|
||||
|
||||
if (!conn && conn->state != BT_CONN_CONNECTED) {
|
||||
if (!conn || conn->state != BT_CONN_CONNECTED) {
|
||||
return -ENOTCONN;
|
||||
}
|
||||
|
||||
|
@ -1285,7 +1285,7 @@ int bt_gatt_read_multiple(struct bt_conn *conn, const uint16_t *handles,
|
|||
struct bt_buf *buf;
|
||||
uint8_t i;
|
||||
|
||||
if (!conn && conn->state != BT_CONN_CONNECTED) {
|
||||
if (!conn || conn->state != BT_CONN_CONNECTED) {
|
||||
return -ENOTCONN;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue