From: Greg Kroah-Hartman Date: Wed, 12 Mar 2025 08:13:18 +0000 (+0100) Subject: fix up build warnings in queue-5.10/udp-gso-do-not-drop-small-packets-when-pmtu-reduc... X-Git-Tag: v5.4.291~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1e9be72272f043c3d1048632a7ef72baf3a429a8;p=thirdparty%2Fkernel%2Fstable-queue.git fix up build warnings in queue-5.10/udp-gso-do-not-drop-small-packets-when-pmtu-reduces.patch --- diff --git a/queue-5.10/udp-gso-do-not-drop-small-packets-when-pmtu-reduces.patch b/queue-5.10/udp-gso-do-not-drop-small-packets-when-pmtu-reduces.patch index f0a5c84707..542398891c 100644 --- a/queue-5.10/udp-gso-do-not-drop-small-packets-when-pmtu-reduces.patch +++ b/queue-5.10/udp-gso-do-not-drop-small-packets-when-pmtu-reduces.patch @@ -27,52 +27,45 @@ Reviewed-by: Willem de Bruijn Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- - net/ipv4/udp.c | 4 ++-- - net/ipv6/udp.c | 4 ++-- - tools/testing/selftests/net/udpgso.c | 26 ++++++++++++++++++++++++++ + net/ipv4/udp.c | 4 ++-- + net/ipv6/udp.c | 4 ++-- + tools/testing/selftests/net/udpgso.c | 26 ++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 4 deletions(-) -diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c -index 6ad25dc9710c1..b801759147a68 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c -@@ -923,9 +923,9 @@ static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4, +@@ -923,9 +923,9 @@ static int udp_send_skb(struct sk_buff * const int hlen = skb_network_header_len(skb) + sizeof(struct udphdr); - if (hlen + cork->gso_size > cork->fragsize) { -+ if (hlen + min(datalen, cork->gso_size) > cork->fragsize) { ++ if (hlen + min_t(int, datalen, cork->gso_size) > cork->fragsize) { kfree_skb(skb); - return -EINVAL; + return -EMSGSIZE; } if (datalen > cork->gso_size * UDP_MAX_SEGMENTS) { kfree_skb(skb); -diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c -index 203a6d64d7e99..224339c3d831d 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c -@@ -1210,9 +1210,9 @@ static int udp_v6_send_skb(struct sk_buff *skb, struct flowi6 *fl6, +@@ -1210,9 +1210,9 @@ static int udp_v6_send_skb(struct sk_buf const int hlen = skb_network_header_len(skb) + sizeof(struct udphdr); - if (hlen + cork->gso_size > cork->fragsize) { -+ if (hlen + min(datalen, cork->gso_size) > cork->fragsize) { ++ if (hlen + min_t(int, datalen, cork->gso_size) > cork->fragsize) { kfree_skb(skb); - return -EINVAL; + return -EMSGSIZE; } if (datalen > cork->gso_size * UDP_MAX_SEGMENTS) { kfree_skb(skb); -diff --git a/tools/testing/selftests/net/udpgso.c b/tools/testing/selftests/net/udpgso.c -index 7badaf215de28..0e137182a4f40 100644 --- a/tools/testing/selftests/net/udpgso.c +++ b/tools/testing/selftests/net/udpgso.c -@@ -94,6 +94,19 @@ struct testcase testcases_v4[] = { - .gso_len = CONST_MSS_V4, +@@ -95,6 +95,19 @@ struct testcase testcases_v4[] = { .r_num_mss = 1, }, -+ { + { + /* datalen <= MSS < gso_len: will fall back to no GSO */ + .tlen = CONST_MSS_V4, + .gso_len = CONST_MSS_V4 + 1, @@ -85,14 +78,14 @@ index 7badaf215de28..0e137182a4f40 100644 + .gso_len = CONST_MSS_V4 + 2, + .tfail = true, + }, - { ++ { /* send a single MSS + 1B */ .tlen = CONST_MSS_V4 + 1, -@@ -197,6 +210,19 @@ struct testcase testcases_v6[] = { - .gso_len = CONST_MSS_V6, + .gso_len = CONST_MSS_V4, +@@ -198,6 +211,19 @@ struct testcase testcases_v6[] = { .r_num_mss = 1, }, -+ { + { + /* datalen <= MSS < gso_len: will fall back to no GSO */ + .tlen = CONST_MSS_V6, + .gso_len = CONST_MSS_V6 + 1, @@ -105,9 +98,7 @@ index 7badaf215de28..0e137182a4f40 100644 + .gso_len = CONST_MSS_V6 + 2, + .tfail = true + }, - { ++ { /* send a single MSS + 1B */ .tlen = CONST_MSS_V6 + 1, --- -2.39.5 - + .gso_len = CONST_MSS_V6,