Skip to content

Commit

Permalink
Bluetooth: Host: Set conn->err in prio
Browse files Browse the repository at this point in the history
The goal is to not access `buf` in the non-prio `hci_disconn_complete`
so that the buffer does not need to be retained.

This commit moves the copy of `conn->err` to the prio handler.

Signed-off-by: Aleksander Wasaznik <[email protected]>
  • Loading branch information
alwa-nordic committed Feb 2, 2024
1 parent 0bc1a2b commit a3c8fab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions subsys/bluetooth/host/hci_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,8 @@ static void hci_disconn_complete_prio(struct net_buf *buf)
return;
}

conn->err = evt->reason;

bt_conn_set_state(conn, BT_CONN_DISCONNECT_COMPLETE);
bt_conn_unref(conn);
}
Expand All @@ -860,8 +862,6 @@ static void hci_disconn_complete(struct net_buf *buf)
return;
}

conn->err = evt->reason;

bt_conn_set_state(conn, BT_CONN_DISCONNECTED);

if (conn->type != BT_CONN_TYPE_LE) {
Expand Down

0 comments on commit a3c8fab

Please sign in to comment.