Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp606604ybg; Mon, 1 Jun 2020 09:32:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7Cf1MFZHLjQtoagCMzpYL/30SnvcJr+wyfTvJHfUnmGmevIg4LA5OnoZNU7uWKICeGI1J X-Received: by 2002:a17:907:20f4:: with SMTP id rh20mr5974695ejb.55.1591029170198; Mon, 01 Jun 2020 09:32:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591029170; cv=none; d=google.com; s=arc-20160816; b=01Rr8jEkHj1TOa/BhKpBQnOyHxBwBaGJ3Fs6iLRtVhd5vdMHXhX5eRmSLgYbpzX9pk 3pDdHaj0jT76jR8N6hb0moDfUQTVi3RcMwxMitvUzXB/bgS8pAT956So3DbrSnfhADyf FzNFp89GQ4UU9XLsebTl5VGpN15XXRbyhlwRrk4fKG2pVVKa9+NjaFvOtKRLiNhB8QKn bh9tXdw0Q897gfgGM4LHlPKub6JIM7mtfVVWIHHi1yEcMgJz8P+psw+e8RUZoXqQhD5Z vktTobN7Vvcg5F0c4GaegRcxZIvt+TBMSHkHeERSN8hJl14pI+gRpblhOfofOkinpvps /now== 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=KKs2RNIXjZ4g918KQZTpNZSOkCD2Zpqkt1cEiqVrdQw=; b=bXEgHR/LwAIq0tjIWkDlFv0n3pGyKpJIkmwaCbagoyGGayaPN46pxxroy4mlMsqnKb C0xcRD0DGqf+hFRvRDELJFXZPpN6FD+EACAo/dM1NsIYRRndsYyU3P2355O1Vxku50rh jZyaqXySqKaDDe4+Un9Hvf5BzIdBOOdCqARlDUqiv2KdZyCWGS51qd59EMKKP/aSM/Lj t8jNqfPZmcWgP4Vhk+6XdlojfhIgaIm3KXxO9/7ChnkHIrqqt1w0DIodLN9wJ2DggNWP lJM2eQY6IQn0gv1NPJndTdldw+itRK77WEDNzFZ6HwUVwwPGq7ct2ordXBQRTdkhJd46 cPBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cR8Jtg3l; 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 bc15si2064732edb.281.2020.06.01.09.32.24; Mon, 01 Jun 2020 09:32:50 -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=cR8Jtg3l; 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 S1726124AbgFAQaC (ORCPT + 99 others); Mon, 1 Jun 2020 12:30:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726067AbgFAQaC (ORCPT ); Mon, 1 Jun 2020 12:30:02 -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 57CFEC05BD43 for ; Mon, 1 Jun 2020 09:30:02 -0700 (PDT) Received: by mail-ot1-x341.google.com with SMTP id k15so5026314otp.8 for ; Mon, 01 Jun 2020 09:30:02 -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=KKs2RNIXjZ4g918KQZTpNZSOkCD2Zpqkt1cEiqVrdQw=; b=cR8Jtg3lj+2RLc51xs6H/OXSSM3C6VzAVxiequ47Q1IbeFz7wuUDeV9xxnyIlgY1YO dWjD2SsSaPWMQLnmpn3XsEHPdMkWOeKMA3Mn8J5l+iPQMsL8lkrs/QdrVL6gaRxLGVMA KqigPYYGLlKej7Eflou27/qw3KwZjlwaJ83l1vfvyWfWCHdy8am9o7/Kpi++3jMro6qB 2FJ3Z4A/jtE/w3v/OZw+CsxX4vNFawtk7Au9Av97T+bE0R/0B2BdcdihLcL4o+usCu1d G1btLGpw1zOVRBoYDUbHWekhYjE7RSLM7lf5F3k5UBUGv5QIkl2iGafxsv9WwT0xl/ms qqqQ== 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=KKs2RNIXjZ4g918KQZTpNZSOkCD2Zpqkt1cEiqVrdQw=; b=eH5WH7PC50iZ+6waKX9Kkkot70m2CboJ1Gqd7iNeNN4ImhpjmSL31AgGeAvMYZyoLU l7nYR660DXlHhaEZ0a5GDNY2yEsd6GEBC0HpQWYjKPEAjmFSYu3c1ol9AydHDbDGzFWe cSupv0xYuiQ931TH6dPmMjv5/+vrdWJn/fIiUDIZB5Qi4yfXp5jcyXLWdeTWuaT9A/W2 3Vr049iCjxsMifFnOkB/wJnQtrzgD+/EBB7ioey33uBM4s0E00UMdp1ixM5vUjqBc4tL wEJqrBXE3yiVWzEdATtwV4fBZkfNtW1ZUEynzMNO2E0MDca5spPwEkXBLW4pnMqrhQH2 WCpg== X-Gm-Message-State: AOAM530MvA9bymA8qh4YVHYPVkqVlwtpUY3oUaLUD0BU8vxWi2lPHM8y IG4u7mZqY2XVFsXsSjR1L6Rf7t5iOV2cLRHcv48= X-Received: by 2002:a05:6830:14c4:: with SMTP id t4mr18007514otq.79.1591029001710; Mon, 01 Jun 2020 09:30:01 -0700 (PDT) MIME-Version: 1.0 References: <20200530085118.10703-1-sonnysasaka@chromium.org> In-Reply-To: <20200530085118.10703-1-sonnysasaka@chromium.org> From: Luiz Augusto von Dentz Date: Mon, 1 Jun 2020 09:29:50 -0700 Message-ID: Subject: Re: [PATCH] a2dp: Fix ref counting bug of setup_unref To: Sonny Sasaka Cc: "linux-bluetooth@vger.kernel.org" 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 Sonny, On Sat, May 30, 2020 at 1:56 AM Sonny Sasaka wrote: > > In a2dp_reconfig, setup is ref-counted by cb_data. However, in the fail > label setup is unref-ed but cb_data is not cleared. This may cause > double unref in the future if cb_data gets executed. Instead, we should > do setup_cb_free to clear cb_data and unref setup. > --- > profiles/audio/a2dp.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c > index 0d877b132..1b92352cf 100644 > --- a/profiles/audio/a2dp.c > +++ b/profiles/audio/a2dp.c > @@ -1719,7 +1719,7 @@ static int a2dp_reconfig(struct a2dp_channel *chan, const char *sender, > return 0; > > fail: > - setup_unref(setup); > + setup_cb_free(cb_data); > return err; > } > > -- > 2.17.1 Applied, thanks. -- Luiz Augusto von Dentz