diff --git a/subsys/bluetooth/host/att.c b/subsys/bluetooth/host/att.c index 974b8f78839..c3fd0a8a7cf 100644 --- a/subsys/bluetooth/host/att.c +++ b/subsys/bluetooth/host/att.c @@ -721,7 +721,11 @@ static struct net_buf *bt_att_chan_create_pdu(struct bt_att_chan *chan, uint8_t timeout = BT_ATT_TIMEOUT; break; default: - timeout = K_FOREVER; + if (k_current_get() == k_work_queue_thread_get(&k_sys_work_q)) { + timeout = K_NO_WAIT; + } else { + timeout = K_FOREVER; + } } /* This will reserve headspace for lower layers */ diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index dcaa70a7868..9a6de949733 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -674,6 +674,11 @@ struct net_buf *bt_l2cap_create_pdu_timeout(struct net_buf_pool *pool, size_t reserve, k_timeout_t timeout) { + if (!K_TIMEOUT_EQ(timeout, K_NO_WAIT) && + k_current_get() == k_work_queue_thread_get(&k_sys_work_q)) { + timeout = K_NO_WAIT; + } + return bt_conn_create_pdu_timeout(pool, sizeof(struct bt_l2cap_hdr) + reserve, timeout);