diff options
author | Fugang Duan <fugang.duan@nxp.com> | 2019-03-15 03:17:28 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2019-04-23 18:09:07 +0200 |
commit | bbb69b37be15e1cff74730b7fa5659e1ee705795 (patch) | |
tree | 79eadfd2d5d8e393add2a80b7b53b69e51c059cb | |
parent | ba8f5289f706aed94cc95b15cc5b89e22062f61f (diff) | |
download | linux-bbb69b37be15e1cff74730b7fa5659e1ee705795.tar.gz linux-bbb69b37be15e1cff74730b7fa5659e1ee705795.tar.bz2 linux-bbb69b37be15e1cff74730b7fa5659e1ee705795.zip |
Bluetooth: Add return check for L2CAP security level set
Add return check for security level set for socket interface since
stack will check the return value.
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r-- | net/bluetooth/l2cap_sock.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index dcb14abebeba..a7be8b59b3c2 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c @@ -791,10 +791,13 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, conn = chan->conn; - /*change security for LE channels */ + /* change security for LE channels */ if (chan->scid == L2CAP_CID_ATT) { - if (smp_conn_security(conn->hcon, sec.level)) + if (smp_conn_security(conn->hcon, sec.level)) { + err = -EINVAL; break; + } + set_bit(FLAG_PENDING_SECURITY, &chan->flags); sk->sk_state = BT_CONFIG; chan->state = BT_CONFIG; |