Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Fugang Duan and committed by
Marcel Holtmann
bbb69b37 ba8f5289

+5 -2
+5 -2
net/bluetooth/l2cap_sock.c
··· 791 791 792 792 conn = chan->conn; 793 793 794 - /*change security for LE channels */ 794 + /* change security for LE channels */ 795 795 if (chan->scid == L2CAP_CID_ATT) { 796 - if (smp_conn_security(conn->hcon, sec.level)) 796 + if (smp_conn_security(conn->hcon, sec.level)) { 797 + err = -EINVAL; 797 798 break; 799 + } 800 + 798 801 set_bit(FLAG_PENDING_SECURITY, &chan->flags); 799 802 sk->sk_state = BT_CONFIG; 800 803 chan->state = BT_CONFIG;