> mt76_connac2_reverse_frag0_hdr_trans() reads an Ethernet header after > hdr_offset, but does not check that the linear data of the skb holds > one. A frame of several DMA buffers is not linear, and the hardware sets > the length of the first buffer. For a shorter first buffer, skb_pull() > hits the BUG() in __skb_pull(), or fails and leaves no headroom, so the > skb_push() of the LLC header hits skb_under_panic(). > > Drop a first fragment whose linear data holds no full Ethernet header > after the header gap. > > Fixes: dc5399a50b45 ("mt76: reverse the first fragmented frame to 802.11") > Cc: stable@vger.kernel.org > Signed-off-by: Felix Fietkau Reviewed-by: Lorenzo Bianconi > --- > drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c > index 6c2caade62d6..653d5162358e 100644 > --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c > +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c > @@ -976,6 +976,9 @@ int mt76_connac2_reverse_frag0_hdr_trans(struct ieee80211_vif *vif, > struct ieee80211_hdr hdr; > u16 frame_control; > > + if (skb_headlen(skb) < hdr_offset + sizeof(*eth_hdr)) > + return -EINVAL; > + > if (le32_get_bits(rxd[3], MT_RXD3_NORMAL_ADDR_TYPE) != > MT_RXD3_NORMAL_U2M) > return -EINVAL; > -- > 2.47.3 > >