tests: bluetooth: tester: Fix NULL pointer dereference in error path
bt_conn_unref() requires valid conn pointer but could be called with NULL in case valid connection was not found in disconnect_eatt_chans(). Fixes #39851 Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
This commit is contained in:
parent
33380d7cc6
commit
d0b02cde2c
@ -342,22 +342,22 @@ void disconnect_eatt_chans(uint8_t *data, uint16_t len)
|
||||
if (!conn) {
|
||||
LOG_ERR("Unknown connection");
|
||||
status = BTP_STATUS_FAILED;
|
||||
goto rsp;
|
||||
goto failed;
|
||||
}
|
||||
|
||||
for (int i = 0; i < cmd->count; i++) {
|
||||
err = bt_eatt_disconnect_one(conn);
|
||||
if (err) {
|
||||
status = BTP_STATUS_FAILED;
|
||||
goto rsp;
|
||||
goto unref;
|
||||
}
|
||||
}
|
||||
|
||||
status = BTP_STATUS_SUCCESS;
|
||||
|
||||
rsp:
|
||||
unref:
|
||||
bt_conn_unref(conn);
|
||||
|
||||
failed:
|
||||
tester_rsp(BTP_SERVICE_ID_L2CAP, L2CAP_DISCONNECT_EATT_CHANS,
|
||||
CONTROLLER_INDEX, status);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user