From f167fc2c6012560647e7aca2db2cee10b0dadb57 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 15 Aug 2022 15:14:49 +0200 Subject: [PATCH] 5.4-stable patches added patches: tcp-fix-over-estimation-in-sk_forced_mem_schedule.patch --- queue-5.4/series | 1 + ...estimation-in-sk_forced_mem_schedule.patch | 45 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 queue-5.4/tcp-fix-over-estimation-in-sk_forced_mem_schedule.patch diff --git a/queue-5.4/series b/queue-5.4/series index 6063b5f99f3..bcae8c51ac4 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -283,3 +283,4 @@ btrfs-reject-log-replay-if-there-is-unsupported-ro-compat-flag.patch kvm-add-infrastructure-and-macro-to-mark-vm-as-bugged.patch kvm-x86-check-lapic_in_kernel-before-attempting-to-set-a-synic-irq.patch kvm-x86-avoid-theoretical-null-pointer-dereference-in-kvm_irq_delivery_to_apic_fast.patch +tcp-fix-over-estimation-in-sk_forced_mem_schedule.patch diff --git a/queue-5.4/tcp-fix-over-estimation-in-sk_forced_mem_schedule.patch b/queue-5.4/tcp-fix-over-estimation-in-sk_forced_mem_schedule.patch new file mode 100644 index 00000000000..38e853d1363 --- /dev/null +++ b/queue-5.4/tcp-fix-over-estimation-in-sk_forced_mem_schedule.patch @@ -0,0 +1,45 @@ +From c4ee118561a0f74442439b7b5b486db1ac1ddfeb Mon Sep 17 00:00:00 2001 +From: Eric Dumazet +Date: Tue, 14 Jun 2022 10:17:33 -0700 +Subject: tcp: fix over estimation in sk_forced_mem_schedule() + +From: Eric Dumazet + +commit c4ee118561a0f74442439b7b5b486db1ac1ddfeb upstream. + +sk_forced_mem_schedule() has a bug similar to ones fixed +in commit 7c80b038d23e ("net: fix sk_wmem_schedule() and +sk_rmem_schedule() errors") + +While this bug has little chance to trigger in old kernels, +we need to fix it before the following patch. + +Fixes: d83769a580f1 ("tcp: fix possible deadlock in tcp_send_fin()") +Signed-off-by: Eric Dumazet +Acked-by: Soheil Hassas Yeganeh +Reviewed-by: Shakeel Butt +Reviewed-by: Wei Wang +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + net/ipv4/tcp_output.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/net/ipv4/tcp_output.c ++++ b/net/ipv4/tcp_output.c +@@ -3143,11 +3143,12 @@ void tcp_xmit_retransmit_queue(struct so + */ + void sk_forced_mem_schedule(struct sock *sk, int size) + { +- int amt; ++ int delta, amt; + +- if (size <= sk->sk_forward_alloc) ++ delta = size - sk->sk_forward_alloc; ++ if (delta <= 0) + return; +- amt = sk_mem_pages(size); ++ amt = sk_mem_pages(delta); + sk->sk_forward_alloc += amt * SK_MEM_QUANTUM; + sk_memory_allocated_add(sk, amt); + -- 2.47.3