Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 7/7] device: Make device_get_address return const pointer
From: Szymon Janc @ 2012-10-05  8:17 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1349425021-16766-1-git-send-email-szymon.janc@tieto.com>

---
 src/device.c |    2 +-
 src/device.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/device.c b/src/device.c
index 72cae3b..1c65b68 100644
--- a/src/device.c
+++ b/src/device.c
@@ -2312,7 +2312,7 @@ struct btd_adapter *device_get_adapter(struct btd_device *device)
 	return device->adapter;
 }
 
-bdaddr_t *device_get_address(struct btd_device *device)
+const bdaddr_t *device_get_address(struct btd_device *device)
 {
 	return &device->bdaddr;
 }
diff --git a/src/device.h b/src/device.h
index f919af4..0c16c18 100644
--- a/src/device.h
+++ b/src/device.h
@@ -64,7 +64,7 @@ void btd_device_add_uuid(struct btd_device *device, const char *uuid);
 void device_probe_profile(gpointer a, gpointer b);
 void device_remove_profile(gpointer a, gpointer b);
 struct btd_adapter *device_get_adapter(struct btd_device *device);
-bdaddr_t *device_get_address(struct btd_device *device);
+const bdaddr_t *device_get_address(struct btd_device *device);
 void device_set_addr_type(struct btd_device *device, uint8_t bdaddr_type);
 uint8_t device_get_addr_type(struct btd_device *device);
 const gchar *device_get_path(struct btd_device *device);
-- 
1.7.9.5


^ permalink raw reply related

* Re: [PATCH 1/7] adapter: Convert adapter_get_address into simple getter
From: Johan Hedberg @ 2012-10-05  8:39 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth
In-Reply-To: <1349425021-16766-1-git-send-email-szymon.janc@tieto.com>

Hi Szymon,

On Fri, Oct 05, 2012, Szymon Janc wrote:
> Most uses of adapter_get_address were in form of:
> 
> bdaddr_t addr;
> adapter_get_address(adapter, &addr);
> foo(&addr);
> 
> Changing it to getter makes code simpler and avoid number of not
> needed memcpy.
> 
> ---
>  attrib/client.c              |    2 +-
>  audio/manager.c              |   48 +++++---------
>  plugins/adaptername.c        |    4 +-
>  plugins/dbusoob.c            |    8 +--
>  plugins/neard.c              |   16 ++---
>  plugins/service.c            |   57 ++++++-----------
>  plugins/wiimote.c            |    5 +-
>  profiles/alert/server.c      |    4 +-
>  profiles/gatt/gas.c          |   16 ++---
>  profiles/health/hdp.c        |   14 ++---
>  profiles/health/hdp_util.c   |   24 ++++---
>  profiles/input/device.c      |    2 +-
>  profiles/input/manager.c     |   11 +---
>  profiles/network/manager.c   |   10 +--
>  profiles/network/server.c    |    8 +--
>  profiles/proximity/monitor.c |   13 ++--
>  profiles/sap/manager.c       |    5 +-
>  src/adapter.c                |   13 ++--
>  src/adapter.h                |    2 +-
>  src/attrib-server.c          |   18 +++---
>  src/device.c                 |  143 +++++++++++++++++-------------------------
>  src/manager.c                |    5 +-
>  src/profile.c                |   28 ++++-----
>  23 files changed, 179 insertions(+), 277 deletions(-)

All patches have been applied. Thanks.

Johan

^ permalink raw reply

* Re: [PATCH 4/4] audio: Add check for non-a2dp codec
From: Marcel Holtmann @ 2012-10-05  8:41 UTC (permalink / raw)
  To: Chan-yeol Park; +Cc: Luiz Augusto von Dentz, chanyeol.park, linux-bluetooth
In-Reply-To: <506E8AA5.7090709@gmail.com>

Hi Chan-yeol,

