All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zijun Hu <quic_zijuhu@quicinc.com>
To: <luiz.dentz@gmail.com>, <marcel@holtmann.org>,
	<johan.hedberg@gmail.com>, <jaikumar@google.com>
Cc: <linux-bluetooth@vger.kernel.org>, <quic_zijuhu@quicinc.com>
Subject: [PATCH v1] Bluetooth: hci_sync: Fix logical error when enter active mode
Date: Thu, 2 Nov 2023 17:28:22 +0800	[thread overview]
Message-ID: <1698917302-28018-1-git-send-email-quic_zijuhu@quicinc.com> (raw)

it seems HCI_CONN_POWER_SAVE stands for active mode based on
hci_mode_change_evt(), but hci_conn_enter_active_mode() does not take
this flag rightly and failed to exit sniff mode potentially, it is
fixed by this change.

Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
 net/bluetooth/hci_conn.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 929d0e313db2..302fb5eaca55 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -2582,7 +2582,12 @@ void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active)
 	if (conn->mode != HCI_CM_SNIFF)
 		goto timer;
 
-	if (!test_bit(HCI_CONN_POWER_SAVE, &conn->flags) && !force_active)
+	if (test_bit(HCI_CONN_POWER_SAVE, &conn->flags)) {
+		BT_DBG("%s: hcon %p is already active mode", __func__, conn);
+		goto timer;
+	}
+
+	if (!force_active)
 		goto timer;
 
 	if (!test_and_set_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->flags)) {
-- 
The Qualcomm Innovation Center


             reply	other threads:[~2023-11-02  9:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-02  9:28 Zijun Hu [this message]
2023-11-02  9:50 ` [PATCH v1] Bluetooth: hci_sync: Fix logical error when enter active mode quic_zijuhu
2023-11-02 10:03 ` [v1] " bluez.test.bot
2023-11-03  7:05 ` [PATCH v2 1/1] Bluetooth: hci_event: Correct power save marking logic Zijun Hu
2023-11-03  7:36   ` [v2,1/1] " bluez.test.bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1698917302-28018-1-git-send-email-quic_zijuhu@quicinc.com \
    --to=quic_zijuhu@quicinc.com \
    --cc=jaikumar@google.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.