Commit f39f905e authored by Zhang Chen's avatar Zhang Chen Committed by Luiz Augusto von Dentz
Browse files

Bluetooth: L2CAP: Fix send LE flow credits in ACL link



When the L2CAP channel mode is L2CAP_MODE_ERTM/L2CAP_MODE_STREAMING,
l2cap_publish_rx_avail will be called and le flow credits will be sent in
l2cap_chan_rx_avail, even though the link type is ACL.

The logs in question as follows:
> ACL Data RX: Handle 129 flags 0x02 dlen 12
      L2CAP: Unknown (0x16) ident 4 len 4
        40 00 ed 05
< ACL Data TX: Handle 129 flags 0x00 dlen 10
      L2CAP: Command Reject (0x01) ident 4 len 2
        Reason: Command not understood (0x0000)

Bluetooth: Unknown BR/EDR signaling command 0x16
Bluetooth: Wrong link type (-22)

Fixes: ce60b923 ("Bluetooth: compute LE flow credits based on recvbuf space")
Signed-off-by: default avatarZhang Chen <zhangchen01@kylinos.cn>
Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
parent c4ea7d89
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -6630,6 +6630,10 @@ static void l2cap_chan_le_send_credits(struct l2cap_chan *chan)
	struct l2cap_le_credits pkt;
	u16 return_credits = l2cap_le_rx_credits(chan);

	if (chan->mode != L2CAP_MODE_LE_FLOWCTL &&
	    chan->mode != L2CAP_MODE_EXT_FLOWCTL)
		return;

	if (chan->rx_credits >= return_credits)
		return;