Commit 2a73b2c
packet: use consistent hard_header_len in TX_RING send path
[ Upstream commit 21b5953 ]
tpacket_snd() reads dev->hard_header_len independently for skb
allocation and header construction in tpacket_fill_skb(). Concurrent
netdevice reconfiguration can therefore make the reserved headroom
smaller than the amount later pushed, or make copylen - hard_header_len
negative.
Snapshot hard_header_len once before processing ring frames and use it
for the frame limit, headroom allocation, copy length, and skb
construction. Pass the snapshot to tpacket_fill_skb().
The separate SOCK_DGRAM consistency problem between hard_header_len and
header_ops->create is not addressed here.
Fixes: 69e3c75 ("net: TX_RING and packet mmap")
Cc: stable@vger.kernel.org
Signed-off-by: Qihang Tang <q.h.hack.winter@gmail.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20260805125729.19220-4-q.h.hack.winter@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ Applied cleanly after amending the prerequisite that adds `LL_RESERVED_SPACE_EX()`; no target-side adaptation was needed. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 78a4712 commit 2a73b2c
1 file changed
Lines changed: 11 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2586 | 2586 | | |
2587 | 2587 | | |
2588 | 2588 | | |
| 2589 | + | |
2589 | 2590 | | |
2590 | 2591 | | |
2591 | 2592 | | |
| |||
2617 | 2618 | | |
2618 | 2619 | | |
2619 | 2620 | | |
2620 | | - | |
2621 | | - | |
| 2621 | + | |
| 2622 | + | |
2622 | 2623 | | |
2623 | 2624 | | |
2624 | 2625 | | |
| |||
2751 | 2752 | | |
2752 | 2753 | | |
2753 | 2754 | | |
2754 | | - | |
| 2755 | + | |
2755 | 2756 | | |
2756 | 2757 | | |
2757 | 2758 | | |
| |||
2798 | 2799 | | |
2799 | 2800 | | |
2800 | 2801 | | |
| 2802 | + | |
2801 | 2803 | | |
2802 | | - | |
| 2804 | + | |
2803 | 2805 | | |
2804 | 2806 | | |
2805 | 2807 | | |
| |||
2836 | 2838 | | |
2837 | 2839 | | |
2838 | 2840 | | |
2839 | | - | |
| 2841 | + | |
2840 | 2842 | | |
2841 | 2843 | | |
2842 | 2844 | | |
| |||
2854 | 2856 | | |
2855 | 2857 | | |
2856 | 2858 | | |
2857 | | - | |
| 2859 | + | |
2858 | 2860 | | |
2859 | 2861 | | |
2860 | | - | |
| 2862 | + | |
2861 | 2863 | | |
2862 | 2864 | | |
2863 | 2865 | | |
| |||
2867 | 2869 | | |
2868 | 2870 | | |
2869 | 2871 | | |
2870 | | - | |
| 2872 | + | |
| 2873 | + | |
2871 | 2874 | | |
2872 | 2875 | | |
2873 | 2876 | | |
| |||
0 commit comments