Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp23541pxa; Thu, 20 Aug 2020 23:26:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLd/UwmhGVLy4c2mh+sQxvylNRcPoGaKATmOttEFqMeuOj+T7kOywkO6Zp5KZ+IcRV5MaQ X-Received: by 2002:a17:906:85da:: with SMTP id i26mr1510949ejy.458.1597991161629; Thu, 20 Aug 2020 23:26:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597991161; cv=none; d=google.com; s=arc-20160816; b=CjYZJ0rKeWjnRMGMkWIOnGROO/j6oekjPUmNStjpSWtqRE+nrsPorb5JLegtR/UeN6 IE/oVCsIgWeDF6KvFxiuxGPnlytPgyqUBjhlcA/f5MiRP4qofbZ3f+9jNHseWpEGUGra OHHLQjO4Tc35DNHQTcpNNstuFKfKny7PdlMKukYSPz3QDPeoLQ2+DRbuyGVdPw5AkWMz m5sRX0zcKQQ7YPWrWtwMtsi4gXS3q3R/yG04MqDWDzR/0PUYxLlXporOJFbE7rvvAU55 Je/382VkBBDHnvdhhYmyppz1KMM/2Q3P+yBOgoFJOAHB4l0JNJgdQxcGbr6UeSjfQKTj HVnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=bA5MyBizmygKQda+oeo0TYdwB/AeAf0aaD0m7ntaAyk=; b=Yz5z4qThjGaT126E5Szyo2eURdyG28dc6eox1b7gSwl6Fe0vyvgs5A9z3QCW0z0dyO qUr0vm2KO9JKUyS58j9xZVSjKffHfYENjZ8vJmHnAK5LhhkA5U4wZV1u6xRqyBnIbun0 2SoGi3WVImt6uhSrNM+z0R4umlKlg1qlQBND8iNd1YI9APb+IvGnZr+0OS2eZj5wk2Sn tBgtMZ+Ys+x/XjL+/XgWBj6UVvuCVK7mqyaDyUO9kvZKPWiBem99JM4D0cb/s/POlyNe 3Fs4nS7dAeMvV91W8cifHY1TBdzRIPOHdbXmzfwV5iHmXADoLNalj/5yNcJ0Yyvf6sC4 8exQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=S9PH1WtE; 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 p16si553570ejx.540.2020.08.20.23.25.35; Thu, 20 Aug 2020 23:26:01 -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=S9PH1WtE; 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 S1725976AbgHUGZb (ORCPT + 99 others); Fri, 21 Aug 2020 02:25:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725268AbgHUGZa (ORCPT ); Fri, 21 Aug 2020 02:25:30 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B68ADC061385 for ; Thu, 20 Aug 2020 23:25:30 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id mt12so383068pjb.4 for ; Thu, 20 Aug 2020 23:25:30 -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:mime-version :content-transfer-encoding; bh=bA5MyBizmygKQda+oeo0TYdwB/AeAf0aaD0m7ntaAyk=; b=S9PH1WtEk0y3bdfhwaFG9/XSVmRM+19aPN4lZL6FRZdu8VbFq5a8QIZqBkGDFMsnEQ NFMKJwaNq9scn0TxUm4kXtDUCQPugARpoTZSk3AhTRoupyvzz6rUvIw2xCIc6dgSSbdB L+HULMdm1ovdFHT22J5nLoojPyFHcfTJWSn2Q= 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:mime-version :content-transfer-encoding; bh=bA5MyBizmygKQda+oeo0TYdwB/AeAf0aaD0m7ntaAyk=; b=aHqDqmYxcjunYMcnNkfwi/tWZ91PWBT17SQeEWi0+rX7H4xT/l9DFyuvzy6ZZcfl5I vNcoqUIm/pucgugcNuV9eANCA+ZQSRsz7ArBKoWiIYvyNM5j8bky7jNOhn3ZBcS1SSAX Hfu5+VfkIJBVGx4A4LAsUPJXMGLiEGqmQwn43qPjxwVu37QCTAxvG9wOQE/OMKaDLUaL N2iRj2aute/w5H95yAqqoddjywzdmlxXg51xVAUx3m+S1U9pTzc81lQNdcAiSb4kMQUV livQB6S3QOoO37qnQErfRGw0Rp/mMwHLhPN6OxJYE+mIXOSkoeT/reqHTjOS8DWM4Ouh Es0g== X-Gm-Message-State: AOAM532Afz8CenBBaOVzAflTSSI9WSaSJDiIei4zdkv/j45epZuX6vrt hf5U8zvTwciuXPHXlybfbraflGRBLtUpeQ== X-Received: by 2002:a17:902:c111:: with SMTP id 17mr1341653pli.46.1597991129811; Thu, 20 Aug 2020 23:25:29 -0700 (PDT) Received: from sonnysasaka-chrome.mtv.corp.google.com ([2620:15c:202:201:4a0f:cfff:fe66:e60c]) by smtp.gmail.com with ESMTPSA id c207sm1078895pfc.64.2020.08.20.23.25.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2020 23:25:29 -0700 (PDT) From: Sonny Sasaka To: linux-bluetooth@vger.kernel.org Cc: Joseph Hwang Subject: [PATCH BlueZ] device: unset disconnecting flag when connection is removed Date: Thu, 20 Aug 2020 23:25:26 -0700 Message-Id: <20200821062526.16689-1-sonnysasaka@chromium.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Joseph Hwang A disconnecting flag has been used to avoid race condition between the service browsing thread and the disconnecting thread. We need to unset the flag when connection is removed. --- src/device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/device.c b/src/device.c index 7b7808405..5ab591dd4 100644 --- a/src/device.c +++ b/src/device.c @@ -3041,6 +3041,9 @@ void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type) "Paired"); } + if (device) + set_client_diconnecting(device->client, false); + if (device->bredr_state.connected || device->le_state.connected) return; -- 2.26.2