Received: by 2002:ab2:7041:0:b0:1f4:bcc8:f211 with SMTP id x1csp2074lql; Fri, 12 Apr 2024 01:24:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVK5mCgPVKDQTITsNCYqpV5511vB982vUWoLihf2t2rEhLpOghOw78mqK7dA93ijEhFZSBxrDSdU5erG2YWSei4KezJjtlsCyLGV7CyGg== X-Google-Smtp-Source: AGHT+IESaFpOLQ73o5zNYxV83EY+x4ssX6V51AdK7Dnf/MZWOGDrZBLl2lfhEQUA+XO7oZVWKPMi X-Received: by 2002:a17:902:f541:b0:1e3:e1d5:c680 with SMTP id h1-20020a170902f54100b001e3e1d5c680mr1713511plf.63.1712910258458; Fri, 12 Apr 2024 01:24:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712910258; cv=pass; d=google.com; s=arc-20160816; b=KEg/6e+V7YChG5A92FQJopbs8e2/F1eN24a+Vizp5jhAZWmESWGECg/zVtg8GFIgvX 5AgqYCXzdQ3V14jkHpyYufOWoeTzp2FL2BxJqjbkBWq9GQjCVoKyipFaA8qR7NKcWfFR ZikwuS38UN2xCO7uO1CKIbsPqZSRzB34JRTD5wperO/9Peb09XYaJIiJ9rdLYfPAX8f3 2bBClYi2YTljHpKqJFq2tNDGBmLiKMhkvOo+OHbIljTS2f+x0h2mzsg/6lwiCZ5B9xyN TkFSje0dYlquPuC6uyuSDl8trSei/aLOWlBppzKvfX4dqDfcILhFuh7i6SNMwxZaoZrr inLw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=DuNdQAtLkWYGN0fPqcE7t0xY1JsPEeGxT6N0aOA+6o8=; fh=cDb+OBRfnjRhAYAfA7aQFYWAFNWpmB7foPz5Xhgj4Gc=; b=pKCf7uG9h/yNvsd4TvDcV7M5lUodnLKVlgX40TJDB8pgJOIgUwze5YGbgYpIH0Vn6i OeqXB317A1aNE7Gduuz7khwyMc3bT8UMyuAnRJ7vtwzj+sUNZ4vpQkn3Ntib4reIXNal 0ZqdNoTNe/r+Sf5W7pFt66Kwfr9iRLYh7nCUbKqPEdsNl1reCOJKG/yUGtTmQ9pAIgcn jCb416IoWi6rwqaqZ/dvHGmShOQ6P3iMCGF/RWt5W83dkdIysT+6jKnR6kmcrSaaTu4X /z5+ITa93SSsbhsnJEHoWfyePn6Mh0cTpaXhIhZpXm+vNnfbAJ6hHgbGeNrBYnnPB8MW YaPg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WM1AX8NB; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-3515-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-3515-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l3-20020a170902e2c300b001e47ffe06b3si1424949plc.489.2024.04.12.01.24.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 01:24:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-3515-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WM1AX8NB; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-3515-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-3515-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B6958281499 for ; Fri, 12 Apr 2024 08:24:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B35E350246; Fri, 12 Apr 2024 08:24:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WM1AX8NB" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A16491B81F for ; Fri, 12 Apr 2024 08:24:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712910253; cv=none; b=QrViJvNF5h8u3nAQ36QRhFnYsbj6qNEoG5D79FNP0H8I/wxGdhVBzhQvRjZmdPqXw+n2+rDTIOO6J0kcBsIQXPipfnevuRtJGoSG2Ev4FaF8CXqE6fL98rgvy7IJoIGoRKmmGFx+hW4tHu6c212+3jmUeRnGtWbQR2DDCasUuVM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712910253; c=relaxed/simple; bh=+s6cMQQxp001mjfbrb31iAlVPsr9RuAORJw8X9ToNMg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ssHdWt5km3Lz46wi/LLH220zdTUeOSnOLqqHytzmEA3paKVjg157bOyWDnB9UxtOB/fOmQQ1gqvCWGUnPdCAXPAs3vtCTdlxhlX6C5xIl7+IQguqCYd3Nv/SKPTAK5kfhWOrdpU3GsppQYBUH3MjvS2tbJQNcOifbcFDwysUf9I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WM1AX8NB; arc=none smtp.client-ip=209.85.208.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-56e477db7fbso877178a12.3 for ; Fri, 12 Apr 2024 01:24:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712910250; x=1713515050; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DuNdQAtLkWYGN0fPqcE7t0xY1JsPEeGxT6N0aOA+6o8=; b=WM1AX8NBFBcnj9IJ1WwQwglrBrSnzkF3jQe4C6ZgmZR1uCQOpWXLJ00e8JxrVfLVGJ Tua34t+zlxsMZ3yXXXjSTQ4Wt4g4I0ca2SwIyXUbjYONgdFslNqxz/It4MYKnDatEBY/ kAJzFRJAudlSu9i2Ta9AYa07TaAfjIMNzY+BT+YqDUsZVIg438tB/kdTHqeYToBf2Tzj 6hCbMq4KrEh2TForga3bnt5JFyeAti1WcCdyATBsxbZtnI02am+4E9DV77nr2/bfui+H I+71uxa6LnuJ7DQmHctvmgyklilnZBeNxfLKC7unKR4JbIp9299gm3zmhXpSXeeX9ySP KZ9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712910250; x=1713515050; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DuNdQAtLkWYGN0fPqcE7t0xY1JsPEeGxT6N0aOA+6o8=; b=QyHluVbfTW6ba7vQ5l+5Bc/QDoFLbf3eNiYT8AyYN0tEt+QFDUvX+x3wDZBQF/dRtX tnBE8VUNok6cuZujceQmjed4ncxQCTn1ePev2+fC7vkI+/qFmuCFLdXZGygCR3gOewoJ tc/vsmiN8Fa92LePVfxjepbRg3qwR0SbFv0E3fPS3Hsvrmk3DLMPSNpoay3LYq0CalxV cjW8UX4P5nmoJrGhpBnOBTVXF135wHOakwz5hvOcHpGYY1SKAhOUiBSiY1USLKVlrZhI mblXE3iZP3xEgT/w0vIvhquScvYdpMLZ5O0DmrG0E6RTOHwhjFkgi+gfLyPGtY89SXjq Y9hg== X-Gm-Message-State: AOJu0Ywf0wKqge9g73BeaKqZoyjkGo9Nt/ngNt/sfCN8/chSf0M7b/0O PdubMFsv0mE7NZ8Ko8O+mbKuMBRPtC+eykGjoP7vYLwQNiUjCUfJCFAaoQ== X-Received: by 2002:a50:d54f:0:b0:56d:fbea:40ae with SMTP id f15-20020a50d54f000000b0056dfbea40aemr1361387edj.23.1712910249398; Fri, 12 Apr 2024 01:24:09 -0700 (PDT) Received: from raspberrypi.home (46.205.194.2.nat.ftth.dynamic.t-mobile.pl. [46.205.194.2]) by smtp.gmail.com with ESMTPSA id t13-20020a056402240d00b00568afb0e731sm1440807eda.63.2024.04.12.01.24.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 01:24:08 -0700 (PDT) From: Arkadiusz Bokowy To: linux-bluetooth@vger.kernel.org Cc: Arkadiusz Bokowy Subject: [PATCH BlueZ v2] advertising: Do not crash in case of adv update failure Date: Fri, 12 Apr 2024 10:23:51 +0200 Message-Id: <20240412082351.930802-1-arkadiusz.bokowy@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240403171236.853491-1-arkadiusz.bokowy@gmail.com> References: <20240403171236.853491-1-arkadiusz.bokowy@gmail.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The refresh_extended_adv() is used in case of direct advertising request from the client or in case of advertising properties update or configured advertising timeout. In the two latter cases it is not possible to prepare reply D-Bus message, because there is no request message to begin with. bluetoothd: ../src/advertising.c:add_client_complete() Failed to add advertisement: Busy (0x0a) dbus: arguments to dbus_message_get_no_reply() were incorrect, assertion "message != NULL" failed in file ../../../dbus/dbus-message.c line 3235. This is normally a bug in some application using the D-Bus library. --- src/advertising.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/advertising.c b/src/advertising.c index 7f55a20e3..ad28f6f77 100644 --- a/src/advertising.c +++ b/src/advertising.c @@ -1259,9 +1259,18 @@ static void add_client_complete(struct btd_adv_client *client, uint8_t status) { DBusMessage *reply; - if (status) { + if (status) error("Failed to add advertisement: %s (0x%02x)", mgmt_errstr(status), status); + + /* If the advertising request was not started by a direct call from + * the client, but rather by a refresh due to properties update or + * our internal timer, there is nothing to reply to. + */ + if (client->reg == NULL) + return; + + if (status) { reply = btd_error_failed(client->reg, "Failed to register advertisement"); queue_remove(client->manager->clients, client); -- 2.39.2