Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp6277658pxb; Mon, 14 Feb 2022 21:24:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJxn2O/qcCq2y7FNWqjbAnTXs1j4gSub3O8Rm/3VLdiFBy/XxivAXXn9s8OGUpUQ3mnMaTEo X-Received: by 2002:aa7:dbc3:: with SMTP id v3mr2220880edt.32.1644902644945; Mon, 14 Feb 2022 21:24:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644902644; cv=none; d=google.com; s=arc-20160816; b=xz94cybMV/G0WXQ1GVQZXyV4GRMW3qLYSHkJ/i1JRrBy8zM66xgqD9f7cWyvdnebhH z6UXnionTTxN7n6dDytpuNaHOti9P1KNxbm9YfpcmtblxVeuBWW+eRJP/ezpfRc0cZsp WK3vCrOIoNvOQd6In+QH1NyaWhNFsELg8Lxo6pgloX8zinvTpz0vCAL6EEoB6h/R+nA9 z2yR+lPsVq9t0OFjddrjwvYV3/TWmJGsMfvRIqrRP1kE1RM858M11Z28aSbOVTEVtqJY YyjxyPDBkhhDAfm5iTQVz9muZAJxP+N0FGreiNSHvidOW1GuaZDpur3OBHJEsna6JhSy 85jg== 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=4bHPjfYHptf9otUjWtSYm2RENZWE1lh6de+mqIGnHXU=; b=mCZ0C6w5YQFBUEy9pxWytSEG5Ot8RpyI1mj7UWxS5EFSlN/G6S1w8/8bE/cOHrFW9o 0xxkv9F84CtDKDy1ZX0iCtAgCJDWaDWM9fhPKONE1Hcr6WVn21w3atuW6uuHYS4S7hpE 1nkvd3gDs8FpvpQxMeBkutrkDg7XENahYqEibY8jekRRy74qQdz/2ZiNzExyEyZg2/MH eeTL7+G4xgrKzr2gnoa7tIi5bhRLefkFFKXMcCTo5fEoT3F7/1bZCRXXr7y9KAUyyl1L yiSNy9HK2E/nvdT263N2Dtszg73GGSUfuiFJ9bsrp+TU7nXrhDSZ6oEfO0XBZ78AoGL9 NKWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BoTr8Irz; 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 q23si23518027ejr.317.2022.02.14.21.23.40; Mon, 14 Feb 2022 21:24:04 -0800 (PST) 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=BoTr8Irz; 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 S233219AbiBOCCt (ORCPT + 99 others); Mon, 14 Feb 2022 21:02:49 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:46932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233306AbiBOCCm (ORCPT ); Mon, 14 Feb 2022 21:02:42 -0500 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1865914892F for ; Mon, 14 Feb 2022 17:59:40 -0800 (PST) Received: by mail-pf1-x432.google.com with SMTP id g1so12532102pfv.1 for ; Mon, 14 Feb 2022 17:59:40 -0800 (PST) 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=4bHPjfYHptf9otUjWtSYm2RENZWE1lh6de+mqIGnHXU=; b=BoTr8Irz0R/7fGrTY/FuXoS2f2N3D9ecntIvc9C0fAA7H4Ppvl/dAw2vW0fUWJqByM Z+9PHipNVpw7cNHQ48GPmE8Lqie95FgGunfRbgVNAYp2/oZ5Lhhlgmm4LYdHy0Ew2ZbC POAc2P2w+Yr0kjwF5upDsPXNBPyrrpN3css6zTTpTGl9dj8oG/GdDFctIsDbFi3gv+vZ ybUtlVK+iA286bODQMVHTOm8HipGmfJ6yV4oNxMeLCTf+PhEeU9LXajvEuPUP6e01tek yxwJL8htXanxYjaWHPQRkrD/KfJHQKH/pW8JUadjWI5qBFk0M94EdxNoUqvrKQoKTfCn X1AA== 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=4bHPjfYHptf9otUjWtSYm2RENZWE1lh6de+mqIGnHXU=; b=GKqCfuYMrX9HTK74Gr4Ltb9hT5OGw8ktGjfm2M+mHrwA5novKa8dk+55tmAYknSvvQ DgabQ6gr8pjXpOY6ef7DKYbyYtx6vLNOiF3jUmG56zttu7k6yBfhTWoB3AByG5XMeHXp DAHm9/UYPKGYRGroNhg6AEyYBDTkvbVnWSIiBPnxbNX1i92MfJ5XFGvWWl4hGx150jNc 4r56rcX8VNUuxAOX0DaXCGlmqG0UTKgVsSFygk1dABtyDCd11kOcnYbeyqjFbT4o5egn mY/LMie3K+0G5f9EgJ80pchtl3LtoZFim2HKlYurb28vtSt8XmKeQR/2oDWs7+KGSnqM sk7w== X-Gm-Message-State: AOAM5303CVhwZWxbP/k4YSHmVSSzq7/iLsx8EfZr4uNq0K9kFBElZRCM /2TIlt7KsaxNGlHBeo8aXGehoo88x8MsNQ== X-Received: by 2002:a05:6a00:16d3:: with SMTP id l19mr2000550pfc.7.1644890379357; Mon, 14 Feb 2022 17:59:39 -0800 (PST) Received: from lvondent-mobl4.. (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id h16sm8740528pfh.40.2022.02.14.17.59.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 17:59:39 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH] Bluetooth: Fix bt_skb_sendmmsg not allocating partial chunks Date: Mon, 14 Feb 2022 17:59:38 -0800 Message-Id: <20220215015938.1950978-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.34.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 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. Link: https://lore.kernel.org/linux-bluetooth/aa3ee7ac-6c52-3861-1798-3cc1a37f6ebf@molgen.mpg.de/T/#m1f9673e4ab0d55a7dccf87905337ab2e67d689f1 Fixes: 81be03e026dc ("Bluetooth: RFCOMM: Replace use of memcpy_from_msg with bt_skb_sendmmsg") Signed-off-by: Luiz Augusto von Dentz --- include/net/bluetooth/bluetooth.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 4b3d0b16c185..a647e5fabdbd 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h @@ -506,8 +506,7 @@ static inline struct sk_buff *bt_skb_sendmmsg(struct sock *sk, tmp = bt_skb_sendmsg(sk, msg, len, mtu, headroom, tailroom); if (IS_ERR(tmp)) { - kfree_skb(skb); - return tmp; + return skb; } len -= tmp->len; -- 2.34.1