Bluetooth: L2CAP: Use default TxWindow for zero socket option

L2CAP_OPTIONS accepts a txwin_size of zero and
stores it in tx_win. The zero is then sent to the
peer in our configuration request, and if the
channel ends up in ERTM mode it is passed to
l2cap_seq_list_init().

Use the default TxWindow instead, as the mode can
still be changed to ERTM during configuration.

Fixes: 14b5aa71ec ("Bluetooth: Add sockopt configuration for txWindow on L2CAP")
Cc: stable@vger.kernel.org
Signed-off-by: Siwei Zhang <oss@fourdim.xyz>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Siwei Zhang 2026-10-13 11:36:36 -04:00 committed by Luiz Augusto von Dentz
parent c5ebb0245f
commit 226fa3b676

View File

@ -815,6 +815,10 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname,
break;
}
/* A zero TxWindow is invalid, use the default instead */
if (!opts.txwin_size)
opts.txwin_size = L2CAP_DEFAULT_TX_WINDOW;
if (!l2cap_valid_mtu(chan, opts.imtu)) {
err = -EINVAL;
break;