This is a note to let you know that I've just added the patch titled Bluetooth: L2CAP: Fix handling LE modes by L2CAP_OPTIONS to the 5.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: bluetooth-l2cap-fix-handling-le-modes-by-l2cap_options.patch and it can be found in the queue-5.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From b86b0b150fed840c376145383ef5105116c81b0c Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx> Date: Fri, 27 Mar 2020 11:32:14 -0700 Subject: Bluetooth: L2CAP: Fix handling LE modes by L2CAP_OPTIONS From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx> commit b86b0b150fed840c376145383ef5105116c81b0c upstream. L2CAP_OPTIONS shall only be used with BR/EDR modes. Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx> Signed-off-by: Marcel Holtmann <marcel@xxxxxxxxxxxx> Signed-off-by: Zubin Mithra <zsm@xxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- net/bluetooth/l2cap_sock.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c @@ -426,6 +426,20 @@ static int l2cap_sock_getsockopt_old(str break; } + /* Only BR/EDR modes are supported here */ + switch (chan->mode) { + case L2CAP_MODE_BASIC: + case L2CAP_MODE_ERTM: + case L2CAP_MODE_STREAMING: + break; + default: + err = -EINVAL; + break; + } + + if (err < 0) + break; + memset(&opts, 0, sizeof(opts)); opts.imtu = chan->imtu; opts.omtu = chan->omtu; @@ -685,10 +699,8 @@ static int l2cap_sock_setsockopt_old(str break; } - chan->mode = opts.mode; - switch (chan->mode) { - case L2CAP_MODE_LE_FLOWCTL: - break; + /* Only BR/EDR modes are supported here */ + switch (opts.mode) { case L2CAP_MODE_BASIC: clear_bit(CONF_STATE2_DEVICE, &chan->conf_state); break; @@ -702,6 +714,10 @@ static int l2cap_sock_setsockopt_old(str break; } + if (err < 0) + break; + + chan->mode = opts.mode; chan->imtu = opts.imtu; chan->omtu = opts.omtu; chan->fcs = opts.fcs; Patches currently in stable-queue which might be from luiz.von.dentz@xxxxxxxxx are queue-5.4/bluetooth-l2cap-fix-handling-le-modes-by-l2cap_options.patch