linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH Bluetooth 1/1] Bluetooth: L2CAP: add return check for security level set
@ 2019-03-15  3:17 Andy Duan
  2019-03-15 14:10 ` Marcel Holtmann
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Duan @ 2019-03-15  3:17 UTC (permalink / raw)
  To: johan.hedberg, marcel; +Cc: linux-bluetooth, Andy Duan

From: "Fugang Duan" <fugang.duan@nxp.com>

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>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH Bluetooth 1/1] Bluetooth: L2CAP: add return check for security level set
  2019-03-15  3:17 [PATCH Bluetooth 1/1] Bluetooth: L2CAP: add return check for security level set Andy Duan
@ 2019-03-15 14:10 ` Marcel Holtmann
  2019-03-16  2:57   ` Andy Duan
  0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2019-03-15 14:10 UTC (permalink / raw)
  To: Andy Duan; +Cc: Johan Hedberg, linux-bluetooth

Hi Andy,

> 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>
> ---
> net/bluetooth/l2cap_sock.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH Bluetooth 1/1] Bluetooth: L2CAP: add return check for security level set
  2019-03-15 14:10 ` Marcel Holtmann
@ 2019-03-16  2:57   ` Andy Duan
  0 siblings, 0 replies; 3+ messages in thread
From: Andy Duan @ 2019-03-16  2:57 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: Johan Hedberg, linux-bluetooth

From: Marcel Holtmann <marcel@holtmann.org> 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 <fugang.duan@nxp.com>
> > ---
> > net/bluetooth/l2cap_sock.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> 
> patch has been applied to bluetooth-next tree.
> 
> Regards
> 
> Marcel

Thanks!


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-16  2:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-15  3:17 [PATCH Bluetooth 1/1] Bluetooth: L2CAP: add return check for security level set Andy Duan
2019-03-15 14:10 ` Marcel Holtmann
2019-03-16  2:57   ` Andy Duan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).