Hello Hui Peng. On Sat, 19 Sep 2026 21:28:55 +0000, Hui Peng wrote:
> In `dgram_ioctl()` (`SIOCINQ`), the queued skb at the head of > `sk->sk_receive_queue` has already had its MAC header stripped by > `ieee802154_subif_frame()` prior to `dgram_deliver()`, so `skb->len` is > already the exact payload length that `dgram_recvmsg()` will return to > userspace. > > However, `dgram_ioctl()` computes `*karg = skb->len - > ieee802154_hdr_length(skb)`. Calling `ieee802154_hdr_length(skb)` > re-parses the payload bytes as an 802.15.4 MAC header and calls > `pskb_may_pull(skb, ...)` while holding `sk->sk_receive_queue.lock`. > When multiple `SOCK_DGRAM` sockets receive a cloned copy of the frame > (`skb_shared(skb)` is true) and the payload is non-linear, > `pskb_may_pull()` calls `pskb_expand_head()`, which triggers > `BUG_ON(skb_shared(skb))`. Even on unshared linear skbs, subtracting > `ieee802154_hdr_length(skb)` a second time underflows `*karg` to a > negative value when the payload is shorter than the bogus parsed header > length. > > [...]
Applied to wpan/wpan.git, thanks! [1/1] ieee802154: socket: fix shared skb BUG_ON and double header subtraction in dgram_ioctl() https://git.kernel.org/wpan/wpan/c/0c732cc420a8 regards, Stefan Schmidt