> >   #define SBC_SAMPLING_FREQ_16000                (1 << 3)
> >   #define SBC_SAMPLING_FREQ_32000                (1 << 2)
> > @@ -114,3 +115,8 @@ typedef struct {
> >   #else
> >   #error "Unknown byte order"
> >   #endif
> > +
> > +typedef struct {
> > +       uint8_t vendor_id[4];
> > +       uint8_t codec_id[2];
> > +} __attribute__ ((packed)) non_a2dp_vendor_codec_t;
> > We normally don't typedef this type of structs, besides
> > a2dp_vendor_codec should be enough so this should be named struct
> > a2dp_vendor_codec.
> You're right. originally I didn't use typedef.
> but in order to achieve harmony in a2dp-codecs.h like sbc,mpeg, I've 
> changed it.
> 
> If you make decision about this, I will raise a second patch.

hold on for a second, is this the file that is shared with PulseAudio?

Regards

Marcel



^ permalink raw reply

* Re: [PATCH 4/4] audio: Add check for non-a2dp codec
From: Chan-yeol Park @ 2012-10-05  8:57 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: Luiz Augusto von Dentz, chanyeol.park, linux-bluetooth
In-Reply-To: <1349426477.27233.44.camel@aeonflux>

Hi Marcel,
On 10/05/2012 05:41 PM, Marcel Holtmann wrote:
> Hi Chan-yeol,
>
>>>    #define SBC_SAMPLING_FREQ_16000                (1 << 3)
>>>    #define SBC_SAMPLING_FREQ_32000                (1 << 2)
>>> @@ -114,3 +115,8 @@ typedef struct {
>>>    #else
>>>    #error "Unknown byte order"
>>>    #endif
>>> +
>>> +typedef struct {
>>> +       uint8_t vendor_id[4];
>>> +       uint8_t codec_id[2];
>>> +} __attribute__ ((packed)) non_a2dp_vendor_codec_t;
>>> We normally don't typedef this type of structs, besides
>>> a2dp_vendor_codec should be enough so this should be named struct
>>> a2dp_vendor_codec.
>> You're right. originally I didn't use typedef.
>> but in order to achieve harmony in a2dp-codecs.h like sbc,mpeg, I've
>> changed it.
>>
>> If you make decision about this, I will raise a second patch.
> hold on for a second, is this the file that is shared with PulseAudio?
Yes right. PulseAudio copy it as far as I know.

Regards

^ permalink raw reply

* Re: [PATCH] net, bluetooth: don't attempt to free a channel that wasn't created
From: Andrei Emeltchenko @ 2012-10-05 10:22 UTC (permalink / raw)
  To: Sasha Levin
  Cc: marcel, gustavo, johan.hedberg, davem, levinsasha928, davej,
	linux-kernel, linux-bluetooth, netdev
In-Reply-To: <1349395197-12395-1-git-send-email-sasha.levin@oracle.com>

Hi Sasha,

On Thu, Oct 04, 2012 at 07:59:57PM -0400, Sasha Levin wrote:
> We may currently attempt to free a channel which wasn't created due to
> an error in the initialization path, this would cause a NULL ptr deref.

Please put oops dump here.

> Introduced in commit 61d6ef3e ("Bluetooth: Make better use of l2cap_chan
> reference counting").
> 
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> ---
>  net/bluetooth/l2cap_sock.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
> index 083f2bf..66c295a 100644
> --- a/net/bluetooth/l2cap_sock.c
> +++ b/net/bluetooth/l2cap_sock.c
> @@ -1083,7 +1083,8 @@ static void l2cap_sock_destruct(struct sock *sk)
>  {
>  	BT_DBG("sk %p", sk);
>  
> -	l2cap_chan_put(l2cap_pi(sk)->chan);
> +	if (l2cap_pi(sk)->chan)
> +		l2cap_chan_put(l2cap_pi(sk)->chan);

This does not look right, I suppose you want to put somewhere missing
chan_hold

>  	if (l2cap_pi(sk)->rx_busy_skb) {
>  		kfree_skb(l2cap_pi(sk)->rx_busy_skb);
>  		l2cap_pi(sk)->rx_busy_skb = NULL;
> -- 
> 1.7.12

Best regards 
Andrei Emeltchenko 

^ permalink raw reply

* Re: [PATCH 1/7] adapter: Convert adapter_get_address into simple getter
From: Anderson Lizardo @ 2012-10-05 10:54 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth
In-Reply-To: <1349425021-16766-1-git-send-email-szymon.janc@tieto.com>

Hi Szymon,

On Fri, Oct 5, 2012 at 4:16 AM, Szymon Janc <szymon.janc@tieto.com> wrote:
> @@ -2578,6 +2557,7 @@ DBusMessage *device_create_bonding(struct btd_device *device,
>         if (device_is_bonded(device))
>                 return btd_error_already_exists(msg);
>
> +                               adapter_get_address(adapter),
>         bonding = bonding_request_new(msg, device, agent_path,
>                                         capability);
>

The above looks like a typo (and unfortunately, it compiles, due to the comma).

Regards,
-- 
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

^ permalink raw reply

* Re: [PATCH 1/7] adapter: Convert adapter_get_address into simple getter
From: Szymon Janc @ 2012-10-05 11:00 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <CAJdJm_N7omVUmhsmWoOUyCmuWojAKN5Lms=6a0qwbsYbXCf_Bw@mail.gmail.com>

On Friday 05 of October 2012 13:54:17 Anderson Lizardo wrote:
> Hi Szymon,

Hi,

> 
> On Fri, Oct 5, 2012 at 4:16 AM, Szymon Janc <szymon.janc@tieto.com> wrote:
> > @@ -2578,6 +2557,7 @@ DBusMessage *device_create_bonding(struct btd_device *device,
> >         if (device_is_bonded(device))
> >                 return btd_error_already_exists(msg);
> >
> > +                               adapter_get_address(adapter),
> >         bonding = bonding_request_new(msg, device, agent_path,
> >                                         capability);
> >
> 
> The above looks like a typo (and unfortunately, it compiles, due to the comma).


Crap, will send fix asap.

-- 
BR
Szymon Janc

^ permalink raw reply

* [PATCH] device: Remove bogus line from device_create_bonding
From: Szymon Janc @ 2012-10-05 11:08 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This is a typo from 899e6561d284806007b7e57e1ab3b65e54be3d22.

---
 src/device.c |    1 -
 1 file changed, 1 deletion(-)

diff --git a/src/device.c b/src/device.c
index 1c65b68..0d25631 100644
--- a/src/device.c
+++ b/src/device.c
@@ -2549,7 +2549,6 @@ DBusMessage *device_create_bonding(struct btd_device *device,
 	if (device_is_bonded(device))
 		return btd_error_already_exists(msg);
 
-				adapter_get_address(adapter),
 	bonding = bonding_request_new(msg, device, agent_path,
 					capability);
 
-- 
1.7.9.5


^ permalink raw reply related

* Re: [PATCH] device: Remove bogus line from device_create_bonding
From: Johan Hedberg @ 2012-10-05 12:48 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth
In-Reply-To: <1349435317-10736-1-git-send-email-szymon.janc@tieto.com>

Hi Szymon,

On Fri, Oct 05, 2012, Szymon Janc wrote:
> This is a typo from 899e6561d284806007b7e57e1ab3b65e54be3d22.
> 
> ---
>  src/device.c |    1 -
>  1 file changed, 1 deletion(-)

Applied. Thanks.

Johan

^ permalink raw reply

* [PATCH 1/5] device: Don't use device_get_adapter to access device adapter
From: Szymon Janc @ 2012-10-05 12:54 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

Use struct btd_device directly to access adapter member.

---
 src/device.c |   34 ++++++++++++++--------------------
 1 file changed, 14 insertions(+), 20 deletions(-)

diff --git a/src/device.c b/src/device.c
index 1c65b68..b2285dd 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1451,15 +1451,15 @@ add_uuids:
 
 static void device_remove_profiles(struct btd_device *device, GSList *uuids)
 {
-	struct btd_adapter *adapter = device_get_adapter(device);
 	char srcaddr[18], dstaddr[18];
 	sdp_list_t *records;
 	GSList *l, *next;
 
-	ba2str(adapter_get_address(adapter), srcaddr);
+	ba2str(adapter_get_address(device->adapter), srcaddr);
 	ba2str(&device->bdaddr, dstaddr);
 
-	records = read_records(adapter_get_address(adapter), &device->bdaddr);
+	records = read_records(adapter_get_address(device->adapter),
+							&device->bdaddr);
 
 	DBG("Removing profiles for %s", dstaddr);
 
@@ -1527,12 +1527,11 @@ static int rec_cmp(const void *a, const void *b)
 static void update_bredr_services(struct browse_req *req, sdp_list_t *recs)
 {
 	struct btd_device *device = req->device;
-	struct btd_adapter *adapter = device_get_adapter(device);
 	sdp_list_t *seq;
 	char srcaddr[18], dstaddr[18];
 	uint8_t dst_type;
 
-	ba2str(adapter_get_address(adapter), srcaddr);
+	ba2str(adapter_get_address(device->adapter), srcaddr);
 	ba2str(&device->bdaddr, dstaddr);
 
 	for (seq = recs; seq; seq = seq->next) {
@@ -1933,7 +1932,7 @@ static gboolean attrib_disconnected_cb(GIOChannel *io, GIOCondition cond,
 	 * initiated disconnection.
 	 */
 	if (err == ETIMEDOUT || err == ECONNRESET || err == ECONNABORTED)
-		adapter_connect_list_add(device_get_adapter(device), device);
+		adapter_connect_list_add(device->adapter, device);
 
 done:
 	attio_cleanup(device);
@@ -2083,7 +2082,7 @@ static void att_error_cb(const GError *gerr, gpointer user_data)
 	if (device->auto_connect == FALSE)
 		return;
 
-	adapter_connect_list_add(device_get_adapter(device), device);
+	adapter_connect_list_add(device->adapter, device);
 	DBG("Enabling automatic connections");
 }
 
@@ -2367,7 +2366,7 @@ void device_set_temporary(struct btd_device *device, gboolean temporary)
 	DBG("temporary %d", temporary);
 
 	if (temporary)
-		adapter_connect_list_remove(device_get_adapter(device), device);
+		adapter_connect_list_remove(device->adapter, device);
 
 	device->temporary = temporary;
 }
@@ -2384,7 +2383,6 @@ void device_set_bonded(struct btd_device *device, gboolean bonded)
 
 void device_set_auto_connect(struct btd_device *device, gboolean enable)
 {
-	struct btd_adapter *adapter = device_get_adapter(device);
 	char addr[18];
 
 	if (!device)
@@ -2398,7 +2396,7 @@ void device_set_auto_connect(struct btd_device *device, gboolean enable)
 
 	/* Disabling auto connect */
 	if (enable == FALSE) {
-		adapter_connect_list_remove(adapter, device);
+		adapter_connect_list_remove(device->adapter, device);
 		return;
 	}
 
@@ -2411,7 +2409,7 @@ void device_set_auto_connect(struct btd_device *device, gboolean enable)
 		return;
 
 	/* Enabling auto connect */
-	adapter_connect_list_add(adapter, device);
+	adapter_connect_list_add(device->adapter, device);
 }
 
 static gboolean start_discovery(gpointer user_data)
@@ -2714,8 +2712,7 @@ static void pincode_cb(struct agent *agent, DBusError *err,
 {
 	struct authentication_req *auth = data;
 	struct btd_device *device = auth->device;
-	struct btd_adapter *adapter = device_get_adapter(device);
-	struct agent *adapter_agent = adapter_get_agent(adapter);
+	struct agent *adapter_agent = adapter_get_agent(device->adapter);
 
 	if (err && (g_str_equal(DBUS_ERROR_UNKNOWN_METHOD, err->name) ||
 				g_str_equal(DBUS_ERROR_NO_REPLY, err->name))) {
@@ -2746,8 +2743,7 @@ static void confirm_cb(struct agent *agent, DBusError *err, void *data)
 {
 	struct authentication_req *auth = data;
 	struct btd_device *device = auth->device;
-	struct btd_adapter *adapter = device_get_adapter(device);
-	struct agent *adapter_agent = adapter_get_agent(adapter);
+	struct agent *adapter_agent = adapter_get_agent(device->adapter);
 
 	if (err && (g_str_equal(DBUS_ERROR_UNKNOWN_METHOD, err->name) ||
 				g_str_equal(DBUS_ERROR_NO_REPLY, err->name))) {
@@ -2780,8 +2776,7 @@ static void passkey_cb(struct agent *agent, DBusError *err,
 {
 	struct authentication_req *auth = data;
 	struct btd_device *device = auth->device;
-	struct btd_adapter *adapter = device_get_adapter(device);
-	struct agent *adapter_agent = adapter_get_agent(adapter);
+	struct agent *adapter_agent = adapter_get_agent(device->adapter);
 
 	if (err && (g_str_equal(DBUS_ERROR_UNKNOWN_METHOD, err->name) ||
 				g_str_equal(DBUS_ERROR_NO_REPLY, err->name))) {
@@ -2812,8 +2807,7 @@ static void display_pincode_cb(struct agent *agent, DBusError *err, void *data)
 {
 	struct authentication_req *auth = data;
 	struct btd_device *device = auth->device;
-	struct btd_adapter *adapter = device_get_adapter(device);
-	struct agent *adapter_agent = adapter_get_agent(adapter);
+	struct agent *adapter_agent = adapter_get_agent(device->adapter);
 
 	if (err && (g_str_equal(DBUS_ERROR_UNKNOWN_METHOD, err->name) ||
 				g_str_equal(DBUS_ERROR_NO_REPLY, err->name))) {
@@ -3235,7 +3229,7 @@ guint btd_device_add_attio_callback(struct btd_device *device,
 
 	device->attios = g_slist_append(device->attios, attio);
 
-	adapter_connect_list_add(device_get_adapter(device), device);
+	adapter_connect_list_add(device->adapter, device);
 
 	return attio->id;
 }
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH 2/5] device: Don't use device_get_addr_type to access device address type
From: Szymon Janc @ 2012-10-05 12:54 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1349441679-18557-1-git-send-email-szymon.janc@tieto.com>

Use struct btd_device directly to access bdaddr_type member.

---
 src/device.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/device.c b/src/device.c
index b2285dd..1615747 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1529,7 +1529,6 @@ static void update_bredr_services(struct browse_req *req, sdp_list_t *recs)
 	struct btd_device *device = req->device;
 	sdp_list_t *seq;
 	char srcaddr[18], dstaddr[18];
-	uint8_t dst_type;
 
 	ba2str(adapter_get_address(device->adapter), srcaddr);
 	ba2str(&device->bdaddr, dstaddr);
@@ -1594,9 +1593,7 @@ static void update_bredr_services(struct browse_req *req, sdp_list_t *recs)
 			continue;
 		}
 
-		dst_type = device_get_addr_type(device);
-
-		store_record(srcaddr, dstaddr, dst_type, rec);
+		store_record(srcaddr, dstaddr, device->bdaddr_type, rec);
 
 		/* Copy record */
 		req->records = sdp_list_append(req->records,
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH 3/5] adapter: Don't use adapter_get_address to access adapter address
From: Szymon Janc @ 2012-10-05 12:54 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1349441679-18557-1-git-send-email-szymon.janc@tieto.com>

Use struct btd_adapter directly to access bdaddr member.

---
 src/adapter.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 7e695b9..885d232 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1884,7 +1884,7 @@ static void create_stored_device_from_ltks(char *key, char *value,
 					(GCompareFunc) device_address_cmp))
 		return;
 
-	ba2str(adapter_get_address(adapter), srcaddr);
+	ba2str(&adapter->bdaddr, srcaddr);
 
 	if (g_strcmp0(srcaddr, address) == 0)
 		return;
@@ -3626,8 +3626,8 @@ ssize_t btd_adapter_get_pin(struct btd_adapter *adapter, struct btd_device *dev,
 			return ret;
 	}
 
-	return read_pin_code(adapter_get_address(adapter),
-					device_get_address(dev), pin_buf);
+	return read_pin_code(&adapter->bdaddr, device_get_address(dev),
+								pin_buf);
 }
 
 void btd_adapter_register_powered_callback(struct btd_adapter *adapter,
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH 4/5] adapter: Don't use adapter_get_path to access adapter path
From: Szymon Janc @ 2012-10-05 12:54 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1349441679-18557-1-git-send-email-szymon.janc@tieto.com>

Use struct btd_adapter directly to access path member.

---
 src/adapter.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 885d232..2f8c8a3 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3183,7 +3183,6 @@ done:
 
 void adapter_mode_changed(struct btd_adapter *adapter, uint8_t scan_mode)
 {
-	const gchar *path = adapter_get_path(adapter);
 	gboolean discoverable, pairable;
 
 	DBG("old 0x%02x new 0x%02x", adapter->scan_mode, scan_mode);
@@ -3218,7 +3217,7 @@ void adapter_mode_changed(struct btd_adapter *adapter, uint8_t scan_mode)
 					ADAPTER_INTERFACE, "Pairable",
 					DBUS_TYPE_BOOLEAN, &pairable);
 
-	emit_property_changed(path,
+	emit_property_changed(adapter->path,
 				ADAPTER_INTERFACE, "Discoverable",
 				DBUS_TYPE_BOOLEAN, &discoverable);
 
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH 5/5] device: Move auth_type_t definition to device.c
From: Szymon Janc @ 2012-10-05 12:54 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc
In-Reply-To: <1349441679-18557-1-git-send-email-szymon.janc@tieto.com>

Bonding is handled in device.c and auth_type_t is private device data
not used outside of it.

---
 src/device.c |    8 ++++++++
 src/device.h |    8 --------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/device.c b/src/device.c
index 1615747..28fc989 100644
--- a/src/device.c
+++ b/src/device.c
@@ -82,6 +82,14 @@ struct bonding_req {
 	struct btd_device *device;
 };
 
+typedef enum {
+	AUTH_TYPE_PINCODE,
+	AUTH_TYPE_PASSKEY,
+	AUTH_TYPE_CONFIRM,
+	AUTH_TYPE_NOTIFY_PASSKEY,
+	AUTH_TYPE_NOTIFY_PINCODE,
+} auth_type_t;
+
 struct authentication_req {
 	auth_type_t type;
 	void *cb;
diff --git a/src/device.h b/src/device.h
index 0c16c18..d23f40d 100644
--- a/src/device.h
+++ b/src/device.h
@@ -26,14 +26,6 @@
 
 struct btd_device;
 
-typedef enum {
-	AUTH_TYPE_PINCODE,
-	AUTH_TYPE_PASSKEY,
-	AUTH_TYPE_CONFIRM,
-	AUTH_TYPE_NOTIFY_PASSKEY,
-	AUTH_TYPE_NOTIFY_PINCODE,
-} auth_type_t;
-
 struct btd_device *device_create(struct btd_adapter *adapter,
 				const char *address, uint8_t bdaddr_type);
 
-- 
1.7.9.5


^ permalink raw reply related

* Re: [PATCH 1/5] device: Don't use device_get_adapter to access device adapter
From: Johan Hedberg @ 2012-10-05 13:13 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth
In-Reply-To: <1349441679-18557-1-git-send-email-szymon.janc@tieto.com>

Hi Szymon,

On Fri, Oct 05, 2012, Szymon Janc wrote:
> Use struct btd_device directly to access adapter member.
> 
> ---
>  src/device.c |   34 ++++++++++++++--------------------
>  1 file changed, 14 insertions(+), 20 deletions(-)

All patches in this set have been applied. Thanks.

Johan

^ permalink raw reply

* [PATCHv1 1/7] Bluetooth: L2CAP: Fix using default Flush Timeout for EFS
From: Andrei Emeltchenko @ 2012-10-05 13:56 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

There are two Flush Timeouts: one is old Flush Timeot Option
which is 2 octets and the second is Flush Timeout inside EFS
which is 4 octets long.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 include/net/bluetooth/l2cap.h |    3 ++-
 net/bluetooth/l2cap_core.c    |   10 ++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index ab58b81..83fb9c7 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -32,7 +32,8 @@
 /* L2CAP defaults */
 #define L2CAP_DEFAULT_MTU		672
 #define L2CAP_DEFAULT_MIN_MTU		48
-#define L2CAP_DEFAULT_FLUSH_TO		0xffff
+#define L2CAP_DEFAULT_FLUSH_TO		0xFFFF
+#define L2CAP_EFS_DEFAULT_FLUSH_TO	0xFFFFFFFF
 #define L2CAP_DEFAULT_TX_WINDOW		63
 #define L2CAP_DEFAULT_EXT_WINDOW	0x3FFF
 #define L2CAP_DEFAULT_MAX_TX		3
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index b4e707b..ab6853d 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -504,7 +504,7 @@ void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan)
 	chan->local_msdu	= L2CAP_DEFAULT_MAX_SDU_SIZE;
 	chan->local_sdu_itime	= L2CAP_DEFAULT_SDU_ITIME;
 	chan->local_acc_lat	= L2CAP_DEFAULT_ACC_LAT;
-	chan->local_flush_to	= L2CAP_DEFAULT_FLUSH_TO;
+	chan->local_flush_to	= L2CAP_EFS_DEFAULT_FLUSH_TO;
 
 	l2cap_chan_hold(chan);
 
@@ -2714,8 +2714,10 @@ static void l2cap_add_opt_efs(void **ptr, struct l2cap_chan *chan)
 		efs.stype	= chan->local_stype;
 		efs.msdu	= cpu_to_le16(chan->local_msdu);
 		efs.sdu_itime	= cpu_to_le32(chan->local_sdu_itime);
-		efs.acc_lat	= __constant_cpu_to_le32(L2CAP_DEFAULT_ACC_LAT);
-		efs.flush_to	= __constant_cpu_to_le32(L2CAP_DEFAULT_FLUSH_TO);
+		efs.acc_lat	=
+			__constant_cpu_to_le32(L2CAP_DEFAULT_ACC_LAT);
+		efs.flush_to	=
+			__constant_cpu_to_le32(L2CAP_EFS_DEFAULT_FLUSH_TO);
 		break;
 
 	case L2CAP_MODE_STREAMING:
@@ -2732,7 +2734,7 @@ static void l2cap_add_opt_efs(void **ptr, struct l2cap_chan *chan)
 	}
 
 	l2cap_add_conf_opt(ptr, L2CAP_CONF_EFS, sizeof(efs),
-							(unsigned long) &efs);
+			   (unsigned long) &efs);
 }
 
 static void l2cap_ack_timeout(struct work_struct *work)
-- 
1.7.9.5


^ permalink raw reply related

* [PATCHv1 2/7] Bluetooth: AMP: Fix possible NULL dereference
From: Andrei Emeltchenko @ 2012-10-05 13:56 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1349445419-16788-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Check that link key exist before accessing.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 net/bluetooth/amp.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index 5dab2d1..b6e1c3a 100644
--- a/net/bluetooth/amp.c
+++ b/net/bluetooth/amp.c
@@ -184,6 +184,10 @@ int phylink_gen_key(struct hci_conn *conn, u8 *data, u8 *len, u8 *type)
 	*len = HCI_AMP_LINK_KEY_SIZE;
 
 	key = hci_find_link_key(hdev, &conn->dst);
+	if (!key) {
+		BT_DBG("No Link key for conn %p dst %pMR", conn, &conn->dst);
+		return -EACCES;
+	}
 
 	/* BR/EDR Link Key concatenated together with itself */
 	memcpy(&keybuf[0], key->val, HCI_LINK_KEY_SIZE);
-- 
1.7.9.5


^ permalink raw reply related

* [PATCHv1 3/7] Bluetooth: Fix dereference after NULL check
From: Andrei Emeltchenko @ 2012-10-05 13:56 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1349445419-16788-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Move code dereferencing possible NULL pointer to the check branch.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 net/bluetooth/l2cap_sock.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 2542abd..a71c408 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -382,13 +382,14 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, ch
 		}
 
 		memset(&sec, 0, sizeof(sec));
-		if (chan->conn)
+		if (chan->conn) {
 			sec.level = chan->conn->hcon->sec_level;
-		else
-			sec.level = chan->sec_level;
 
-		if (sk->sk_state == BT_CONNECTED)
-			sec.key_size = chan->conn->hcon->enc_key_size;
+			if (sk->sk_state == BT_CONNECTED)
+				sec.key_size = chan->conn->hcon->enc_key_size;
+		} else {
+			sec.level = chan->sec_level;
+		}
 
 		len = min_t(unsigned int, len, sizeof(sec));
 		if (copy_to_user(optval, (char *) &sec, len))
-- 
1.7.9.5


^ permalink raw reply related

* [PATCHv1 4/7] Bluetooth: AMP: Factor out amp_ctrl_add
From: Andrei Emeltchenko @ 2012-10-05 13:56 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1349445419-16788-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Add ctrl_id parameter to amp_ctrl_add since we always set it
after function ctrl is created.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 include/net/bluetooth/amp.h |    2 +-
 net/bluetooth/a2mp.c        |    8 ++------
 net/bluetooth/amp.c         |    7 ++++---
 3 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/include/net/bluetooth/amp.h b/include/net/bluetooth/amp.h
index b1e5490..ae2c3e5 100644
--- a/include/net/bluetooth/amp.h
+++ b/include/net/bluetooth/amp.h
@@ -26,7 +26,7 @@ struct amp_ctrl {
 
 int amp_ctrl_put(struct amp_ctrl *ctrl);
 void amp_ctrl_get(struct amp_ctrl *ctrl);
-struct amp_ctrl *amp_ctrl_add(struct amp_mgr *mgr);
+struct amp_ctrl *amp_ctrl_add(struct amp_mgr *mgr, u8 id);
 struct amp_ctrl *amp_ctrl_lookup(struct amp_mgr *mgr, u8 id);
 void amp_ctrl_list_flush(struct amp_mgr *mgr);
 
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
index d4946b5..88a4b58 100644
--- a/net/bluetooth/a2mp.c
+++ b/net/bluetooth/a2mp.c
@@ -316,12 +316,10 @@ static int a2mp_getinfo_rsp(struct amp_mgr *mgr, struct sk_buff *skb,
 	if (rsp->status)
 		return -EINVAL;
 
-	ctrl = amp_ctrl_add(mgr);
+	ctrl = amp_ctrl_add(mgr, rsp->id);
 	if (!ctrl)
 		return -ENOMEM;
 
-	ctrl->id = rsp->id;
-
 	req.id = rsp->id;
 	a2mp_send(mgr, A2MP_GETAMPASSOC_REQ, __next_ident(mgr), sizeof(req),
 		  &req);
@@ -461,7 +459,7 @@ static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb,
 
 	ctrl = amp_ctrl_lookup(mgr, rsp.remote_id);
 	if (!ctrl) {
-		ctrl = amp_ctrl_add(mgr);
+		ctrl = amp_ctrl_add(mgr, rsp.remote_id);
 		if (ctrl) {
 			amp_ctrl_get(ctrl);
 		} else {
@@ -474,8 +472,6 @@ static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb,
 		size_t assoc_len = le16_to_cpu(hdr->len) - sizeof(*req);
 		u8 *assoc;
 
-		ctrl->id = rsp.remote_id;
-
 		assoc = kzalloc(assoc_len, GFP_KERNEL);
 		if (!assoc) {
 			amp_ctrl_put(ctrl);
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index b6e1c3a..2fc5562 100644
--- a/net/bluetooth/amp.c
+++ b/net/bluetooth/amp.c
@@ -45,7 +45,7 @@ int amp_ctrl_put(struct amp_ctrl *ctrl)
 	return kref_put(&ctrl->kref, &amp_ctrl_destroy);
 }
 
-struct amp_ctrl *amp_ctrl_add(struct amp_mgr *mgr)
+struct amp_ctrl *amp_ctrl_add(struct amp_mgr *mgr, u8 id)
 {
 	struct amp_ctrl *ctrl;
 
@@ -53,12 +53,13 @@ struct amp_ctrl *amp_ctrl_add(struct amp_mgr *mgr)
 	if (!ctrl)
 		return NULL;
 
+	kref_init(&ctrl->kref);
+	ctrl->id = id;
+
 	mutex_lock(&mgr->amp_ctrls_lock);
 	list_add(&ctrl->list, &mgr->amp_ctrls);
 	mutex_unlock(&mgr->amp_ctrls_lock);
 
-	kref_init(&ctrl->kref);
-
 	BT_DBG("mgr %p ctrl %p", mgr, ctrl);
 
 	return ctrl;
-- 
1.7.9.5


^ permalink raw reply related

* [PATCHv1 5/7] Bluetooth: AMP: Factor out phylink_add
From: Andrei Emeltchenko @ 2012-10-05 13:56 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1349445419-16788-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Add direction parameter to phylink_add since it is anyway set later.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 include/net/bluetooth/amp.h |    2 +-
 net/bluetooth/a2mp.c        |    4 ++--
 net/bluetooth/amp.c         |    6 ++++--
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/include/net/bluetooth/amp.h b/include/net/bluetooth/amp.h
index ae2c3e5..2e7c79e 100644
--- a/include/net/bluetooth/amp.h
+++ b/include/net/bluetooth/amp.h
@@ -31,7 +31,7 @@ struct amp_ctrl *amp_ctrl_lookup(struct amp_mgr *mgr, u8 id);
 void amp_ctrl_list_flush(struct amp_mgr *mgr);
 
 struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr,
-			     u8 remote_id);
+			     u8 remote_id, bool out);
 
 int phylink_gen_key(struct hci_conn *hcon, u8 *data, u8 *len, u8 *type);
 
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
index 88a4b58..3ff4dc9 100644
--- a/net/bluetooth/a2mp.c
+++ b/net/bluetooth/a2mp.c
@@ -417,7 +417,7 @@ static int a2mp_getampassoc_rsp(struct amp_mgr *mgr, struct sk_buff *skb,
 	if (!hdev)
 		return -EINVAL;
 
-	hcon = phylink_add(hdev, mgr, rsp->id);
+	hcon = phylink_add(hdev, mgr, rsp->id, true);
 	if (!hcon)
 		goto done;
 
@@ -487,7 +487,7 @@ static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb,
 		amp_ctrl_put(ctrl);
 	}
 
-	hcon = phylink_add(hdev, mgr, req->local_id);
+	hcon = phylink_add(hdev, mgr, req->local_id, false);
 	if (hcon) {
 		amp_accept_phylink(hdev, mgr, hcon);
 		rsp.status = A2MP_STATUS_SUCCESS;
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index 2fc5562..59da0f1 100644
--- a/net/bluetooth/amp.c
+++ b/net/bluetooth/amp.c
@@ -108,7 +108,7 @@ static u8 __next_handle(struct amp_mgr *mgr)
 }
 
 struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr,
-			     u8 remote_id)
+			     u8 remote_id, bool out)
 {
 	bdaddr_t *dst = mgr->l2cap_conn->dst;
 	struct hci_conn *hcon;
@@ -117,12 +117,14 @@ struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr,
 	if (!hcon)
 		return NULL;
 
+	BT_DBG("hcon %p dst %pMR", hcon, dst);
+
 	hcon->state = BT_CONNECT;
-	hcon->out = true;
 	hcon->attempt++;
 	hcon->handle = __next_handle(mgr);
 	hcon->remote_id = remote_id;
 	hcon->amp_mgr = mgr;
+	hcon->out = out;
 
 	return hcon;
 }
-- 
1.7.9.5


^ permalink raw reply related

* [PATCHv1 6/7] Bluetooth: AMP: Use block_mtu for AMP controller
From: Andrei Emeltchenko @ 2012-10-05 13:56 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1349445419-16788-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>


Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 net/bluetooth/l2cap_core.c |   18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index ab6853d..3066157 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1390,10 +1390,22 @@ static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon, u8 status)
 
 	BT_DBG("hcon %p conn %p hchan %p", hcon, conn, hchan);
 
-	if (hcon->hdev->le_mtu && hcon->type == LE_LINK)
-		conn->mtu = hcon->hdev->le_mtu;
-	else
+	switch (hcon->type) {
+	case AMP_LINK:
+		conn->mtu = hcon->hdev->block_mtu;
+		break;
+
+	case LE_LINK:
+		if (hcon->hdev->le_mtu) {
+			conn->mtu = hcon->hdev->le_mtu;
+			break;
+		}
+		/* fall through */
+
+	default:
 		conn->mtu = hcon->hdev->acl_mtu;
+		break;
+	}
 
 	conn->src = &hcon->hdev->bdaddr;
 	conn->dst = &hcon->dst;
-- 
1.7.9.5


^ permalink raw reply related

* [PATCHv1 7/7] Bluetooth: Adjust L2CAP Max PDU size for AMP packets
From: Andrei Emeltchenko @ 2012-10-05 13:56 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1349445419-16788-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Maximum PDU size is defined by new BT Spec as 1492 octets.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 include/net/bluetooth/l2cap.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 83fb9c7..caab98c 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -39,7 +39,7 @@
 #define L2CAP_DEFAULT_MAX_TX		3
 #define L2CAP_DEFAULT_RETRANS_TO	2000    /* 2 seconds */
 #define L2CAP_DEFAULT_MONITOR_TO	12000   /* 12 seconds */
-#define L2CAP_DEFAULT_MAX_PDU_SIZE	1009    /* Sized for 3-DH5 packet */
+#define L2CAP_DEFAULT_MAX_PDU_SIZE	1492    /* Sized for AMP packet */
 #define L2CAP_DEFAULT_ACK_TO		200
 #define L2CAP_DEFAULT_MAX_SDU_SIZE	0xFFFF
 #define L2CAP_DEFAULT_SDU_ITIME		0xFFFFFFFF
-- 
1.7.9.5


^ permalink raw reply related

* Re: [PATCH] net, bluetooth: don't attempt to free a channel that wasn't created
From: Sasha Levin @ 2012-10-05 15:09 UTC (permalink / raw)
  To: Andrei Emeltchenko, Sasha Levin, marcel, gustavo, johan.hedberg,
	davem, davej, linux-kernel, linux-bluetooth, netdev
In-Reply-To: <20121005102159.GF12229@aemeltch-MOBL1>

On 10/05/2012 06:22 AM, Andrei Emeltchenko wrote:
> Hi Sasha,
> 
> On Thu, Oct 04, 2012 at 07:59:57PM -0400, Sasha Levin wrote:
>> We may currently attempt to free a channel which wasn't created due to
>> an error in the initialization path, this would cause a NULL ptr deref.
> 
> Please put oops dump here.

[   12.919073] BUG: unable to handle kernel NULL pointer dereference at 0000000000000010
[   12.919131] IP: [<ffffffff836645c4>] l2cap_chan_put+0x34/0x50
[   12.919135] PGD 0
[   12.919138] Oops: 0002 [#1] PREEMPT SMP DEBUG_PAGEALLOC
[   12.919193] Dumping ftrace buffer:
[   12.919242]    (ftrace buffer empty)
[   12.919314] Modules linked in:
[   12.919318] CPU 1
[   12.919319] Pid: 6210, comm: krfcommd Tainted: G        W    3.6.0-next-20121004-sasha-00005-gb010653-dirty #30
[   12.919374] RIP: 0010:[<ffffffff836645c4>]  [<ffffffff836645c4>] l2cap_chan_put+0x34/0x50
[   12.919377] RSP: 0000:ffff880066933c38  EFLAGS: 00010246
[   12.919378] RAX: ffffffff8366c780 RBX: 0000000000000000 RCX: 6666666666666667
[   12.919379] RDX: 0000000000000fa0 RSI: ffffffff84d3f79e RDI: 0000000000000010
[   12.919381] RBP: ffff880066933c48 R08: ffffffff859989f8 R09: 0000000000000001
[   12.919382] R10: 0000000000000000 R11: 7fffffffffffffff R12: 0000000000000000
[   12.919383] R13: ffff88009b00a200 R14: ffff88009b00a200 R15: 0000000000000001
[   12.919385] FS:  0000000000000000(0000) GS:ffff880033600000(0000) knlGS:0000000000000000
[   12.919437] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   12.919440] CR2: 0000000000000010 CR3: 0000000005026000 CR4: 00000000000406e0
[   12.919446] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[   12.919451] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[   12.919504] Process krfcommd (pid: 6210, threadinfo ffff880066932000, task ffff880065c4b000)
[   12.919506] Stack:
[   12.919510]  ffff88009b00a200 ffff880032084000 ffff880066933c68 ffffffff8366c7bc
[   12.919513]  7fffffffffffffff ffff880032084000 ffff880066933c98 ffffffff833ae0ae
[   12.919516]  ffff880066933ca8 0000000000000000 0000000000000000 ffff88009b00a200
[   12.919517] Call Trace:
[   12.919522]  [<ffffffff8366c7bc>] l2cap_sock_destruct+0x3c/0x80
[   12.919527]  [<ffffffff833ae0ae>] __sk_free+0x1e/0x1f0
[   12.919530]  [<ffffffff833ae2f7>] sk_free+0x17/0x20
[   12.919585]  [<ffffffff8366ca4e>] l2cap_sock_alloc.constprop.5+0x9e/0xd0
[   12.919591]  [<ffffffff8366cb9e>] l2cap_sock_create+0x7e/0x100
[   12.919652]  [<ffffffff83a4f32a>] ? _raw_read_lock+0x6a/0x80
[   12.919658]  [<ffffffff836402c4>] ? bt_sock_create+0x74/0x110
[   12.919660]  [<ffffffff83640308>] bt_sock_create+0xb8/0x110
[   12.919664]  [<ffffffff833aa232>] __sock_create+0x282/0x3b0
[   12.919720]  [<ffffffff833aa0b0>] ? __sock_create+0x100/0x3b0
[   12.919725]  [<ffffffff836785b0>] ? rfcomm_process_sessions+0x17e0/0x17e0
[   12.919779]  [<ffffffff833aa37f>] sock_create_kern+0x1f/0x30
[   12.919784]  [<ffffffff83675714>] rfcomm_l2sock_create+0x44/0x70
[   12.919787]  [<ffffffff836785b0>] ? rfcomm_process_sessions+0x17e0/0x17e0
[   12.919790]  [<ffffffff836785fe>] rfcomm_run+0x4e/0x1f0
[   12.919846]  [<ffffffff836785b0>] ? rfcomm_process_sessions+0x17e0/0x17e0
[   12.919852]  [<ffffffff81138ee3>] kthread+0xe3/0xf0
[   12.919908]  [<ffffffff8117b12e>] ? put_lock_stats.isra.14+0xe/0x40
[   12.919914]  [<ffffffff81138e00>] ? flush_kthread_work+0x1f0/0x1f0
[   12.919968]  [<ffffffff83a5077c>] ret_from_fork+0x7c/0x90
[   12.919973]  [<ffffffff81138e00>] ? flush_kthread_work+0x1f0/0x1f0
[   12.920161] Code: 83 ec 08 f6 05 ff 58 44 02 04 74 1b 8b 4f 10 48 89 fa 48 c7 c6 d9 d7 d4 84 48 c7 c7 80 9e aa 85 31 c0 e8 80
ac 3a fe 48 8d 7b 10 <f0> 83 6b 10 01 0f 94 c0 84 c0 74 05 e8 8b e0 ff ff 48 83 c4 08
[   12.920165] RIP  [<ffffffff836645c4>] l2cap_chan_put+0x34/0x50
[   12.920166]  RSP <ffff880066933c38>
[   12.920167] CR2: 0000000000000010
[   12.920417] ---[ end trace 5a9114e8a158ab84 ]---

> 
>> Introduced in commit 61d6ef3e ("Bluetooth: Make better use of l2cap_chan
>> reference counting").
>>
>> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
>> ---
>>  net/bluetooth/l2cap_sock.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
>> index 083f2bf..66c295a 100644
>> --- a/net/bluetooth/l2cap_sock.c
>> +++ b/net/bluetooth/l2cap_sock.c
>> @@ -1083,7 +1083,8 @@ static void l2cap_sock_destruct(struct sock *sk)
>>  {
>>  	BT_DBG("sk %p", sk);
>>  
>> -	l2cap_chan_put(l2cap_pi(sk)->chan);
>> +	if (l2cap_pi(sk)->chan)
>> +		l2cap_chan_put(l2cap_pi(sk)->chan);
> 
> This does not look right, I suppose you want to put somewhere missing
> chan_hold

The issue is basically kzalloc() failing in l2cap_chan_create(), this would lead to sk_free()
getting called with chan being NULL, which is why I don't think that chan_hold is relevant
at this stage.


Thanks,
Sasha

^ permalink raw reply

* Re: [PATCHv1 7/7] Bluetooth: Adjust L2CAP Max PDU size for AMP packets
From: Mat Martineau @ 2012-10-05 17:40 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1349445419-16788-7-git-send-email-Andrei.Emeltchenko.news@gmail.com>


On Fri, 5 Oct 2012, Andrei Emeltchenko wrote:

> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> Maximum PDU size is defined by new BT Spec as 1492 octets.
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> include/net/bluetooth/l2cap.h |    2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
> index 83fb9c7..caab98c 100644
> --- a/include/net/bluetooth/l2cap.h
> +++ b/include/net/bluetooth/l2cap.h
> @@ -39,7 +39,7 @@
> #define L2CAP_DEFAULT_MAX_TX		3
> #define L2CAP_DEFAULT_RETRANS_TO	2000    /* 2 seconds */
> #define L2CAP_DEFAULT_MONITOR_TO	12000   /* 12 seconds */
> -#define L2CAP_DEFAULT_MAX_PDU_SIZE	1009    /* Sized for 3-DH5 packet */
> +#define L2CAP_DEFAULT_MAX_PDU_SIZE	1492    /* Sized for AMP packet */
> #define L2CAP_DEFAULT_ACK_TO		200
> #define L2CAP_DEFAULT_MAX_SDU_SIZE	0xFFFF
> #define L2CAP_DEFAULT_SDU_ITIME		0xFFFFFFFF
> -- 
> 1.7.9.5

I had missed this, thanks for fixing it.  This makes AMP use the most 
efficient PDU size for AMP controllers, while the size of the PDUs 
sent on BR/EDR links will still be limited to 
L2CAP_BR_EDR_MAX_PAYLOAD.

Reviewed-by: Mat Martineau <mathewm@codeaurora.org>

--
Mat Martineau

The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation


^ permalink raw reply

* Re: [PATCH v3] Cycling Speed and Cadence profile (CSCP) API
From: Johan Hedberg @ 2012-10-05 17:43 UTC (permalink / raw)
  To: Andrzej Kaczmarek; +Cc: linux-bluetooth
In-Reply-To: <1349084621-25284-2-git-send-email-andrzej.kaczmarek@tieto.com>

Hi Andrzej,

On Mon, Oct 01, 2012, Andrzej Kaczmarek wrote:
> ---
>  doc/cycling-api.txt | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 118 insertions(+)
>  create mode 100644 doc/cycling-api.txt

Applied. Thanks.

Do you already have some corresponding code too?

Johan

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox