Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp478358imn; Wed, 27 Jul 2022 11:19:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sTLLMkG4ZgWyY8qOuvEOLMEOQ3tVUEaQCBskkY3FaRt83pLWPslbCdPi5jpnFqTYCyvu5H X-Received: by 2002:a17:906:98c7:b0:72b:20fe:807d with SMTP id zd7-20020a17090698c700b0072b20fe807dmr18987416ejb.75.1658945958280; Wed, 27 Jul 2022 11:19:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658945958; cv=none; d=google.com; s=arc-20160816; b=Jfgn5A5yu3Wij3kNz713BTYKlnUG9VI8zjJ3xNrKLxoKH/hZ/3SRvAYWTOJOa7QlVe d4G3fKOrjVef3k1O6yF7/gjWPxysbkXgkmVcqtkeBMOpKKmN9WQVSksv/1CbFxgWNTXC FdWbVF2ZJ/Bpo2vHL1+ijM0d3AmPA4taGtMydF0SdLI9hEKBHGhQDIkaEPtvjFGAnxiI iQpEcHicv5gJYuKPAxMtOLWCxuwALJt9ST6hSNlHVzoTjLXu6U4YxqnCgLKel6Af5az1 /zzQOYjtxh0L34O5M4telObkXv1xOP+a0RtZUaQcgkBImSvXI2FyFNW0VcnHnKbm9bf5 Prjw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EsMnJviFshXqk4JxNgeTpwGEvHCGzxMqKSI6E7EAvFU=; b=IftGRR/bH9CGcD0Vpk/knohOUUK0oDFEiVywLjbNPm23/eZ+9u4nYKc0iqFCxgoHIq qOBlfJaadOqYj/06O9ygH2tNjGTZZhV0n1hYk6v9KLsjrwOZ7t0LierW0AplePlP2jC4 gZqTQhFOb2WggA6Wm2rPnqjZYaucnD23x+NIGykJ5l4JVRon05DfOdpYUlKwbwPVDviW uNsapGBuZOyDegLgyu1iHSECotcSQJPURdEh83ZxHk+fDEsdwTGvMjeREuITBHLy0Nk7 xkTpsLNGHaVtBIaNohR72sYp037rerSPpCm5xR++LomJwoo0SedwskQdGf6LkbcT/XJ9 xAbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="YkDQOf/A"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i16-20020a0564020f1000b0043b6a4c1f1bsi3690988eda.143.2022.07.27.11.18.52; Wed, 27 Jul 2022 11:19:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b="YkDQOf/A"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240409AbiG0Qs5 (ORCPT + 99 others); Wed, 27 Jul 2022 12:48:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240478AbiG0QsS (ORCPT ); Wed, 27 Jul 2022 12:48:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A3CD61101; Wed, 27 Jul 2022 09:32:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D671061A04; Wed, 27 Jul 2022 16:27:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E36A5C433D6; Wed, 27 Jul 2022 16:27:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658939241; bh=UOpROHzo/X7Rd+9/tzUGSTkx8KnfLTdzuVsBE7Rw9Vs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YkDQOf/AoF2Tcf+FRzzcKMwnrAiSjMNkrRGA+woMMkLOTSMO7WOkebQpSR3DD+oj1 yCGmjzwGDUxZtnaYTJD3P5sNvTUxZ49Wez149gN+kr9jiNmcJf3RO9Q9TwSZwoeun8 CFqZYDHzlH2Gl/lBq67A/I9LNIDf62dCW3ueb69o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tedd Ho-Jeong An , Luiz Augusto von Dentz , Marcel Holtmann , Harshit Mogalapalli Subject: [PATCH 4.19 50/62] Bluetooth: SCO: Fix sco_send_frame returning skb->len Date: Wed, 27 Jul 2022 18:10:59 +0200 Message-Id: <20220727161006.082825060@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727161004.175638564@linuxfoundation.org> References: <20220727161004.175638564@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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-kernel@vger.kernel.org From: Luiz Augusto von Dentz commit 037ce005af6b8a3e40ee07c6e9266c8997e6a4d6 upstream. The skb in modified by hci_send_sco which pushes SCO headers thus changing skb->len causing sco_sock_sendmsg to fail. Fixes: 0771cbb3b97d ("Bluetooth: SCO: Replace use of memcpy_from_msg with bt_skb_sendmsg") Tested-by: Tedd Ho-Jeong An Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Marcel Holtmann Cc: Harshit Mogalapalli Signed-off-by: Greg Kroah-Hartman --- net/bluetooth/sco.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c @@ -282,16 +282,17 @@ static int sco_connect(struct hci_dev *h static int sco_send_frame(struct sock *sk, struct sk_buff *skb) { struct sco_conn *conn = sco_pi(sk)->conn; + int len = skb->len; /* Check outgoing MTU */ - if (skb->len > conn->mtu) + if (len > conn->mtu) return -EINVAL; - BT_DBG("sk %p len %d", sk, skb->len); + BT_DBG("sk %p len %d", sk, len); hci_send_sco(conn->hcon, skb); - return skb->len; + return len; } static void sco_recv_frame(struct sco_conn *conn, struct sk_buff *skb) @@ -731,7 +732,8 @@ static int sco_sock_sendmsg(struct socke err = -ENOTCONN; release_sock(sk); - if (err) + + if (err < 0) kfree_skb(skb); return err; }