History

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

Heiner Kallweit committed 4 years ago

Commit faa4e041 parent 148ca041 file · +4 −6Browse files

Unified · Split

drivers/net/ethernet/realtek/r8169_main.c+4−6
@@ -4190,7 +4190,6 @@ static void rtl8169_tso_csum_v1(struct sk_buff *skb, u32 *opts) · 4189 unmodified lines
41904190 static bool rtl8169_tso_csum_v2(struct rtl8169_private *tp,
41914191 struct sk_buff *skb, u32 *opts)
41924192 {
4193− u32 transport_offset = (u32)skb_transport_offset(skb);
41944193 struct skb_shared_info *shinfo = skb_shinfo(skb);
41954194 u32 mss = shinfo->gso_size;
41964195
@@ -4207,7 +4206,7 @@ static bool rtl8169_tso_csum_v2(struct rtl8169_private *tp, · 10 unmodified lines
42074206 WARN_ON_ONCE(1);
42084207 }
42094208
4210− opts[0] |= transport_offset << GTTCPHO_SHIFT;
4209+ opts[0] |= skb_transport_offset(skb) << GTTCPHO_SHIFT;
42114210 opts[1] |= mss << TD1_MSS_SHIFT;
42124211 } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
42134212 u8 ip_protocol;
@@ -4235,7 +4234,7 @@ static bool rtl8169_tso_csum_v2(struct rtl8169_private *tp, · 21 unmodified lines
42354234 else
42364235 WARN_ON_ONCE(1);
42374236
4238− opts[1] |= transport_offset << TCPHO_SHIFT;
4237+ opts[1] |= skb_transport_offset(skb) << TCPHO_SHIFT;
42394238 } else {
42404239 unsigned int padto = rtl_quirk_packet_padto(tp, skb);
42414240
@@ -4402,14 +4401,13 @@ static netdev_features_t rtl8169_features_check(struct sk_buff *skb, · 160 unmodified lines
44024401 struct net_device *dev,
44034402 netdev_features_t features)
44044403 {
4405− int transport_offset = skb_transport_offset(skb);
44064404 struct rtl8169_private *tp = netdev_priv(dev);
44074405
44084406 if (skb_is_gso(skb)) {
44094407 if (tp->mac_version == RTL_GIGA_MAC_VER_34)
44104408 features = rtl8168evl_fix_tso(skb, features);
44114409
4412− if (transport_offset > GTTCPHO_MAX &&
4410+ if (skb_transport_offset(skb) > GTTCPHO_MAX &&
44134411 rtl_chip_supports_csum_v2(tp))
44144412 features &= ~NETIF_F_ALL_TSO;
44154413 } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
@@ -4420,7 +4418,7 @@ static netdev_features_t rtl8169_features_check(struct sk_buff *skb, · 4 unmodified lines
44204418 if (rtl_quirk_packet_padto(tp, skb))
44214419 features &= ~NETIF_F_CSUM_MASK;
44224420
4423− if (transport_offset > TCPHO_MAX &&
4421+ if (skb_transport_offset(skb) > TCPHO_MAX &&
44244422 rtl_chip_supports_csum_v2(tp))
44254423 features &= ~NETIF_F_CSUM_MASK;
44264424 }