Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp198329lqb; Tue, 16 Apr 2024 12:54:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUoz7uKSRIXl19zKbBkO7j1qycPmV3iHjvPCgMAVik/WbYv3fE96L31ESgLSxGm/eoaLtuUuRQ1fLgZHzqDre2Yr3s0JzVkGawbVlzxJA== X-Google-Smtp-Source: AGHT+IEKH5o+2u9mhC5Ta9FWcbafYH3EtlLZb9VurNkQOEpPyb067A6JGfbQf/GS2RdKJyRtGORr X-Received: by 2002:a05:6870:e09:b0:22e:d13b:c13d with SMTP id mp9-20020a0568700e0900b0022ed13bc13dmr17233709oab.18.1713297257565; Tue, 16 Apr 2024 12:54:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713297257; cv=pass; d=google.com; s=arc-20160816; b=eVaMcro1/KvoYAy3/oR1bKuoK2VjfYFNxgrGYV4ZqkxePGuJByVBKAp8mEHjySdkAb lP6kAj8RUA04lmzILoJeBM4V96PQf0euvWr0hJE1ePE+TsiZEZG+2em21KaKnlyEOnmu MWMzZ8IT/bbqyXB3DXjdFU9xmjBIIzg9145GjT77nQ0wKO6ONzpVMv2kjVUpkn5bgWwR RlAClkcib1QOJbcb4C1OqZz7KpVZcGOF1vMklQ3UwV54GBr1DyBrK8+9xuSXgrVq4GkK NshLz5X7Tb2svxXIfwfrR2tR8TmjqEO7V9ZPz043ei+QWm9aLCF1of4ec1lh6vnZ3Qsz HnmQ== 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:message-id:date:subject:to:from :dkim-signature; bh=qIzFuZzNE61yUFVFZJeazlvytbdmPIliVOvYXRTlOfM=; fh=4lGQI6056MBa4/oovMyIYaKLn+Wz/24RGvUivMmQP8E=; b=TK2ES6gKoercWZAuTaWWDUcAHVRdXT+qB59CtC1SZG+8FRF13FApWqUdzwzNmt6jds WI7PZhKVzoMt/sDbdWrJZURJgQ8vpdqojta05fxfCbiuTDz8BdoX548cW1R2EKiAytsi YO0w0dX/fUcNLhDdKKigaignHw+EMAgDGoU8uRAFF4n3uJrJlUnuc9OjsPzMR9ZD6cjr OLKsJflzS10HvJ1GJC4FxF/cpQyFP0Q0AcaK2sZCKtvQ/TusqQdfOH+tbVvGMMhNBNAE Sii1cQ41lboAh+/O1zFQ5oCYRBhefI3MCR5Fjt/K3Rqi0Km0/UgNMdpL2y7TcvHPMPvq kLiw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=JYBIlBAP; 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-3642-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-3642-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 i16-20020a635850000000b005f3a86a60fbsi9883425pgm.877.2024.04.16.12.54.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 12:54:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-3642-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=JYBIlBAP; 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-3642-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-3642-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 3D5BC283E9E for ; Tue, 16 Apr 2024 19:54:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C0C001386D9; Tue, 16 Apr 2024 19:54:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JYBIlBAP" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail-vs1-f51.google.com (mail-vs1-f51.google.com [209.85.217.51]) (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 D44181386AC for ; Tue, 16 Apr 2024 19:54:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713297252; cv=none; b=qs9In4Dwkmsa4YJN5jzOY7q/+HWC4/4R3JfIPkCq2rz7tpgFcopIZ8vqqf9LTh+1a8k3h+RDdt9zsIzC5u0l/HtNr9KhP7QSzgI2hzE9l9qAc+0cTjZ6nQbGFaY+KmbPsdnSdCfcVe1t9B9Wn5w0D2O7T8Zg3ulo58FAuxuvSq4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713297252; c=relaxed/simple; bh=mcGMf9dnW1ZVnyy0HmEUCuqnX2LRmJqd3trb1lOwR7c=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=F4UJAA68EOFOrOiO7Yyh6MAzdqxJlIQT54gUtVc1/U33NObQ1pt/kRuDNIOzCYdt6g1hbK8LmHtRZ+UA9fliOGeoa5pL5Eos8ewvcqgGN5mZpESdCBu/67vIedp0KaEplSCA7/r7MeeJcfn+OZAsgbl3WON5AtyMjY6ZRzFXmJ8= 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=JYBIlBAP; arc=none smtp.client-ip=209.85.217.51 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-vs1-f51.google.com with SMTP id ada2fe7eead31-479ffac091dso1648474137.2 for ; Tue, 16 Apr 2024 12:54:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713297249; x=1713902049; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=qIzFuZzNE61yUFVFZJeazlvytbdmPIliVOvYXRTlOfM=; b=JYBIlBAPEPv/EQfiHCt1gTVzG3W4rg7qwKh/jvw/8eldiKaX/70tCSowCyXNv5bLqm T3GlKClYcCtQ4E5laI/r7m0RPcH1LZoFUwU6w9WxlykLVwfHjMOE0E9Ry7rzlYQInum6 T0NfwZ/K686W6Shhr13DqmOiW+l6DE7cZ2v91lGvRsD+gq39dpaW0KVX0s6/sQL5FF75 KGbkfmKXezOAqC9iMPG9d0qkq0i3SMehM6osHmLTUBZ3suIu2Vt/OlocCIojt6QrOMqA HOemNZP8xTftQwYtY5NOJV2+qfGbgAoYO8OWtXovLD7QFMgOTHtiNIweYNt5PMZ09UJg gKgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713297249; x=1713902049; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qIzFuZzNE61yUFVFZJeazlvytbdmPIliVOvYXRTlOfM=; b=SX7tk6ISyJGnUvGvp1ds9OF52aYjkUlVDDUISSftb04CiIf3y0Z9OsRQ0lqI0/CWwu uk1b/hdGne5m/DgNMMlaG/tURNAC05IZC37DJD+jhQMrV2R9jnvklMezHKEcbgsIZrg1 uWTsgh01XI5ibTAYBLCoJ8BFcGOOqw1CuYBclZ9aqdVVOGhKBI6kpNlJBj6LrKIRJ9HB io6C9XPC2PvGW20DImGOoRUpE8ZhC3ZozFb2pyiPvNJq2fuedjLlLOpTBbLGoosaBRDi sEUrCUgsocJ53AMufRi34roR9oxfKAkB1XLy+b2ID/yUp8IvkaIrMmJt3iZkNUMWuZ+j xtVw== X-Gm-Message-State: AOJu0Yx67EfQbujrK48liWyyqlK1svbTWORbwUIKllAf/oksFTOjqGjU 3AZcNMrZT7ak3M/1C2Ili0dsvGhrVmGLkWKXVjA/dbsH9KXNeK/k6VdSyg== X-Received: by 2002:a05:6102:41a9:b0:47b:6718:6c34 with SMTP id cd41-20020a05610241a900b0047b67186c34mr11804638vsb.23.1713297248983; Tue, 16 Apr 2024 12:54:08 -0700 (PDT) Received: from lvondent-mobl4.. ([107.146.107.67]) by smtp.gmail.com with ESMTPSA id h13-20020a67cfcd000000b00476d2a0cc1asm1785953vsm.8.2024.04.16.12.54.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 12:54:08 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v1] Bluetooth: MGMT: Fix failing to MGMT_OP_ADD_UUID/MGMT_OP_REMOVE_UUID Date: Tue, 16 Apr 2024 15:54:07 -0400 Message-ID: <20240416195407.1153243-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Luiz Augusto von Dentz These commands don't require the adapter to be up and running so don't use hci_cmd_sync_queue which would check that flag, instead use hci_cmd_sync_submit which would ensure mgmt_class_complete is set properly regardless if any command was actually run or not. Link: https://github.com/bluez/bluez/issues/809 Fixes: d883a4669a1d ("Bluetooth: hci_sync: Only allow hci_cmd_sync_queue if running") Signed-off-by: Luiz Augusto von Dentz --- net/bluetooth/mgmt.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 7129e70a0253..68deec968405 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -2623,7 +2623,11 @@ static int add_uuid(struct sock *sk, struct hci_dev *hdev, void *data, u16 len) goto failed; } - err = hci_cmd_sync_queue(hdev, add_uuid_sync, cmd, mgmt_class_complete); + /* MGMT_OP_ADD_UUID don't require adapter the UP/Running so use + * hci_cmd_sync_submit instead of hci_cmd_sync_queue. + */ + err = hci_cmd_sync_submit(hdev, add_uuid_sync, cmd, + mgmt_class_complete); if (err < 0) { mgmt_pending_free(cmd); goto failed; @@ -2717,8 +2721,11 @@ static int remove_uuid(struct sock *sk, struct hci_dev *hdev, void *data, goto unlock; } - err = hci_cmd_sync_queue(hdev, remove_uuid_sync, cmd, - mgmt_class_complete); + /* MGMT_OP_REMOVE_UUID don't require adapter the UP/Running so use + * hci_cmd_sync_submit instead of hci_cmd_sync_queue. + */ + err = hci_cmd_sync_submit(hdev, remove_uuid_sync, cmd, + mgmt_class_complete); if (err < 0) mgmt_pending_free(cmd); @@ -2784,8 +2791,11 @@ static int set_dev_class(struct sock *sk, struct hci_dev *hdev, void *data, goto unlock; } - err = hci_cmd_sync_queue(hdev, set_class_sync, cmd, - mgmt_class_complete); + /* MGMT_OP_SET_DEV_CLASS don't require adapter the UP/Running so use + * hci_cmd_sync_submit instead of hci_cmd_sync_queue. + */ + err = hci_cmd_sync_submit(hdev, set_class_sync, cmd, + mgmt_class_complete); if (err < 0) mgmt_pending_free(cmd); -- 2.44.0