Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1441826ybg; Tue, 2 Jun 2020 10:02:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJvbZXxbAQ2vlO0nWDWtCEgxzudC0mNgAQ43aFtUXkoX8t8pGKUWonP6ZjYPZ0zm/gsVzL X-Received: by 2002:a17:906:f891:: with SMTP id lg17mr23760076ejb.405.1591117349882; Tue, 02 Jun 2020 10:02:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591117349; cv=none; d=google.com; s=arc-20160816; b=iHdu+hlqIiEIHit4AP0gocaCoijO3ho0ChttxzFbhm11YE0QdzBBWTug/ghu6mvGp5 1Y4jcMqs1SZJ3Zq/SKTAtZoPedWsrqswse5qFg+hVY6NFz2MCU/NlmQTQBvw/TKB881T C8pU1ujqyRkoZIzfwK7oS8jROsBz74MYN08LHBYo+x6PV48zytEXXDMuB1nX/AlIvACa oU7gLzrmzWb9gkff2N5zyXe/ZWnRcArnCcFa+2CeSzBGgFK4aPXy5kJWmGbDTi3534EI Wh3YWhVJItVktHTQXMp86YGZNzxhcdyhmi1rhIzuHeYsQwVwb2xnqP3iNfgZoEmz2qGE 79eQ== 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=DcP7sI1Ubg4IGjyYRXdbvTFKUH/Dpavej4eYK53EaTI=; b=tJDonLAAnqX9vEJ26haekCwyEDJt6dsFPUNm1Y+NeCYI1lc+jRzfiD7wCF33oty5ew K1+RxTQnsKilwiXp0wIuziYbW4kjNlGiQyzkEmewAp7CKqB0EQRxM0IKZXV62DE/nXWr Qksnyc7P0lUSW7eVi1/CZFEHielQGH6xZ1vXcUpCYVV4oBTGsKdCWc6HgHOTNTkhzIii TSTR/LkpF+rbpfUBqYPZqbY9YOLlqChfGMt7S83/tw4A+PaC0iRAF9kiw/VHjkzQGCjZ z7K37zlRnHUrfxgTRYOVjWHl5JdLgvEYO7bPl3MNwWJup/3126S0CSrLowpe+ZEw8y/1 djMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kPKHkXiu; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pw15si1775205ejb.583.2020.06.02.10.01.15; Tue, 02 Jun 2020 10:02:29 -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=@gmail.com header.s=20161025 header.b=kPKHkXiu; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726037AbgFBRBO (ORCPT + 99 others); Tue, 2 Jun 2020 13:01:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725969AbgFBRBN (ORCPT ); Tue, 2 Jun 2020 13:01:13 -0400 Received: from mail-ot1-x341.google.com (mail-ot1-x341.google.com [IPv6:2607:f8b0:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96601C05BD1E for ; Tue, 2 Jun 2020 10:01:13 -0700 (PDT) Received: by mail-ot1-x341.google.com with SMTP id o13so11460741otl.5 for ; Tue, 02 Jun 2020 10:01:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DcP7sI1Ubg4IGjyYRXdbvTFKUH/Dpavej4eYK53EaTI=; b=kPKHkXiu1valSAEXp64dVP0XUL+rtpH3nihFMr0UE3WNJPXg+yRbkQGtTsdAxHIMpb GMNk1kWFas0iJaYNxV7/jDSXQeQC/YvmYspkTEpFo4pXa3AsncHnx5fVyLlAtRUUzRO7 su+Du94PIde/8gJNwfKqqrBcLflDvagsqvelHwQDKTUHD6l9AWLt9bM9FZdBQ08sJD0O QFFUJC+jj2tzoFNid8IwrmpxoMWlPwvob9eUDgh81w3VpkSjIqxxm6B+EjTYYO6zfUkH gOfknoquliSlN6NIMN6AzUBpa0Ypynip4PMnvvoG3LeXdaOiGNxnW2RHj5kt7eyupX8m QzDA== 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=DcP7sI1Ubg4IGjyYRXdbvTFKUH/Dpavej4eYK53EaTI=; b=BeRRaLb6FKpF9fMM4QEyRid6mA7ZZeKOBEQP/Azy6pd5LKJMrUX+BZaDIPV3wNxfIl sY/j2nRRGOhT4WzrqBD8fg1nq91+X/KatyYQT7UeCQWpj2lQRD8vUYaiu5wramO+tywk Flc3FITZxGGDl96+CCRgz+E3mh+bH7p1BP3QUMBkO13per587z1N7k3usFpLcdbfj0ts pcOAnnOYuNxt3lFVQdf/5fduQQVdHyiyQADU9E3iMmkbuKaTDP4giFgxfsl3jAPZrhhc 6wDjHnDqzDFNJdXcq+GymTDSHM3umgYxwKf2hCPnf3A2GTguz1UFgrC1pDZP5p2sOm5S 6ZEA== X-Gm-Message-State: AOAM5329T2UhZWxPu3f5ceSAvZpVcVklKqixaTzjhmKz3muAB3dykI51 247lPqaF5MYGU/YWxvbyTlbKyvVzh+j9RZ8LJ20Oaw== X-Received: by 2002:a9d:2049:: with SMTP id n67mr155613ota.177.1591117272729; Tue, 02 Jun 2020 10:01:12 -0700 (PDT) MIME-Version: 1.0 References: <20200601213902.389278-1-luiz.dentz@gmail.com> In-Reply-To: From: Luiz Augusto von Dentz Date: Tue, 2 Jun 2020 10:01:01 -0700 Message-ID: Subject: Re: [PATCH BlueZ] a2dp: Fix crash on transport_cb To: Alain Michaud 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 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