Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

r8169: fix accessing unset transport header

66e4c8d95008 ("net: warn if transport header was not set") added
a check that triggers a warning in r8169, see [0].

The commit referenced in the Fixes tag refers to the change from
which the patch applies cleanly, there's nothing wrong with this
commit. It seems the actual issue (not bug, because the warning
is harmless here) was introduced with bdfa4ed68187
("r8169: use Giant Send").

[0] https://bugzilla.kernel.org/show_bug.cgi?id=216157

Fixes: 8d520b4de3ed ("r8169: work around RTL8125 UDP hw bug")
Reported-by: Erhard F. <erhard_f@mailbox.org>
Tested-by: Erhard F. <erhard_f@mailbox.org>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/1b2c2b29-3dc0-f7b6-5694-97ec526d51a0@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Heiner Kallweit and committed by
Jakub Kicinski
faa4e04e 148ca045

+4 -6
+4 -6
drivers/net/ethernet/realtek/r8169_main.c
··· 4190 4190 static bool rtl8169_tso_csum_v2(struct rtl8169_private *tp, 4191 4191 struct sk_buff *skb, u32 *opts) 4192 4192 { 4193 - u32 transport_offset = (u32)skb_transport_offset(skb); 4194 4193 struct skb_shared_info *shinfo = skb_shinfo(skb); 4195 4194 u32 mss = shinfo->gso_size; 4196 4195 ··· 4206 4207 WARN_ON_ONCE(1); 4207 4208 } 4208 4209 4209 - opts[0] |= transport_offset << GTTCPHO_SHIFT; 4210 + opts[0] |= skb_transport_offset(skb) << GTTCPHO_SHIFT; 4210 4211 opts[1] |= mss << TD1_MSS_SHIFT; 4211 4212 } else if (skb->ip_summed == CHECKSUM_PARTIAL) { 4212 4213 u8 ip_protocol; ··· 4234 4235 else 4235 4236 WARN_ON_ONCE(1); 4236 4237 4237 - opts[1] |= transport_offset << TCPHO_SHIFT; 4238 + opts[1] |= skb_transport_offset(skb) << TCPHO_SHIFT; 4238 4239 } else { 4239 4240 unsigned int padto = rtl_quirk_packet_padto(tp, skb); 4240 4241 ··· 4401 4402 struct net_device *dev, 4402 4403 netdev_features_t features) 4403 4404 { 4404 - int transport_offset = skb_transport_offset(skb); 4405 4405 struct rtl8169_private *tp = netdev_priv(dev); 4406 4406 4407 4407 if (skb_is_gso(skb)) { 4408 4408 if (tp->mac_version == RTL_GIGA_MAC_VER_34) 4409 4409 features = rtl8168evl_fix_tso(skb, features); 4410 4410 4411 - if (transport_offset > GTTCPHO_MAX && 4411 + if (skb_transport_offset(skb) > GTTCPHO_MAX && 4412 4412 rtl_chip_supports_csum_v2(tp)) 4413 4413 features &= ~NETIF_F_ALL_TSO; 4414 4414 } else if (skb->ip_summed == CHECKSUM_PARTIAL) { ··· 4418 4420 if (rtl_quirk_packet_padto(tp, skb)) 4419 4421 features &= ~NETIF_F_CSUM_MASK; 4420 4422 4421 - if (transport_offset > TCPHO_MAX && 4423 + if (skb_transport_offset(skb) > TCPHO_MAX && 4422 4424 rtl_chip_supports_csum_v2(tp)) 4423 4425 features &= ~NETIF_F_CSUM_MASK; 4424 4426 }