diff --git a/wireless/bluetooth/bt_netdev.c b/wireless/bluetooth/bt_netdev.c index e4996b6b519..4a48d7a45a7 100644 --- a/wireless/bluetooth/bt_netdev.c +++ b/wireless/bluetooth/bt_netdev.c @@ -511,6 +511,8 @@ static void btnet_hci_received(FAR struct bt_buf_s *buf, FAR void *context) frame = buf->frame; buf->frame = NULL; + net_lock(); + /* Ignore the frame if the network is not up */ priv = (FAR struct btnet_driver_s *)context; @@ -556,8 +558,6 @@ static void btnet_hci_received(FAR struct bt_buf_s *buf, FAR void *context) /* Transfer the frame to the network logic */ - net_lock(); - #ifdef CONFIG_NET_BLUETOOTH /* Invoke the PF_BLUETOOTH tap first. If the frame matches * with a connected PF_BLUETOOTH socket, it will take the