All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: Yunhan Wang <yunhanw@google.com>
Cc: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH] gatt: Fix double att_disconnected issue on disconnection
Date: Thu, 25 Oct 2018 12:20:14 +0300	[thread overview]
Message-ID: <CABBYNZ+5i=tv-dcnMr+21D28NZL9ayWVTLkC8DfWQA9jZUWXQg@mail.gmail.com> (raw)
In-Reply-To: <CALvjcs83c2B0aq7Vz8WU4DC=ikQfB5W_XfYh+S_rkydi=6agMw@mail.gmail.com>

Hi Yunhan,

On Thu, Oct 25, 2018 at 4:47 AM Yunhan Wang <yunhanw@google.com> wrote:
>
> Hi, Luiz
>
> I am observing the multiple crashes when doing BLE disconnection using
> latest bluez master..It looks like the two att_disconnect are
> triggered from your last gatt commit.. Please help take a look at this
> workaround and comments.. the better solution might be to figure out
> how to handle the disconnection along with random address and public
> address together regarding the previous issue, Gatt: Subscriptions are
> not cleared after disconnection from a temporary device

Ive pushed a similar fix, it should remove the handler before calling
att_disconnected.

> Thanks
> Best wishes
> Yunhan
> On Wed, Oct 24, 2018 at 5:42 PM yunhanw <yunhanw@google.com> wrote:
> >
> > When BLE disconnection happens, att_disconnect is triggered from two locations, the new added location is gatt_server_cleanup, it would cause several blueetoothd crashes. This bus is introduced from commit 634f0a6e1125af8d5959bff119d9336a8d81c028, where gatt fix, gatt subscriptions are not cleared after disconnection from a temporary device with private/random address. In order to workaround this issue, btd_gatt_database_att_disconnected can only be triggered when address type is random, and for others, it can continue to use original disconnect code path.
> >
> >     crash 1
> >     Program received signal SIGSEGV, Segmentation fault.
> >     queue_remove (queue=0x30, data=data@entry=0x555555872a40) at /repo/src/shared/queue.c:256
> >     256     for (entry = queue->head, prev = NULL; entry;
> >     (gdb) backtrace
> >         at /bluez/repo/src/gatt-database.c:350
> >         at bluez/repo/src/shared/queue.c:220
> >         at bluez/repo/src/shared/att.c:592
> >         at bluez/repo/src/shared/io-glib.c:170
> >
> >     crash 2
> >         at bluez/repo/src/shared/queue.c:220
> >         at bluez/repo/src/shared/att.c:592
> >         at bluez/repo/src/shared/io-glib.c:170
> >
> >     (gdb) print state->db->adapter
> >     Cannot access memory at address 0x61672f6269727474
> > ---
> >  src/gatt-database.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/src/gatt-database.c b/src/gatt-database.c
> > index 783b692d5..2f0eb83b5 100644
> > --- a/src/gatt-database.c
> > +++ b/src/gatt-database.c
> > @@ -3365,6 +3365,8 @@ void btd_gatt_database_att_disconnected(struct btd_gatt_database *database,
> >
> >         addr = device_get_address(device);
> >         type = btd_device_get_bdaddr_type(device);
> > +    if (type != BDADDR_LE_RANDOM)
> > +        return;
> >
> >         state = find_device_state(database, addr, type);
> >         if (!state)
> > --
> > 2.19.1.568.g152ad8e336-goog
> >



-- 
Luiz Augusto von Dentz

  reply	other threads:[~2018-10-25  9:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-25  0:42 [PATCH] gatt: Fix double att_disconnected issue on disconnection yunhanw
2018-10-25  1:47 ` Yunhan Wang
2018-10-25  9:20   ` Luiz Augusto von Dentz [this message]
2018-10-25 17:49     ` Yunhan Wang
2018-10-25 18:19       ` Yunhan Wang
     [not found]         ` <CABBYNZ+YKck9btAU=qkohHT0C__RF-0pf2vK2eF14XB8K6x9WQ@mail.gmail.com>
2018-10-25 20:21           ` Luiz Augusto von Dentz
2018-10-25 21:05             ` Yunhan Wang
2018-10-25 21:41               ` Luiz Augusto von Dentz
2018-10-26  1:59                 ` Yunhan Wang
2018-10-29 13:28                   ` Luiz Augusto von Dentz
2018-10-29 20:05                     ` Yunhan Wang
2018-10-30  7:21                       ` Yunhan Wang
2018-10-30 12:52                         ` Luiz Augusto von Dentz
2018-10-30 15:02                           ` Yunhan Wang
2018-10-30 15:06                             ` Luiz Augusto von Dentz
2018-10-30 15:35                               ` Yunhan Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABBYNZ+5i=tv-dcnMr+21D28NZL9ayWVTLkC8DfWQA9jZUWXQg@mail.gmail.com' \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=yunhanw@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.