From: Szymon Janc <szymon.janc@tieto.com>
To: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] android/avdtp: Fix crash on disconnect
Date: Fri, 26 Sep 2014 15:40:33 +0200 [thread overview]
Message-ID: <3119980.6yBsDKdWM4@uw000953> (raw)
In-Reply-To: <1411737719-28189-1-git-send-email-szymon.janc@tieto.com>
On Friday 26 of September 2014 15:21:59 Szymon Janc wrote:
> Last reference to session may be dropped while calling connection_lost
> so move watch ID clean before that.
>
> external/bluetooth/bluez/android/avdtp.c:session_cb()
> external/bluetooth/bluez/android/avdtp.c:avdtp_parse_resp() CLOSE
> request succeeded
> external/bluetooth/bluez/android/avdtp.c:avdtp_sep_set_state() stream
> state changed: OPEN -> CLOSING
> external/bluetooth/bluez/android/a2dp.c:sep_close_cfm()
> external/bluetooth/bluez/android/avdtp.c:avdtp_sep_set_state() stream
> state changed: CLOSING -> IDLE
> external/bluetooth/bluez/android/avdtp.c:session_cb()
> external/bluetooth/bluez/android/avdtp.c:connection_lost()
> Disconnected: I/O error (5)
> external/bluetooth/bluez/android/avdtp.c:avdtp_ref() 0x4a27fc8: ref=2
> external/bluetooth/bluez/android/a2dp.c:bt_a2dp_notify_state() device
> 00:1E:DE:21:85:6A state 0
> external/bluetooth/bluez/android/avrcp.c:bt_avrcp_disconnect()
> external/bluetooth/bluez/android/avctp.c:avctp_shutdown() AVCTP:
> closing uinput
> external/bluetooth/bluez/android/avrcp.c:disconnect_cb()
> external/bluetooth/bluez/android/avdtp.c:avdtp_unref() 0x4a27fc8: ref=1
> external/bluetooth/bluez/android/avdtp.c:avdtp_unref() 0x4a27fc8: ref=0
> external/bluetooth/bluez/android/avdtp.c:avdtp_free() 0x4a27fc8
>
> ==1225== Invalid write of size 4
> ==1225== at 0x11ABDE: session_cb (avdtp.c:2084)
> ==1225== by 0x48BD9C7: g_io_unix_dispatch (giounix.c:166)
> ==1225== by 0x48C2CCB: g_main_context_dispatch (gmain.c:2539)
> ==1225== by 0x48C2ED9: g_main_context_iterate.isra.19 (gmain.c:3146)
> ==1225== by 0x48C3167: g_main_loop_run (gmain.c:3340)
> ==1225== by 0x10D379: main (main.c:628)
> ==1225== Address 0x4a27fdc is 20 bytes inside a block of size 1,104 free'd
> ==1225== at 0x4897E6C: free (in /system/lib/valgrind/
> vgpreload_memcheck-arm-linux.so)
> ==1225== by 0x48C5E2B: g_free (gmem.c:252)
> ==1225== by 0x11ABDB: session_cb (avdtp.c:2082)
> ==1225== by 0x48BD9C7: g_io_unix_dispatch (giounix.c:166)
> ==1225== by 0x48C2CCB: g_main_context_dispatch (gmain.c:2539)
> ==1225== by 0x48C2ED9: g_main_context_iterate.isra.19 (gmain.c:3146)
> ==1225== by 0x48C3167: g_main_loop_run (gmain.c:3340)
> ==1225== by 0x10D379: main (main.c:628)
> ==1225==
> ---
>
> Other option would be to pass avdtp reference to session_cb and drop it
> when function returns FALSE. If that is prefered I'd send revised
> patch.
>
> android/avdtp.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/android/avdtp.c b/android/avdtp.c
> index 970476a..9f2527f 100644
> --- a/android/avdtp.c
> +++ b/android/avdtp.c
> @@ -2079,9 +2079,8 @@ next:
> return TRUE;
>
> failed:
> - connection_lost(session, EIO);
> -
> session->io_id = 0;
> + connection_lost(session, EIO);
>
> return FALSE;
> }
>
Pushed.
--
Best regards,
Szymon Janc
prev parent reply other threads:[~2014-09-26 13:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-26 13:21 [PATCH] android/avdtp: Fix crash on disconnect Szymon Janc
2014-09-26 13:40 ` Szymon Janc [this message]
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=3119980.6yBsDKdWM4@uw000953 \
--to=szymon.janc@tieto.com \
--cc=linux-bluetooth@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox