| From b57786973aaa4df261b994921da4a12a9b50b8ef Mon Sep 17 00:00:00 2001 |
| From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> |
| Date: Mon, 14 Feb 2022 17:59:38 -0800 |
| Subject: [PATCH] FROMGIT: Bluetooth: Fix bt_skb_sendmmsg not allocating |
| partial chunks |
| |
| 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 <pmenzel@molgen.mpg.de> |
| 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 <luiz.von.dentz@intel.com> |
| Tested-by: Paul Menzel <pmenzel@molgen.mpg.de> (Nokia N9 (MeeGo/Harmattan) |
| Signed-off-by: Marcel Holtmann <marcel@holtmann.org> |
| (cherry picked from commit 8abc7824203217c23de0e513b2a9505d0f9a0603 https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master) |
| |
| BUG=b:212563659,b:217263424 |
| TEST=qemu doesn't crash, nearby transfer is successful |
| |
| Signed-off-by: Archie Pusaka <apusaka@chromium.org> |
| Change-Id: Iffe54ce69939dff3b6058c915811b9c17631ffed |
| Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/3468812 |
| Reviewed-by: Sean Paul <seanpaul@chromium.org> |
| Reviewed-by: Ying Hsu <yinghsu@google.com> |
| --- |
| 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 94b2d22f6a17..8cb196d1499c 100644 |
| --- a/include/net/bluetooth/bluetooth.h |
| +++ b/include/net/bluetooth/bluetooth.h |
| @@ -518,8 +518,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.35.1.574.g5d30c73bfb-goog |
| |