Skip to contentSkip to conversation

Bluetooth: bnep: linearize skb before sending

PATCH Applied Adriano Cordova 2 participants 2 messages Sep 8 – Sep 9

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Bluetooth: bnep: linearize skb before sending

kernel_sendmsg expects contiguous data. Linearize the skb in the bnep_session() loop, before bnep_tx_frame builds its kvec, so it is not split across non-linear pages. Drop the dead block and FIXME.

---
Changes since v1:
- Move linearization to bnep_session loop, before bnep_tx_frame builds its kvec

 net/bluetooth/bnep/core.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
net/bluetooth/bnep/core.c +6 -6
index 0dde82e9a085..e8b4672628dd 100644
@@ -480,10 +480,7 @@ static int bnep_tx_frame(struct bnep_session *s, struct sk_buff *skb)
 	iv[il++] = (struct kvec) { skb->data, skb->len };
 	len += skb->len;
 
-	/* FIXME: linearize skb */
-	{
-		len = kernel_sendmsg(sock, &s->msg, iv, il, len);
-	}
+	len = kernel_sendmsg(sock, &s->msg, iv, il, len);
 	kfree_skb(skb);
 
 	if (len > 0) {
@@ -524,9 +521,12 @@ static int bnep_session(void *arg)
 			break;
 
 		/* TX */
-		while ((skb = skb_dequeue(&sk->sk_write_queue)))
-			if (bnep_tx_frame(s, skb))
+		while ((skb = skb_dequeue(&sk->sk_write_queue))) {
+			if (skb_linearize(skb))
+				kfree_skb(skb);
+			else if (bnep_tx_frame(s, skb))
 				break;
+		}
 		netif_wake_queue(dev);
 
 		/*
Signature · 1 line
2.51.0
#1 lore raw
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 8 lines · On Tue, 8 Sep 2026 13:54:13 -0300 you wrote:

kernel_sendmsg expects contiguous data. Linearize the skb in the bnep_session() loop, before bnep_tx_frame builds its kvec, so it is not split across non-linear pages. Drop the dead block and FIXME.

[...]

Here is the summary with links:
- [v2] Bluetooth: bnep: linearize skb before sending

    https://git.kernel.org/bluetooth/bluetooth-next/c/c2daf81dc275

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html