iptfs_alloc_skb() leaves the MAC header unset. When reassembly completes,
iptfs_complete_inner_skb() sends the inner skb through gro_cells_receive()
without initializing it. An AF_PACKET listener then derives a large push
length from the unset header and trips skb_under_panic():
kernel BUG at net/core/skbuff.c:215!
RIP: 0010:skb_panic (net/core/skbuff.c:215)
Call Trace:
<IRQ>
skb_push.cold (net/core/skbuff.c:225 net/core/skbuff.c:2680)
packet_rcv (net/packet/af_packet.c:2195)
__netif_receive_skb_core.constprop.0
(net/core/dev.c:2581 net/core/dev.c:6397)
gro_cell_poll (net/core/gro_cells.c:79)
Reset the MAC header to the start of the inner packet when it is unset.
Preserve a valid L2 header when the receive path rebuilt one from the outer
skb.
Fixes: 6c82d2433671 ("xfrm: iptfs: add basic receive packet (tunnel egress) handling")
Signed-off-by: Kyuwon Cho <kyuw…@skku.edu>
---
This issue was found by an LLM-guided test generator used in our research prototype.
A reproducer is available on request.
net/xfrm/xfrm_iptfs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/xfrm/xfrm_iptfs.c b/net/xfrm/xfrm_iptfs.c
index 76272b0a1829..22f83e25a86e 100644
--- a/net/xfrm/xfrm_iptfs.c
+++ b/net/xfrm/xfrm_iptfs.c
@@ -665,6 +665,8 @@ static u32 __iptfs_iplen(u8 *data)
*/
static void iptfs_complete_inner_skb(struct xfrm_state *x, struct sk_buff *skb)
{
+ if (!skb_mac_header_was_set(skb))
+ skb_reset_mac_header(skb);
skb_reset_network_header(skb);
/* The packet is going back through gro_cells_receive no need to
--
2.43.0