2019-03-15 03:17:33

by Andy Duan

[permalink] [raw]
Subject: [PATCH Bluetooth 1/1] Bluetooth: L2CAP: add return check for security level set

From: "Fugang Duan" <[email protected]>

Add return check for security level set for socket interface since
stack will check the return value.

Signed-off-by: Fugang Duan <[email protected]>
---
net/bluetooth/l2cap_sock.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index a3a2cd5..c71b97f 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -793,8 +793,11 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,

/*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;
--
2.7.4



2019-03-15 14:10:43

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH Bluetooth 1/1] Bluetooth: L2CAP: add return check for security level set

Hi Andy,

> Add return check for security level set for socket interface since
> stack will check the return value.
>
> Signed-off-by: Fugang Duan <[email protected]>
> ---
> net/bluetooth/l2cap_sock.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


2019-03-16 02:57:23

by Andy Duan

[permalink] [raw]
Subject: RE: [PATCH Bluetooth 1/1] Bluetooth: L2CAP: add return check for security level set

From: Marcel Holtmann <[email protected]> Sent: Friday, March 15, 2019 10:11 PM
> Hi Andy,
>
> > Add return check for security level set for socket interface since
> > stack will check the return value.
> >
> > Signed-off-by: Fugang Duan <[email protected]>
> > ---
> > net/bluetooth/l2cap_sock.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
>
> patch has been applied to bluetooth-next tree.
>
> Regards
>
> Marcel

Thanks!