Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp2192734rwb; Fri, 5 Aug 2022 15:22:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR57FJKA0DdsvUPNqLo0sMdQQo/lulrkaXlv3oQc3vjSSja7PTOQ+famha7muKIrp8gU7bQS X-Received: by 2002:a17:906:d54b:b0:72e:ece1:2956 with SMTP id cr11-20020a170906d54b00b0072eece12956mr6639133ejc.156.1659738174025; Fri, 05 Aug 2022 15:22:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659738174; cv=none; d=google.com; s=arc-20160816; b=sJb00ElIHACT//JeRSJOQuk+l/pVHtELiZp4I2hdBsNVh2PG9nZo+1AgmsratkdYzB m4BRoBWOzpsu1UjF4fKrita2nIjXIXhjIPbxLW0YTfD6xGSJz4f1zs4qqKc+sInpgird LQVnP+AP4YNjpW2IdKrkj9G2tBwTPrxhkSg90/NjpVyYNwoQ1iXWG7Ws1k+u83Efl0SO W3220FF1WHqULt0rL00I6tXR6kDrOFOdqI2+ty791iODfcyu1YEr0PYTn6X6twEdKbHb YoscU0DeC12xLLy3k7S4Lz8/f+Pllnq1hx6xnySFJNgOFPK3fBo6ifBCZ6Ni8GT4JCaf hrCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=BrZCVXfqfi3oOXZsNJc8r9QljeSz92b3tE/eqB5fI4Y=; b=WJlyuAQYk9Jfhp5+Tt/z9xgEcrzQyVxftR3w6jiKGODEXmnuyzcVEG26efYEso7+1f gafTGZJr9uhR5rE+wB+ce5Uuku3TbIifyb5Or0esuAVyQBAJJWRsqeMAzRyWccm1L49d q+Dbmb/Bm3Jqo8eTM1DIaWHTQaeG7+82Ax+MRaYcMFJhydJHBezfjbxJnHT+KoqqXE4b PXozb8g5QqUv0H1XxcmvnS6yoHBkH8JMUrldR2AmThQ24MN1b7js5/cd2xXJ422wReOn 2Hxt6rFX7qcwRC1zToSWcUzU7zV/n5aWQ3eHqAerFsz6LN4XHTzhLsm2dmhPm7Hv+xLT BEuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nTwoeLQt; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x19-20020a170906441300b007303646197csi4380908ejo.596.2022.08.05.15.22.23; Fri, 05 Aug 2022 15:22:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nTwoeLQt; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241794AbiHEV6q (ORCPT + 99 others); Fri, 5 Aug 2022 17:58:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241795AbiHEV63 (ORCPT ); Fri, 5 Aug 2022 17:58:29 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69B107D7B8 for ; Fri, 5 Aug 2022 14:56:15 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id 13so2307778plo.12 for ; Fri, 05 Aug 2022 14:56:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=BrZCVXfqfi3oOXZsNJc8r9QljeSz92b3tE/eqB5fI4Y=; b=nTwoeLQtj6EdVs823gaC9uvh83kXM/G7ycYY3Y1jYZGFY8iom5uFVZ58x/idlzfALM V6NHq33xYT2yybCBrgqF9ehtwvbyWUmG5zEUBynUjYeOSz3aa3LYBQkeYUMSRCmdPRZY bJgmBcQLpsiDcgjcCJyzjEAC6hJER2IM/xkaSQ5tcZkb4Wcbq3m/MRJFs3YxxscgHR1h u7iUopO/5Y7XxMfqocHYqTcT+yb5Zrp/SUu9wWQU+SdSEXYBDF8NRVst1Y91rZRr+7Jv cuw4bhKYNdlp0tY9fFykdj17O9VhGmB1EUIH1LR1O5R4nCd8+xntbuacjbSzaahr/mBZ +Ggg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=BrZCVXfqfi3oOXZsNJc8r9QljeSz92b3tE/eqB5fI4Y=; b=n/98UOUgt2H/fyO27TF8oU8eaGKwF3aSUzc5uWr589GFSBg0KS7dTTzhG5U4jIxgHp ojGh8yeUAUSQqs+aUZIv2lfITwVQKoREKiLnZl+3Jxu45XbSd02uQUvwUpDtz5jrDMVz HgymJjidgAUvmJtm4jPiuDv29jLPq2UqNJfbrfdZie2Z69ndjt41CFj2Eaq6h2HQjTKy Nq1xL4gemefVkTqFsD3IYVJh7zQ2/xVy+xDmw3aI2w7v4uLQzFGoiV76jiTzbMRup4Th /ZFM3qam2tLAY40zgib4nDDju9XpNPNjsAp67lOuUFJMkNCrjFrPaqIeYth8zrV3P49Y nVug== X-Gm-Message-State: ACgBeo24uvJAo+p8rWEOGnUAIHPCAmb9RqpFHHOCSJ7MCTzmjf6hNPjr 3nNHQoG/GpaWMaOOWxtHMbMNODplRxdxOQ== X-Received: by 2002:a17:902:ccc4:b0:16c:5766:51f9 with SMTP id z4-20020a170902ccc400b0016c576651f9mr8625416ple.84.1659736574373; Fri, 05 Aug 2022 14:56:14 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id m26-20020a62a21a000000b0052e988c1630sm2918153pff.138.2022.08.05.14.56.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Aug 2022 14:56:12 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH] Bluetooth: ISO: Fix not using the correct QoS Date: Fri, 5 Aug 2022 14:56:01 -0700 Message-Id: <20220805215601.3958596-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz 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 --- 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