Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp322971rdb; Thu, 30 Nov 2023 05:58:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IHcWv7Hj9/nCJQm5pwCAsXV5TdzsjMBc+lP2v8z82wNmp0oGqV1lKTnIK1krPkV2cCXU7+s X-Received: by 2002:a17:902:d487:b0:1cf:dbf8:f233 with SMTP id c7-20020a170902d48700b001cfdbf8f233mr18619601plg.3.1701352707982; Thu, 30 Nov 2023 05:58:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701352707; cv=none; d=google.com; s=arc-20160816; b=CgoJvpcaVyRN2jz5Cz/jAFzfnD2hKUoFo0SipkaB9b3kkLUUw+GhXX/lhzl4/nx1S7 L3/6bzYSvAQ937MUMx+SDG0zGZG6xkq1kB21TMqPuSADM875aGrgrDMqGOfAm5S6/o2d Ehq+hXKRBjdD0esbcPFuhUp4y4dmqJMpP8HP5VfC/xi8pWtKBS41D+qxpiGcdzATA3aQ B8LFmCAI9BesCdVnwN7xoqBDaV/8Zckjd7fRDV6oI52AZQfNoQ5vKBGBj07BOanWZ8q/ 0YW7xgXqA+znayUD9zkOmzxSXIT84/l3ubzywxLBWjho+i7d6jKzTdlm1AM+HJXeoIoW XycA== ARC-Message-Signature: i=1; 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:cc:to :from; bh=NN+CJLQHpKfZN9goVM/jUzIghcyczB9Zvihk8JtZk7s=; fh=dpbggbjnp1q4rw3yHm4M+kTI7eyWdrkCKP1Fp/RizCA=; b=hcb6sjbVu+1LH+qkrL9oIO3Q2DZAEoRlKtj7nDL1sK2IXqHdKL3Tb/a0svtlseYmUm mi9tfSfed7pCzLoV0WhWC/TYpKI7usAmExDysLoPQ+yrB6fjw/7rz4SEymflt9mg6xV1 CgJADXK5ZB5nEELEOOQVtb0NC1l+UAfD9IdfN7AbKnWBKADQDRnVAaLBQQ9hIlc4D7OY MV6gnCjAVo150seI6fs6wzpbUztXEE/dA5FS4jSCuGFW/4IwCWvQBjP5g0Sj1vu6FfLb 6uNaURWsk2XToDW9m8S5fg5qO+aeM9AXAsg63CNXogaPaSTus07JOl4VoZBYab/sEmYM xVfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth+bounces-309-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-309-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id h21-20020a170902ac9500b001cfcd31448fsi1170727plr.581.2023.11.30.05.58.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 05:58:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-309-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth+bounces-309-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-309-linux.lists.archive=gmail.com@vger.kernel.org" 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 71AB7B20FE5 for ; Thu, 30 Nov 2023 13:58:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 994CB48786; Thu, 30 Nov 2023 13:58:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=none X-Original-To: linux-bluetooth@vger.kernel.org Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C182CF for ; Thu, 30 Nov 2023 05:58:11 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 64CE220003; Thu, 30 Nov 2023 13:58:09 +0000 (UTC) From: Bastien Nocera To: linux-bluetooth@vger.kernel.org Cc: Luiz Augusto von Dentz Subject: [RESEND PATCH v2] Bluetooth: Fix bogus check for re-auth no supported with non-ssp Date: Thu, 30 Nov 2023 14:58:03 +0100 Message-ID: <20231130135808.286908-1-hadess@hadess.net> X-Mailer: git-send-email 2.43.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 X-GND-Sasl: hadess@hadess.net From: Luiz Augusto von Dentz This reverts 19f8def031bfa50c579149b200bfeeb919727b27 "Bluetooth: Fix auth_complete_evt for legacy units" which seems to be working around a bug on a broken controller rather then any limitation imposed by the Bluetooth spec, in fact if there ws not possible to re-auth the command shall fail not succeed. Signed-off-by: Luiz Augusto von Dentz --- include/net/bluetooth/hci_core.h | 1 - net/bluetooth/hci_conn.c | 8 +++----- net/bluetooth/hci_event.c | 11 ++--------- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 20988623c5cc..878622a4dde8 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -952,7 +952,6 @@ void hci_inquiry_cache_flush(struct hci_dev *hdev); /* ----- HCI Connections ----- */ enum { HCI_CONN_AUTH_PEND, - HCI_CONN_REAUTH_PEND, HCI_CONN_ENCRYPT_PEND, HCI_CONN_RSWITCH_PEND, HCI_CONN_MODE_CHANGE_PEND, diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 2cee330188ce..d01db89fcb46 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -2421,12 +2421,10 @@ static int hci_conn_auth(struct hci_conn *conn, __u8 sec_level, __u8 auth_type) hci_send_cmd(conn->hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp); - /* If we're already encrypted set the REAUTH_PEND flag, - * otherwise set the ENCRYPT_PEND. + /* Set the ENCRYPT_PEND to trigger encryption after + * authentication. */ - if (test_bit(HCI_CONN_ENCRYPT, &conn->flags)) - set_bit(HCI_CONN_REAUTH_PEND, &conn->flags); - else + if (!test_bit(HCI_CONN_ENCRYPT, &conn->flags)) set_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); } diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 0849e0dafa95..da3e9226c037 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -3484,14 +3484,8 @@ static void hci_auth_complete_evt(struct hci_dev *hdev, void *data, if (!ev->status) { clear_bit(HCI_CONN_AUTH_FAILURE, &conn->flags); - - if (!hci_conn_ssp_enabled(conn) && - test_bit(HCI_CONN_REAUTH_PEND, &conn->flags)) { - bt_dev_info(hdev, "re-auth of legacy device is not possible."); - } else { - set_bit(HCI_CONN_AUTH, &conn->flags); - conn->sec_level = conn->pending_sec_level; - } + set_bit(HCI_CONN_AUTH, &conn->flags); + conn->sec_level = conn->pending_sec_level; } else { if (ev->status == HCI_ERROR_PIN_OR_KEY_MISSING) set_bit(HCI_CONN_AUTH_FAILURE, &conn->flags); @@ -3500,7 +3494,6 @@ static void hci_auth_complete_evt(struct hci_dev *hdev, void *data, } clear_bit(HCI_CONN_AUTH_PEND, &conn->flags); - clear_bit(HCI_CONN_REAUTH_PEND, &conn->flags); if (conn->state == BT_CONFIG) { if (!ev->status && hci_conn_ssp_enabled(conn)) { -- 2.43.0