Thread (4 messages) 4 messages, 3 authors, 2026-09-09

Re: [PATCH] Bluetooth: bnep: linearize skb before sending

flat view

From: Adriano Córdova <hidden>
Date: 2026-09-08 16:55:42
Also in: linux-bluetooth

Hi Luiz,

Right, thanks, I will send a v2.

Adriano

El mar, 8 sept 2026 a las 12:50, Luiz Augusto von Dentz
([off-list ref]) escribió:
Hi Adriano,

On Sat, Sep 5, 2026 at 3:48 PM Adriano Cordova [off-list ref] wrote:
quoted
kernel_sendmsg expects contiguous data. Check the skb is linear
before building its kvec. Should be already linearized by the
stack, so this is defensive, but drops the dead block and the
FIXME.

Signed-off-by: Adriano Cordova <redacted>
---
 net/bluetooth/bnep/core.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c
index 5a6a49885ab6..497eb1d2d6ee 100644
--- a/net/bluetooth/bnep/core.c
+++ b/net/bluetooth/bnep/core.c
@@ -457,13 +457,15 @@ static int bnep_tx_frame(struct bnep_session *s, struct sk_buff *skb)
        }

 send:
+       if (skb_linearize(skb)) {
+               kfree_skb(skb);
+               return -ENOMEM;
+       }
Looks like we should be linearizing earlier:

https://sashiko.dev/#/patchset/20260905194725.284347-1-adrianox%40gmail.com
quoted
        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) {
--
2.51.0

--
Luiz Augusto von Dentz
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help