Dear Luiz,
Am 15.02.22 um 02:59 schrieb Luiz Augusto von Dentz:
From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>
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.
Thank you for fixing the bug I found.
Tested-by: Paul Menzel <pmenzel@xxxxxxxxxxxxx> (Nokia N9 (MeeGo/Harmattan)
Link: https://lore.kernel.org/linux-bluetooth/aa3ee7ac-6c52-3861-1798-3cc1a37f6ebf@xxxxxxxxxxxxx/T/#m1f9673e4ab0d55a7dccf87905337ab2e67d689f1
The Linux kernel regression status, when expanding the bug entry: asks
to add:
Fixes: 81be03e026dc ("Bluetooth: RFCOMM: Replace use of memcpy_from_msg
with bt_skb_sendmmsg")
Reported-by: Paul Menzel <pmenzel@xxxxxxxxxxxxx>
Link:
https://lore.kernel.org/r/d7206e12-1b99-c3be-84f4-df22af427ef5@xxxxxxxxxxxxx
Fixes: 81be03e026dc ("Bluetooth: RFCOMM: Replace use of memcpy_from_msg with bt_skb_sendmmsg")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>
Maybe also add:
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=215594
---
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;
Kind regards,
Paul
[1]: https://linux-regtracking.leemhuis.info/regzbot/mainline/