From bb417dad1c8c28b63833f7cf4ebf8d11dc48f3b2 Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Sat, 7 Dec 2024 00:31:48 +0800 Subject: [PATCH] Bluetooth: SDP: Notify result if error rsp is received. In current implementation, the SDP response packet will be ignored if the operation code is `BT_SDP_ERROR_RSP`. And the SDP transaction request is done, but the application is not notified. And the pending SDP transaction cannot be processed. Notify application with empty buffer if the operation code is `BT_SDP_ERROR_RSP`. And process the pending SDP transaction. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/classic/sdp.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/subsys/bluetooth/host/classic/sdp.c b/subsys/bluetooth/host/classic/sdp.c index a9ebde29615..124ca2e3a4a 100644 --- a/subsys/bluetooth/host/classic/sdp.c +++ b/subsys/bluetooth/host/classic/sdp.c @@ -2098,11 +2098,6 @@ static int sdp_client_receive(struct bt_l2cap_chan *chan, struct net_buf *buf) } hdr = net_buf_pull_mem(buf, sizeof(*hdr)); - if (hdr->op_code == BT_SDP_ERROR_RSP) { - LOG_INF("Error SDP PDU response"); - return 0; - } - len = sys_be16_to_cpu(hdr->param_len); tid = sys_be16_to_cpu(hdr->tid); @@ -2126,8 +2121,10 @@ static int sdp_client_receive(struct bt_l2cap_chan *chan, struct net_buf *buf) case BT_SDP_SVC_SEARCH_ATTR_RSP: return sdp_client_receive_ssa_sa(session, buf); case BT_SDP_ERROR_RSP: + LOG_INF("Invalid SDP request"); + sdp_client_notify_result(session, UUID_NOT_RESOLVED); sdp_client_params_iterator(session); - break; + return 0; default: LOG_DBG("PDU 0x%0x response not handled", hdr->op_code); break;