public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: ISO: Fix not using the correct QoS
@ 2022-08-05 21:56 Luiz Augusto von Dentz
  2022-08-05 23:01 ` bluez.test.bot
  2022-08-05 23:20 ` [PATCH] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2022-08-05 21:56 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This fixes using wrong QoS settings when attempting to send frames while
acting as peripheral since the QoS settings in use are stored in
hconn->iso_qos not in sk->qos, this is actually properly handled on
getsockopt(BT_ISO_QOS) but not on iso_send_frame.

Fixes: ccf74f2390d60 ("Bluetooth: Add BTPROTO_ISO socket type")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
 net/bluetooth/iso.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c
index 015d1b41bc32..ced8ad4fed4f 100644
--- a/net/bluetooth/iso.c
+++ b/net/bluetooth/iso.c
@@ -373,15 +373,24 @@ static int iso_connect_cis(struct sock *sk)
 	return err;
 }
 
+static struct bt_iso_qos *iso_sock_get_qos(struct sock *sk)
+{
+	if (sk->sk_state == BT_CONNECTED || sk->sk_state == BT_CONNECT2)
+		return &iso_pi(sk)->conn->hcon->iso_qos;
+
+	return &iso_pi(sk)->qos;
+}
+
 static int iso_send_frame(struct sock *sk, struct sk_buff *skb)
 {
 	struct iso_conn *conn = iso_pi(sk)->conn;
+	struct bt_iso_qos *qos = iso_sock_get_qos(sk);
 	struct hci_iso_data_hdr *hdr;
 	int len = 0;
 
 	BT_DBG("sk %p len %d", sk, skb->len);
 
-	if (skb->len > iso_pi(sk)->qos.out.sdu)
+	if (skb->len > qos->out.sdu)
 		return -EMSGSIZE;
 
 	len = skb->len;
@@ -1263,10 +1272,7 @@ static int iso_sock_getsockopt(struct socket *sock, int level, int optname,
 		break;
 
 	case BT_ISO_QOS:
-		if (sk->sk_state == BT_CONNECTED || sk->sk_state == BT_CONNECT2)
-			qos = &iso_pi(sk)->conn->hcon->iso_qos;
-		else
-			qos = &iso_pi(sk)->qos;
+		qos = iso_sock_get_qos(sk);
 
 		len = min_t(unsigned int, len, sizeof(*qos));
 		if (copy_to_user(optval, qos, len))
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: Bluetooth: ISO: Fix not using the correct QoS
  2022-08-05 21:56 [PATCH] Bluetooth: ISO: Fix not using the correct QoS Luiz Augusto von Dentz
@ 2022-08-05 23:01 ` bluez.test.bot
  2022-08-05 23:20 ` [PATCH] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2022-08-05 23:01 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 1096 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=665768

---Test result---

Test Summary:
CheckPatch                    PASS      1.66 seconds
GitLint                       PASS      0.98 seconds
SubjectPrefix                 PASS      0.86 seconds
BuildKernel                   PASS      33.33 seconds
BuildKernel32                 PASS      28.61 seconds
Incremental Build with patchesPASS      41.02 seconds
TestRunner: Setup             PASS      478.76 seconds
TestRunner: l2cap-tester      PASS      16.98 seconds
TestRunner: bnep-tester       PASS      6.29 seconds
TestRunner: mgmt-tester       PASS      99.96 seconds
TestRunner: rfcomm-tester     PASS      9.65 seconds
TestRunner: sco-tester        PASS      9.32 seconds
TestRunner: smp-tester        PASS      9.42 seconds
TestRunner: userchan-tester   PASS      6.50 seconds



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Bluetooth: ISO: Fix not using the correct QoS
  2022-08-05 21:56 [PATCH] Bluetooth: ISO: Fix not using the correct QoS Luiz Augusto von Dentz
  2022-08-05 23:01 ` bluez.test.bot
@ 2022-08-05 23:20 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2022-08-05 23:20 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Fri,  5 Aug 2022 14:56:01 -0700 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> This fixes using wrong QoS settings when attempting to send frames while
> acting as peripheral since the QoS settings in use are stored in
> hconn->iso_qos not in sk->qos, this is actually properly handled on
> getsockopt(BT_ISO_QOS) but not on iso_send_frame.
> 
> [...]

Here is the summary with links:
  - Bluetooth: ISO: Fix not using the correct QoS
    https://git.kernel.org/bluetooth/bluetooth-next/c/aac59090a068

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-05 23:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-05 21:56 [PATCH] Bluetooth: ISO: Fix not using the correct QoS Luiz Augusto von Dentz
2022-08-05 23:01 ` bluez.test.bot
2022-08-05 23:20 ` [PATCH] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox