Commit c507f138 authored by Seung-Woo Kim's avatar Seung-Woo Kim Committed by Gustavo Padovan

Bluetooth: Fix RFCOMM bind fail for L2CAP sock

L2CAP socket bind checks its bdaddr type but RFCOMM kernel thread
does not assign proper bdaddr type for L2CAP sock. This can cause
that RFCOMM failure.
Signed-off-by: default avatarSeung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 60c7a3c9
...@@ -694,6 +694,7 @@ static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, ...@@ -694,6 +694,7 @@ static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src,
addr.l2_family = AF_BLUETOOTH; addr.l2_family = AF_BLUETOOTH;
addr.l2_psm = 0; addr.l2_psm = 0;
addr.l2_cid = 0; addr.l2_cid = 0;
addr.l2_bdaddr_type = BDADDR_BREDR;
*err = kernel_bind(sock, (struct sockaddr *) &addr, sizeof(addr)); *err = kernel_bind(sock, (struct sockaddr *) &addr, sizeof(addr));
if (*err < 0) if (*err < 0)
goto failed; goto failed;
...@@ -1983,6 +1984,7 @@ static int rfcomm_add_listener(bdaddr_t *ba) ...@@ -1983,6 +1984,7 @@ static int rfcomm_add_listener(bdaddr_t *ba)
addr.l2_family = AF_BLUETOOTH; addr.l2_family = AF_BLUETOOTH;
addr.l2_psm = __constant_cpu_to_le16(RFCOMM_PSM); addr.l2_psm = __constant_cpu_to_le16(RFCOMM_PSM);
addr.l2_cid = 0; addr.l2_cid = 0;
addr.l2_bdaddr_type = BDADDR_BREDR;
err = kernel_bind(sock, (struct sockaddr *) &addr, sizeof(addr)); err = kernel_bind(sock, (struct sockaddr *) &addr, sizeof(addr));
if (err < 0) { if (err < 0) {
BT_ERR("Bind failed %d", err); BT_ERR("Bind failed %d", err);
......
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