Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1446632ybg; Tue, 2 Jun 2020 10:09:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPftmO9Fkv/v5zsRKaPKeqvBckrmbeAUUcN82Wh8+nHcVWNKZ7f0LO8Z5mzDR8RKBtxpJH X-Received: by 2002:a50:f9cc:: with SMTP id a12mr10721118edq.227.1591117786181; Tue, 02 Jun 2020 10:09:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591117786; cv=none; d=google.com; s=arc-20160816; b=hkHG9EEXyQlcbxu8VenKXp0dnwvKINsiUo/9eKOl8qp7CDug3L20c4J39zLvdFxS15 mkvWxtOB+kx0Po+xJgPcjNLZJ6BHf3iFjEf0PZ6eHhvdD3lr2QuozSBUwQm0zKyYkjHY 3virqO8O1bMqyBENX/wiHEDDy2ocBXULCMq6/459n/Zi8mIGzLfiqkELY89Mwur5IT8Q RH9n/3yZvKTCcHjuhFxAajKkVU8pPetNseflhd4gTeKnb1YaNfl/b5xuSUZC/lg/DR2D /0BGAtZ/7Buj94wruOjHEUJVXGBOb7To5/1CkJ3N+NbbODSRVl5+BJHwvw/tgmVZw+Ef a6wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=6MlwCnKGK5h6rbU/syP3JwPvktLJcYjd05EGrLFX3ms=; b=KYD8LaG8kbBtXxlqlz+vqbCeskc8eaLAS5+Etsyjmcs/kNs938P0zxDQo7N962Rs11 QmfHQP/09/sS2Fx4M3oS2fC5GL2RaNT8GbiWk/BFzGo/upk5mfMydbR2qWH1rLfjvTBJ KSwCJx0rWf0mwlP+XjOIwtilJj3dyQjO71ssWRoYkkVBQ9OofpKwkIOcy5myw1oixdbQ kpLJoIK/ylAvifVPrUi8N7xPJC6R3sTOdQMZgvcE5vPNHvSc1LDvTziD5QNUXmgEEoVj vL4G9YmUKHroU+uuCUla4cFQBnhwjqWv7CpIrPh46QG/UkJ3NgxJM2m8XCBMJ2uOdWy9 h5ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Fm+L7Y+D; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b16si1817015edw.278.2020.06.02.10.09.19; Tue, 02 Jun 2020 10:09:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Fm+L7Y+D; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726217AbgFBRHz (ORCPT + 99 others); Tue, 2 Jun 2020 13:07:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725969AbgFBRHy (ORCPT ); Tue, 2 Jun 2020 13:07:54 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78AB6C05BD1E for ; Tue, 2 Jun 2020 10:07:54 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id 202so6626871lfe.5 for ; Tue, 02 Jun 2020 10:07:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6MlwCnKGK5h6rbU/syP3JwPvktLJcYjd05EGrLFX3ms=; b=Fm+L7Y+D5mtg2IVBKJirjQJCZr5Jo9h0Buvg27iTw/kU6l53njPWbd7fkMuS0E307h IbWCEfb3dT2P1d2iomaY3m8mjYJ4h/E5bozxW5b1TRp4xdIti58c8Jyu61yVdUrIpDHl FXjX53cY67vYABYqWEPUY/fiJf24u7fB+mhBrG4G64+xkzxyPk2NLzohNXrlKk17deCl I0KH4fjLVaFuGLXj4Bvm75EzqNDd+HPIT56SrOpnq4d6DrE0XDL3uuMbogPww6dF2JTk C/Ei2Dt2Sf3GznxMZ71v62WikLVSj379nNb1SwYQmQVlG8JK2U0cyw3YiWKnsqSUdMPS nzzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6MlwCnKGK5h6rbU/syP3JwPvktLJcYjd05EGrLFX3ms=; b=gFaJUd3gIGHgQ6rCfppTXb5qq7edspNt6qBbjRrXpN5doixHiLPml5+fteL5E5OJMi 2OAGG1zWgZjREh2BVRfr9ZozkVooJ5PsWns9eYL9Q0Fo175BL02H+iKv5IR8Dbt7eXEN ZkJBQfQXpLDO9X/4FTj4hDilTeFJn92ofCxlrjQHWeSWvtPg7o5y3ip9VDtCsOdMfQ9Z HoLlB6XvbmLu7vf8ZlpscqjQ8F/RLfhIxd9bi/xDLge0IAOm4cZIsgPBk7KLf1QjA1vB fIEP/bwpOSAr6YtOdisBOMS3fkY9BavH4ZIwcfuksodlTuLsR4/grUq1pO707qUbQmtd 1WZw== X-Gm-Message-State: AOAM533nSZr0yQTpruC+B3vyF8/josz6uVM8IroS1sgB1URezyUU8gxI pJm1QA051XUEDPJ9lpKujvf0T+AWB3kYwfm0MLb+XNrZdRA= X-Received: by 2002:a19:4acf:: with SMTP id x198mr188796lfa.129.1591117672710; Tue, 02 Jun 2020 10:07:52 -0700 (PDT) MIME-Version: 1.0 References: <20200601213902.389278-1-luiz.dentz@gmail.com> In-Reply-To: From: Alain Michaud Date: Tue, 2 Jun 2020 13:07:40 -0400 Message-ID: Subject: Re: [PATCH BlueZ] a2dp: Fix crash on transport_cb To: Luiz Augusto von Dentz Cc: BlueZ Content-Type: text/plain; charset="UTF-8" Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Thanks Luiz! On Tue, Jun 2, 2020 at 1:01 PM Luiz Augusto von Dentz wrote: > > Hi, > > On Mon, Jun 1, 2020 at 2:52 PM Alain Michaud wrote: > > > > Hi Luiz, > > > > On Mon., Jun. 1, 2020, 5:39 p.m. Luiz Augusto von Dentz, wrote: > >> > >> From: Luiz Augusto von Dentz > >> > >> There have been reports of crashes on transport_cb where the setup > >> would most likely already have been freed but transport_cb would still > >> be called, so instead of assuming the setup pointer would be valid try > >> to lookup the list of active setups and log a warning when it happens. > > > > > > Reviewed-by: Alain Michaud > >> > >> --- > >> profiles/audio/a2dp.c | 8 ++++++++ > >> 1 file changed, 8 insertions(+) > >> > >> diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c > >> index 7f14c880a..d88d1fa69 100644 > >> --- a/profiles/audio/a2dp.c > >> +++ b/profiles/audio/a2dp.c > >> @@ -2217,6 +2217,14 @@ static void transport_cb(GIOChannel *io, GError *err, gpointer user_data) > >> { > >> struct a2dp_setup *setup = user_data; > >> uint16_t omtu, imtu; > >> + GSList *l; > >> + > >> + l = g_slist_find(setups, setup); > >> + if (!l) { > >> + warn("bt_io_accept: setup %p no longer valid", setup); > >> + g_io_channel_shutdown(io, TRUE, NULL); > >> + return; > >> + } > >> > >> if (err) { > >> error("%s", err->message); > >> -- > >> 2.25.3 > > Pushed. > > -- > Luiz Augusto von Dentz