From: Greg Kroah-Hartman Date: Mon, 15 Aug 2022 13:14:15 +0000 (+0200) Subject: 4.9-stable patches X-Git-Tag: v5.15.61~50 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0d219a46bf15f926ea5b9423e1ae6b1c28e62d39;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: tcp-fix-over-estimation-in-sk_forced_mem_schedule.patch --- diff --git a/queue-4.9/series b/queue-4.9/series index 0176f8e7d71..acc4354fce6 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -57,3 +57,4 @@ ext4-correct-max_inline_xattr_value_size-computing.patch dm-raid-fix-address-sanitizer-warning-in-raid_status.patch net_sched-cls_route-remove-from-list-when-handle-is-0.patch btrfs-reject-log-replay-if-there-is-unsupported-ro-compat-flag.patch +tcp-fix-over-estimation-in-sk_forced_mem_schedule.patch diff --git a/queue-4.9/tcp-fix-over-estimation-in-sk_forced_mem_schedule.patch b/queue-4.9/tcp-fix-over-estimation-in-sk_forced_mem_schedule.patch new file mode 100644 index 00000000000..8a77db368fb --- /dev/null +++ b/queue-4.9/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 +@@ -2986,11 +2986,12 @@ begin_fwd: + */ + 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); +