Commit b86b0b15 authored by Luiz Augusto von Dentz's avatar Luiz Augusto von Dentz Committed by Marcel Holtmann

Bluetooth: L2CAP: Fix handling LE modes by L2CAP_OPTIONS

L2CAP_OPTIONS shall only be used with BR/EDR modes.
Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 139dfad6
...@@ -424,6 +424,20 @@ static int l2cap_sock_getsockopt_old(struct socket *sock, int optname, ...@@ -424,6 +424,20 @@ static int l2cap_sock_getsockopt_old(struct socket *sock, int optname,
break; 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)); memset(&opts, 0, sizeof(opts));
opts.imtu = chan->imtu; opts.imtu = chan->imtu;
opts.omtu = chan->omtu; opts.omtu = chan->omtu;
...@@ -698,10 +712,8 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, ...@@ -698,10 +712,8 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname,
break; break;
} }
chan->mode = opts.mode; /* Only BR/EDR modes are supported here */
switch (chan->mode) { switch (opts.mode) {
case L2CAP_MODE_LE_FLOWCTL:
break;
case L2CAP_MODE_BASIC: case L2CAP_MODE_BASIC:
clear_bit(CONF_STATE2_DEVICE, &chan->conf_state); clear_bit(CONF_STATE2_DEVICE, &chan->conf_state);
break; break;
...@@ -715,6 +727,11 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, ...@@ -715,6 +727,11 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname,
break; break;
} }
if (err < 0)
break;
chan->mode = opts.mode;
BT_DBG("mode 0x%2.2x", chan->mode); BT_DBG("mode 0x%2.2x", chan->mode);
chan->imtu = opts.imtu; chan->imtu = opts.imtu;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment