Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp512605ybc; Tue, 12 Nov 2019 05:11:14 -0800 (PST) X-Google-Smtp-Source: APXvYqxIYldyNoik2rbWtH+tlZhctPCooy14Pk6R9HjckutPDprbL5iFg7zW1TQ+ysYrzTFULVWQ X-Received: by 2002:aa7:db52:: with SMTP id n18mr31611879edt.169.1573564274147; Tue, 12 Nov 2019 05:11:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573564274; cv=none; d=google.com; s=arc-20160816; b=Y0aO1hzBJzk6SXYn6uQSMHhG1C7s8Im7Q23gIJDAo9jSZCa5vpca6pNOwK6CFFprBj fT+3vA27JD/h4P1ZgYu8qE/OUggc6K2Bkyla7AVNv2HTNgqObAWsj9ntXBcohgTiUn98 vq8G23bdKRurwVKpWduABFObms84yPhm22Hjaeo9PP6VCdBYPDEIPuQHMy51BEdXUG5J uYnqde0XU2kofhVTtPnCHgIhW+EG3cpCdTprzVtqyw5qXcH6A4aLn2KjQ1QHOdqXBdHy CGU101+VnxNT2iCUY7CXfObpAT4kncHoSz3jRE7gjpgh2WthgYcEB7Fi+jc/ZXG/cA/N T9cA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:organization:references:to:subject:from; bh=vqO+cV/yZIwiRacxj2EJ5eQwrCTMHhAQYMUarq/46k8=; b=BQGM79lVo8pvJ2zIyj43ZoN++ykhuV7AFbkPB5/u9QdoadnUWWA1eoLqFFCmSfbg93 3YjNzZTBBtXpH1YpuPFYeUjKJPzbxqSFxoFpovmFfqsIyvue9tY1ZS6CrfwrkkuqQmWK pBbxWTfTh2i0hW77dvcWUlyJCiBAuAUIVycn1aFcGeHamAW3P+GPUQ7esowqaG3NKVvL /UIVIYWhs0AIOcQgETAY2gRwpJqukRKqvvwRJZCDKkBq2yGlGinvBuPtRKDQ74ZBNS2D iT5aGm0yV6ERyesE9QVaTagGDyj2yONNACA5iNEJf38V6q5+1FO7oMSjiV4kexH7ZDgU cLhQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z16si3282940eji.25.2019.11.12.05.10.48; Tue, 12 Nov 2019 05:11:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727047AbfKLNKo (ORCPT + 99 others); Tue, 12 Nov 2019 08:10:44 -0500 Received: from bsmtp2.bon.at ([213.33.87.16]:11296 "EHLO bsmtp2.bon.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725919AbfKLNKn (ORCPT ); Tue, 12 Nov 2019 08:10:43 -0500 Received: from [10.2.7.65] (81.89.61.168.host.vnet.sk [81.89.61.168]) by bsmtp2.bon.at (Postfix) with ESMTPSA id 47C7Qp1kJnz5tlK for ; Tue, 12 Nov 2019 14:10:42 +0100 (CET) From: Simon Mikuda Subject: [PATCH BlueZ 2/2] core/advertising: Fix crash when client is added after unregistration To: linux-bluetooth@vger.kernel.org References: <157250771818414> <1572862862-8536-1-git-send-email-simon.mikuda@streamunlimited.com> Organization: StreamUnlimited Message-ID: Date: Tue, 12 Nov 2019 14:10:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <1572862862-8536-1-git-send-email-simon.mikuda@streamunlimited.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org After "register_advertisement()" callback "client_proxy_added()" was yet called but it was actually called after: "unregister_advertisement()" which caused segmentation fault because client was removed twice. Signed-off-by: Simon Mikuda --- src/advertising.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/advertising.c b/src/advertising.c index f53c14c..45ff19f 100644 --- a/src/advertising.c +++ b/src/advertising.c @@ -190,6 +190,8 @@ static void client_remove(void *data) struct btd_adv_client *client = data; struct mgmt_cp_remove_advertising cp; + g_dbus_client_set_proxy_handlers(client->client, NULL, NULL, NULL, + client); g_dbus_client_set_disconnect_watch(client->client, NULL, NULL); cp.instance = client->instance; -- 2.7.4