r8152: fix accessing unset transport header
Subsystems (4)
PATCH 1/1 r8152: fix accessing unset transport header
A warning is triggered by commit 66e4c8d95008 ("net: warn if transport header was not set"). The warning is harmless, because the value from skb_transport_offset() is only used for skb_is_gso() is true or the skb->ip_summed is equal to CHECKSUM_PARTIAL.
--- drivers/net/usb/r8152.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/usb/r8152.c +7 -7
@@ -2156,7 +2156,7 @@ static inline void rtl_rx_vlan_tag(struct rx_desc *desc, struct sk_buff *skb) }static int r8152_tx_csum (struct r8152 *tp,struct tx_desc *desc, -struct sk_buff *skb,u32 len,u32 transport_offset) +struct sk_buff *skb,u32 len) {u32 mss =skb_shinfo (skb)->gso_size;u32 opts1, opts2 =0 ;
@@ -2167,6 +2167,8 @@ static int r8152_tx_csum(struct r8152 *tp, struct tx_desc *desc, opts1 = len |TX_FS |TX_LS ;if (mss) { +u32 transport_offset = (u32 )skb_transport_offset (skb); +if (transport_offset >GTTCPHO_MAX ) { netif_warn(tp, tx_err, tp->netdev, "Invalid transport offset 0x%x for TSO\n",
@@ -2197,6 +2199,7 @@ static int r8152_tx_csum(struct r8152 *tp, struct tx_desc *desc, opts1 |= transport_offset <<GTTCPHO_SHIFT ; opts2 |=min (mss,MSS_MAX ) <<MSS_SHIFT ; }else if (skb->ip_summed ==CHECKSUM_PARTIAL ) { +u32 transport_offset = (u32 )skb_transport_offset (skb);u8 ip_protocol;if (transport_offset >TCPHO_MAX ) {
@@ -2260,7 +2263,6 @@ static int r8152_tx_agg_fill(struct r8152 *tp, struct tx_agg *agg)struct tx_desc *tx_desc;struct sk_buff *skb;unsigned int len; -u32 offset; skb =__skb_dequeue (&skb_head);if (!skb)
@@ -2276,9 +2278,7 @@ static int r8152_tx_agg_fill(struct r8152 *tp, struct tx_agg *agg) tx_data =tx_agg_align (tx_data); tx_desc = (struct tx_desc *)tx_data; - offset = (u32 )skb_transport_offset (skb); - -if (r8152_tx_csum (tp, tx_desc, skb, skb->len, offset)) { +if (r8152_tx_csum (tp, tx_desc, skb, skb->len)) {r8152_csum_workaround (tp, skb, &skb_head);continue ; }
@@ -2759,9 +2759,9 @@ rtl8152_features_check(struct sk_buff *skb, struct net_device *dev, {u32 mss =skb_shinfo (skb)->gso_size;int max_offset = mss ?GTTCPHO_MAX :TCPHO_MAX ; -int offset =skb_transport_offset (skb); -if ((mss || skb->ip_summed ==CHECKSUM_PARTIAL ) && offset > max_offset) +if ((mss || skb->ip_summed ==CHECKSUM_PARTIAL ) && +skb_transport_offset (skb) > max_offset) features &= ~(NETIF_F_CSUM_MASK |NETIF_F_GSO_MASK );else if ((skb->len +sizeof (struct tx_desc )) > agg_buf_sz) features &= ~NETIF_F_GSO_MASK ;
Signature · 1 line
2.34.3
Paolo Abeni
maintainerQuoted 6 lines · Hayes Wang
A warning is triggered by commit
66e4c8d95008("net: warn if transport header was not set"). The warning is harmless, because the value fromskb_transport_offset()is only used forskb_is_gso()is true or theskb->ip_summedis equal toCHECKSUM_PARTIAL.Signed-off-by Hayes Wang <[email protected]>
If this is targeting the -net tree please add a suitable Fixes tag, thanks!
Paolo
Jakub Kicinski
maintainerQuoted 10 lines · On Tue, 12 Jul 2022 15:06:25 +0200 Paolo Abeni wrote:
Quoted 6 lines · Hayes Wang
A warning is triggered by commit
66e4c8d95008("net: warn if transport header was not set"). The warning is harmless, because the value fromskb_transport_offset()is only used forskb_is_gso()is true or theskb->ip_summedis equal toCHECKSUM_PARTIAL.Signed-off-by Hayes Wang <[email protected]>If this is targeting the -net tree please add a suitable Fixes tag, thanks!
And FWIW I think the fixes tag you want is:
PATCH v2 1/1 r8152: fix accessing unset transport header
In reply to Hayes WangA warning is triggered by commit 66e4c8d95008 ("net: warn if transport header was not set"). The warning is harmless, because the value from skb_transport_offset() is only used for skb_is_gso() is true or the skb->ip_summed is equal to CHECKSUM_PARTIAL.
---
v2:
The warining appears since commit 66e4c8d95008 ("net: warn if transport header was not set"), so add a Fixed tag for referring to it.
drivers/net/usb/r8152.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/usb/r8152.c +7 -7
@@ -2156,7 +2156,7 @@ static inline void rtl_rx_vlan_tag(struct rx_desc *desc, struct sk_buff *skb) }static int r8152_tx_csum (struct r8152 *tp,struct tx_desc *desc, -struct sk_buff *skb,u32 len,u32 transport_offset) +struct sk_buff *skb,u32 len) {u32 mss =skb_shinfo (skb)->gso_size;u32 opts1, opts2 =0 ;
@@ -2167,6 +2167,8 @@ static int r8152_tx_csum(struct r8152 *tp, struct tx_desc *desc, opts1 = len |TX_FS |TX_LS ;if (mss) { +u32 transport_offset = (u32 )skb_transport_offset (skb); +if (transport_offset >GTTCPHO_MAX ) { netif_warn(tp, tx_err, tp->netdev, "Invalid transport offset 0x%x for TSO\n",
@@ -2197,6 +2199,7 @@ static int r8152_tx_csum(struct r8152 *tp, struct tx_desc *desc, opts1 |= transport_offset <<GTTCPHO_SHIFT ; opts2 |=min (mss,MSS_MAX ) <<MSS_SHIFT ; }else if (skb->ip_summed ==CHECKSUM_PARTIAL ) { +u32 transport_offset = (u32 )skb_transport_offset (skb);u8 ip_protocol;if (transport_offset >TCPHO_MAX ) {
@@ -2260,7 +2263,6 @@ static int r8152_tx_agg_fill(struct r8152 *tp, struct tx_agg *agg)struct tx_desc *tx_desc;struct sk_buff *skb;unsigned int len; -u32 offset; skb =__skb_dequeue (&skb_head);if (!skb)
@@ -2276,9 +2278,7 @@ static int r8152_tx_agg_fill(struct r8152 *tp, struct tx_agg *agg) tx_data =tx_agg_align (tx_data); tx_desc = (struct tx_desc *)tx_data; - offset = (u32 )skb_transport_offset (skb); - -if (r8152_tx_csum (tp, tx_desc, skb, skb->len, offset)) { +if (r8152_tx_csum (tp, tx_desc, skb, skb->len)) {r8152_csum_workaround (tp, skb, &skb_head);continue ; }
@@ -2759,9 +2759,9 @@ rtl8152_features_check(struct sk_buff *skb, struct net_device *dev, {u32 mss =skb_shinfo (skb)->gso_size;int max_offset = mss ?GTTCPHO_MAX :TCPHO_MAX ; -int offset =skb_transport_offset (skb); -if ((mss || skb->ip_summed ==CHECKSUM_PARTIAL ) && offset > max_offset) +if ((mss || skb->ip_summed ==CHECKSUM_PARTIAL ) && +skb_transport_offset (skb) > max_offset) features &= ~(NETIF_F_CSUM_MASK |NETIF_F_GSO_MASK );else if ((skb->len +sizeof (struct tx_desc )) > agg_buf_sz) features &= ~NETIF_F_GSO_MASK ;
Signature · 1 line
2.34.3
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:
Quoted 9 lines · On Wed, 13 Jul 2022 11:31:11 +0800 you wrote:
A warning is triggered by commit
66e4c8d95008("net: warn if transport header was not set"). The warning is harmless, because the value fromskb_transport_offset()is only used forskb_is_gso()is true or theskb->ip_summedis equal toCHECKSUM_PARTIAL.Fixes 66e4c8d95008 ("net: warn if transport header was not set")Signed-off-by Hayes Wang <[email protected]>[...]
Here is the summary with links:
- [v2,net] r8152: fix accessing unset transport header
https://git.kernel.org/netdev/net/c/057cc8c9005e
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html