Skip to content

Commit faa4e04

Browse files
hkallweitkuba-moo
authored andcommitted
r8169: fix accessing unset transport header
66e4c8d ("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 bdfa4ed ("r8169: use Giant Send"). [0] https://bugzilla.kernel.org/show_bug.cgi?id=216157 Fixes: 8d520b4 ("r8169: work around RTL8125 UDP hw bug") Reported-by: Erhard F. <[email protected]> Tested-by: Erhard F. <[email protected]> Signed-off-by: Heiner Kallweit <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 148ca04 commit faa4e04

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

drivers/net/ethernet/realtek/r8169_main.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4190,7 +4190,6 @@ static void rtl8169_tso_csum_v1(struct sk_buff *skb, u32 *opts)
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,
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,
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,
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,
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
}

0 commit comments

Comments
 (0)