Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp999980ybh; Wed, 15 Jul 2020 23:41:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzb1aTipXzcFfA7EXMeFvfb5Fogs9Qzi95EId+Y0RiwopeY87G6ALDcCPSSK842gnOsMBuX X-Received: by 2002:aa7:db53:: with SMTP id n19mr3112423edt.338.1594881694635; Wed, 15 Jul 2020 23:41:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594881694; cv=none; d=google.com; s=arc-20160816; b=FbqN4j1ieWSbcgvPf8vK1GXEHuwYr5EUMsXJoGLjPQOmRVlusvjXtCpaw3Dr+MnABw elBD2qgokow95KAQXgNNcI6/W95xwtW3l1TpeoS745Qr7rLHRkNHDP8XOqDioHaqWZNv VcQ745JwjVGga5GK1AE84CS/BYJUEFXOgUSQE62ldr/hWcyjkvSo2g73D/l7rfUBf6c0 +pv54J6jMnsE0nsZ214o9pvjOeU53CtV0yZY5VjdqxToACyr6z+e9JQYUGb9kd3baIl6 O4Oi3113AERBTFs3rLSCZhq6PlLbcsOSdt2N4rqTkP0++dPU6SUFhhjESZP/EhM5W0+h r7/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=muZZsql8XpL71eYKMHmDcfQT5O1w2btTe30e+mVuVE0=; b=TMuHfzSjDxXoDlN300L94dxn+mwn7jTH5JmXkKqtbt5kkA/h+q2DCjrxNa3PWM9aWw h6/inFIKFB19bxhXiXDP/HWT1v93G6cOdrTYRR92T3njoFkOq7LyqTQBKH8B9yYU7IIJ tL29Yw9bKhERoGNKszbZx2seMzbKWs8ga491LQ4LTUbW0HhO0b5q/mCfBxk3xpTgKLCR mr3dRX4b4OQbtPwbp/CdPt3+TDX3OsKdPtVpxQ6vBPpvl+fZC8WogFY74IP/XX/jHc2C bpZHgtz55e2NyNTOWccaHp+/J5uVx2PD3OsIbJ6a8F2W89GY3HlWfH6rZcJ3pkXufUet 33DQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c94si2790346edf.589.2020.07.15.23.40.51; Wed, 15 Jul 2020 23:41:34 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727971AbgGPGkq convert rfc822-to-8bit (ORCPT + 99 others); Thu, 16 Jul 2020 02:40:46 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:37516 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727850AbgGPGkq (ORCPT ); Thu, 16 Jul 2020 02:40:46 -0400 Received: from marcel-macpro.fritz.box (p5b3d2638.dip0.t-ipconnect.de [91.61.38.56]) by mail.holtmann.org (Postfix) with ESMTPSA id B8F35CECFC; Thu, 16 Jul 2020 08:50:43 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: [PATCH v2] Bluetooth: Fix update of connection state in `hci_encrypt_cfm` From: Marcel Holtmann In-Reply-To: <50fd2c75ce196196f879f8373555cc30bfc75154.1594834970.git.ps@pks.im> Date: Thu, 16 Jul 2020 08:40:44 +0200 Cc: Bluetooth Kernel Mailing List , Johan Hedberg , Luiz Augusto von Dentz Content-Transfer-Encoding: 8BIT Message-Id: References: <0df5bf3eac160de28b9493a8959510980a8a8e8b.1594803508.git.ps@pks.im> <50fd2c75ce196196f879f8373555cc30bfc75154.1594834970.git.ps@pks.im> To: Patrick Steinhardt X-Mailer: Apple Mail (2.3608.80.23.2.2) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Patrick, > Starting with the upgrade to v5.8-rc3, I've noticed I wasn't able to > connect to my Bluetooth headset properly anymore. While connecting to > the device would eventually succeed, bluetoothd seemed to be confused > about the current connection state where the state was flapping hence > and forth. Bisecting this issue led to commit 3ca44c16b0dc (Bluetooth: > Consolidate encryption handling in hci_encrypt_cfm, 2020-05-19), which > refactored `hci_encrypt_cfm` to also handle updating the connection > state. > > The commit in question changed the code to call `hci_connect_cfm` inside > `hci_encrypt_cfm` and to change the connection state. But with the > conversion, we now only update the connection state if a status was set > already. In fact, the reverse should be true: the status should be > updated if no status is yet set. So let's fix the isuse by reversing the > condition. > > Fixes: 3ca44c16b0dc ("Bluetooth: Consolidate encryption handling in hci_encrypt_cfm") > Signed-off-by: Patrick Steinhardt > --- > include/net/bluetooth/hci_core.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) patch has been applied to bluetooth-next tree. Regards Marcel