Bluetooth: SDP: Don't clear l2cap chan on disconnect

- Remove memset on bt_l2cap_br_chan during SDP
  disconnect to prevent overwriting resources
  (e.g., rtx_work) still in use by L2CAP,
  which handles channel cleanup itself.
- Delete unused partial_resp_queue to clean up code.

Signed-off-by: ZhongYao Luo <LuoZhongYao@gmail.com>
This commit is contained in:
ZhongYao Luo 2025-05-07 11:29:58 +08:00 committed by Benjamin Cabé
commit 821e9f3c6a

View file

@ -63,7 +63,6 @@ LOG_MODULE_REGISTER(bt_sdp);
struct bt_sdp { struct bt_sdp {
struct bt_l2cap_br_chan chan; struct bt_l2cap_br_chan chan;
struct k_fifo partial_resp_queue;
/* TODO: Allow more than one pending request */ /* TODO: Allow more than one pending request */
}; };
@ -165,11 +164,9 @@ static void bt_sdp_connected(struct bt_l2cap_chan *chan)
struct bt_l2cap_br_chan, struct bt_l2cap_br_chan,
chan); chan);
struct bt_sdp *sdp = CONTAINER_OF(ch, struct bt_sdp, chan); struct bt_sdp *sdp __unused = CONTAINER_OF(ch, struct bt_sdp, chan);
LOG_DBG("chan %p cid 0x%04x", ch, ch->tx.cid); LOG_DBG("chan %p cid 0x%04x", ch, ch->tx.cid);
k_fifo_init(&sdp->partial_resp_queue);
} }
/** @brief Callback for SDP disconnection /** @brief Callback for SDP disconnection
@ -186,11 +183,9 @@ static void bt_sdp_disconnected(struct bt_l2cap_chan *chan)
struct bt_l2cap_br_chan, struct bt_l2cap_br_chan,
chan); chan);
struct bt_sdp *sdp = CONTAINER_OF(ch, struct bt_sdp, chan); struct bt_sdp *sdp __unused = CONTAINER_OF(ch, struct bt_sdp, chan);
LOG_DBG("chan %p cid 0x%04x", ch, ch->tx.cid); LOG_DBG("chan %p cid 0x%04x", ch, ch->tx.cid);
(void)memset(sdp, 0, sizeof(*sdp));
} }
/* @brief Creates an SDP PDU /* @brief Creates an SDP PDU