Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp484002imn; Wed, 27 Jul 2022 11:28:54 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vp/FaCcQdMyUc5IMIrIFvjquFcpwVsj37Z5kJL013adVVsEdqJoiz32fKBWwlOPHDxrP4T X-Received: by 2002:a17:907:75f2:b0:72b:564c:465e with SMTP id jz18-20020a17090775f200b0072b564c465emr17868001ejc.689.1658946534651; Wed, 27 Jul 2022 11:28:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658946534; cv=none; d=google.com; s=arc-20160816; b=hvycD+Ewy2aUaU5fvlpkofd44EgEXEX8wIIMKMvNsBh0/TDoqNXt9ty+gl7umZ2LWQ TmHvKBl9aujlMjtleyUIlZI2gGGDutAdSWOuChhySPnRCeYA2YK1LJyo1FkzeQbQ34XI 4dUwBFxhjPzH2UKg999OWKfy440z+J0mUdH+p5o4jA9hf4sMC2rLGucjUlKT3wxYNRom z5oja2CMyi9WZh738H4CaKvg1rkGN+S5hkzlc6X4o3KTaE2e1FgLqf/KCyT4w+jcNKQB gxUiatqMgjEN3fZXImnZH1ZOSjoNqYM/gRtBkzQlDAjj8H2tQzguYGyZ8RIG5KXcJ47L 9kSA== 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=xXQvc1kHvrahHjml04WtHZh2jWNzxEJh02iyaVzZNnQ=; b=NiyYuFvsFiWtXuKt5lP1xj/CN9awALNmsZTiDnxThFcpPl3ydfsfhwKWqQpxGVG0aU dUeT8AA+V01NJM9BjVMV33p85I1Ys1kSKY07Un4THPUiD3dPQY6LoRYDGBuYbtxEqmLg O4Ht/wK+W8oIyNixFZcLLdSu2Ek+fpr4Ka6mfwdgKKXIaAAdpoK5RCNg78pEpaR4HoOR 3o3joUZMEYzFdAYwe09b3K+nSulz6HcC7HPX1kACq5dMjdLdwLJCpRdEvVaWcLoPJiaE lqvpwilgSdX7W4XJi0vr0zelehCTr7wqWU/8hEaD6wRnAc4w8oR8EHKj/9mq3Cg7xx+n Fp3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DrFpfMWH; 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 sd1-20020a1709076e0100b00726a3abf022si4317575ejc.781.2022.07.27.11.28.27; Wed, 27 Jul 2022 11:28:54 -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=DrFpfMWH; 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 S236172AbiG0Q1g (ORCPT + 99 others); Wed, 27 Jul 2022 12:27:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236617AbiG0Q1B (ORCPT ); Wed, 27 Jul 2022 12:27:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3915E4D80E; Wed, 27 Jul 2022 09:23:59 -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 ams.source.kernel.org (Postfix) with ESMTPS id 5A9D1B821B8; Wed, 27 Jul 2022 16:23:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9C6EC433D6; Wed, 27 Jul 2022 16:23:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658939032; bh=OeMS+8TS1at1GfNIVHLa7scKJS0eeyeXOoc2KuysgRQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DrFpfMWH+Oj9PNkwIHs494vxmmGaCSmpUmBwCrbo/DgJyiUeV7xU739n1qBMRbUYw kcCU+H5WMAWbdobFjZY3SB5cOPtIRhll7VxC/xu4KAuoCWWmAjgJ4bH1LkQRq6eOn9 JjHNdTLlgJYusWsep90+2rx0BWvDUovpB0I57pGQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Menzel , Luiz Augusto von Dentz , Marcel Holtmann , Harshit Mogalapalli Subject: [PATCH 4.14 27/37] Bluetooth: Fix bt_skb_sendmmsg not allocating partial chunks Date: Wed, 27 Jul 2022 18:10:53 +0200 Message-Id: <20220727161001.937328879@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727161000.822869853@linuxfoundation.org> References: <20220727161000.822869853@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 29fb608396d6a62c1b85acc421ad7a4399085b9f upstream. Since bt_skb_sendmmsg can be used with the likes of SOCK_STREAM it shall return the partial chunks it could allocate instead of freeing everything as otherwise it can cause problems like bellow. Fixes: 81be03e026dc ("Bluetooth: RFCOMM: Replace use of memcpy_from_msg with bt_skb_sendmmsg") Reported-by: Paul Menzel Link: https://lore.kernel.org/r/d7206e12-1b99-c3be-84f4-df22af427ef5@molgen.mpg.de BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=215594 Signed-off-by: Luiz Augusto von Dentz Tested-by: Paul Menzel (Nokia N9 (MeeGo/Harmattan) Signed-off-by: Marcel Holtmann Cc: Harshit Mogalapalli Signed-off-by: Greg Kroah-Hartman --- include/net/bluetooth/bluetooth.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h @@ -420,8 +420,7 @@ static inline struct sk_buff *bt_skb_sen tmp = bt_skb_sendmsg(sk, msg, len, mtu, headroom, tailroom); if (IS_ERR(tmp)) { - kfree_skb(skb); - return tmp; + return skb; } len -= tmp->len;