Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp1207121ybm; Sat, 30 May 2020 01:53:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzO1yWSyx7Vc0KKuKnMWDXKczTm/rVIO9/Kgj1BIaaykFMyW6/UKr72Dz91UPzssAeJ3vgJ X-Received: by 2002:a17:906:f155:: with SMTP id gw21mr10967660ejb.388.1590828818423; Sat, 30 May 2020 01:53:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590828818; cv=none; d=google.com; s=arc-20160816; b=uwyalcVGBVS41TCkvIAN2HJvxiWMYlv8PlDTTXFAz3SWXmER4FtS21vCrkuv/NeyoH JlmjPVUAi6YFGggeSdP/weQIF1/a3+w+oo79vlFAdk97SX1oQ69O6UE0C/lp2/HtNmyy D7/SDPLbS8cwMLcgAVVzMLAnOX+DaIg9wxZzYkX345mP1v+HbGFIiIv9kjVJrCACA0UP +OdTOQbRP/JIAVcJ5qCDA54v/miwvf1DHcIFPvNFb6qEnrJnOyubE7v6T63Djs3XUa4a DEYZi5Hjh824784Jy1dqd+xK5M1fNl/huCOl4RfJniXtRYuwuz+lX/KzkoJyTvtmli3U wruw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=2JYXx1mPmf36Y1KcnMuU9nUJEbc+gfpMtGGz0p9DGE0=; b=tl7IpLKBMXJs3IyV8tKgBSrnzqfR3T4rA3HUSW4eqsITiAnJVJOlxEZli5ggWT51PQ yaF1m8AISfiIqfqLDXsyPQLhznz/rFuXoPupHksLKKp/K3CWqwCCI8HLD82DFgzC5BS8 X/PPcX1aQXBLw9FyAHuKQiqF41J5g4vo4IEibNqT4LrRD0i3GcIzG/26RnoXvH4mMTg7 fMP41ZottvH+u1PoBhpRW4SxqJYtqHP7uU2PsmzhtqGoEnvB040Z8y+crMxm3kaBA8fu COCRjMd0dN9cTVLtPCwsLeDJoQfHvZGg0bVIxyGZyZlbKehw6iUoPWo5hllgc4qfQ2s/ yjsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="G/GWKKak"; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dx2si2399405ejb.170.2020.05.30.01.52.53; Sat, 30 May 2020 01:53:38 -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=@chromium.org header.s=google header.b="G/GWKKak"; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726975AbgE3Ivt (ORCPT + 99 others); Sat, 30 May 2020 04:51:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725554AbgE3Ivs (ORCPT ); Sat, 30 May 2020 04:51:48 -0400 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D5C5C03E969 for ; Sat, 30 May 2020 01:51:48 -0700 (PDT) Received: by mail-il1-x129.google.com with SMTP id v11so4857089ilh.1 for ; Sat, 30 May 2020 01:51:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=2JYXx1mPmf36Y1KcnMuU9nUJEbc+gfpMtGGz0p9DGE0=; b=G/GWKKakm7gffN+DL5lOymQvJmv9+ZqY7oeHkHLJsbP3XRwktvBTRZSA1wXCWi6fEq z/rx/B4PLvO+r3bfVE1PMbLM0AyBOXcf+CZaNIBmAX1x+jIWib6X61rzsI/b+UklyEfr owhUfK8HnzgUFEdiCXP14FU2epJcW5Mmw+3HM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=2JYXx1mPmf36Y1KcnMuU9nUJEbc+gfpMtGGz0p9DGE0=; b=pUGuDjPa6Y58vZUufjFMbYh8uykmXDzdtB9Nc+U8dlyi2Mpw61wOzrKYLdvQSr/BaY roMmvClHLlJDLUDMf+zLBE7Svvznb33v/uF05usduUtqmH03FmqvO2/oue9GJx9eO9s4 RhDwnKcROXpppMmLvwd/tD/Q8BVmFZ6JJYqux47RXNeDa5vJegV0LpDpDds3VhhHh3yc /gnAptssnP/pvfvPc0+0Z4sDRoMPbmqRYrbHOh2w/5b3vn2R1+IzOBKLKEzzK8KhPtJo AQjaNtEWDK1j95OPxrjHR0PGNWYkjEMvAT3y9Cfz88s1sQaCxuim8SGeM1W9UBZwqYsU H82g== X-Gm-Message-State: AOAM5306FDy8BLZi3Be+7dHioM3d5lcWoFViZWA4Xt+yyJLeac4yBgwn /4zUT0kpRQCZCLsPHXLpSgZkMnUotffiyg== X-Received: by 2002:a92:894e:: with SMTP id n75mr11514496ild.271.1590828706868; Sat, 30 May 2020 01:51:46 -0700 (PDT) Received: from localhost.localdomain (c-73-231-41-185.hsd1.ca.comcast.net. [73.231.41.185]) by smtp.googlemail.com with ESMTPSA id z3sm4920321ior.45.2020.05.30.01.51.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 May 2020 01:51:46 -0700 (PDT) From: Sonny Sasaka To: linux-bluetooth@vger.kernel.org Cc: Sonny Sasaka Subject: [PATCH] a2dp: Fix ref counting bug of setup_unref Date: Sat, 30 May 2020 01:51:18 -0700 Message-Id: <20200530085118.10703-1-sonnysasaka@chromium.org> X-Mailer: git-send-email 2.17.1 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org 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