Commit 63ce0900 authored by Luiz Augusto von Dentz's avatar Luiz Augusto von Dentz Committed by Gustavo F. Padovan

Bluetooth: fix not setting security level when creating a rfcomm session

This cause 'No Bonding' to be used if userspace has not yet been paired
with remote device since the l2cap socket used to create the rfcomm
session does not have any security level set.
Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.dentz-von@nokia.com>
Acked-by: default avatarVille Tervo <ville.tervo@nokia.com>
Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent 4f8b691c
...@@ -79,7 +79,10 @@ static void rfcomm_make_uih(struct sk_buff *skb, u8 addr); ...@@ -79,7 +79,10 @@ static void rfcomm_make_uih(struct sk_buff *skb, u8 addr);
static void rfcomm_process_connect(struct rfcomm_session *s); static void rfcomm_process_connect(struct rfcomm_session *s);
static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst, int *err); static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src,
bdaddr_t *dst,
u8 sec_level,
int *err);
static struct rfcomm_session *rfcomm_session_get(bdaddr_t *src, bdaddr_t *dst); static struct rfcomm_session *rfcomm_session_get(bdaddr_t *src, bdaddr_t *dst);
static void rfcomm_session_del(struct rfcomm_session *s); static void rfcomm_session_del(struct rfcomm_session *s);
...@@ -401,7 +404,7 @@ static int __rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst, ...@@ -401,7 +404,7 @@ static int __rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst,
s = rfcomm_session_get(src, dst); s = rfcomm_session_get(src, dst);
if (!s) { if (!s) {
s = rfcomm_session_create(src, dst, &err); s = rfcomm_session_create(src, dst, d->sec_level, &err);
if (!s) if (!s)
return err; return err;
} }
...@@ -679,7 +682,10 @@ static void rfcomm_session_close(struct rfcomm_session *s, int err) ...@@ -679,7 +682,10 @@ static void rfcomm_session_close(struct rfcomm_session *s, int err)
rfcomm_session_put(s); rfcomm_session_put(s);
} }
static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst, int *err) static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src,
bdaddr_t *dst,
u8 sec_level,
int *err)
{ {
struct rfcomm_session *s = NULL; struct rfcomm_session *s = NULL;
struct sockaddr_l2 addr; struct sockaddr_l2 addr;
...@@ -704,6 +710,7 @@ static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst ...@@ -704,6 +710,7 @@ static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst
sk = sock->sk; sk = sock->sk;
lock_sock(sk); lock_sock(sk);
l2cap_pi(sk)->imtu = l2cap_mtu; l2cap_pi(sk)->imtu = l2cap_mtu;
l2cap_pi(sk)->sec_level = sec_level;
if (l2cap_ertm) if (l2cap_ertm)
l2cap_pi(sk)->mode = L2CAP_MODE_ERTM; l2cap_pi(sk)->mode = L2CAP_MODE_ERTM;
release_sock(sk); release_sock(sk);
......
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