lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080415.202740.114756353.davem@davemloft.net>
Date:	Tue, 15 Apr 2008 20:27:40 -0700 (PDT)
From:	David Miller <davem@...emloft.net>
To:	vgusev@...nvz.org
Cc:	andi@...stfloor.org, kuznet@....inr.ac.ru, netdev@...r.kernel.org
Subject: Re: [PATCH] Discard tcp out-of-order queue if system limit is
 reached

From: Vitaliy Gusev <vgusev@...nvz.org>
Date: Tue, 15 Apr 2008 18:54:44 +0400

> tcp_prune_queue() doesn't prune an out-of-order queue if socket
> is under rcvbuf. However even if socket is under rcvbuf but system-wide limit is
> reached then skb cannot be queued. It can lead to deadlock situation as any skb that
> fills sequence hole is dropped.
> So discard out-of-order queue if system-wide limit is reached.
> 
> Signed-off-by: Vitaliy Gusev <vgusev@...nvz.org>

I applied your original patch already, so I added the following
relative patch.

Please provide relative fixup patches when I say that I've applied
your patch already.

Thank you.

commit 56f367bbfd5a7439961499ca6a2f0822d2074d83
Author: Vitaliy Gusev <vgusev@...nvz.org>
Date:   Tue Apr 15 20:26:34 2008 -0700

    [TCP]: Add return value indication to tcp_prune_ofo_queue().
    
    Returns non-zero if tp->out_of_order_queue was seen non-empty.
    This allows tcp_try_rmem_schedule() to return early.
    
    Signed-off-by: Vitaliy Gusev <vgusev@...nvz.org>
    Signed-off-by: David S. Miller <davem@...emloft.net>

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 61db7b1..bbb7d88 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3841,7 +3841,7 @@ static void tcp_ofo_queue(struct sock *sk)
 	}
 }
 
-static void tcp_prune_ofo_queue(struct sock *sk);
+static int tcp_prune_ofo_queue(struct sock *sk);
 static int tcp_prune_queue(struct sock *sk);
 
 static inline int tcp_try_rmem_schedule(struct sock *sk, unsigned int size)
@@ -3853,7 +3853,9 @@ static inline int tcp_try_rmem_schedule(struct sock *sk, unsigned int size)
 			return -1;
 
 		if (!sk_rmem_schedule(sk, size)) {
-			tcp_prune_ofo_queue(sk);
+			if (!tcp_prune_ofo_queue(sk))
+				return -1;
+
 			if (!sk_rmem_schedule(sk, size))
 				return -1;
 		}
@@ -4211,10 +4213,12 @@ static void tcp_collapse_ofo_queue(struct sock *sk)
 
 /*
  * Purge the out-of-order queue.
+ * Return true if queue was pruned.
  */
-static void tcp_prune_ofo_queue(struct sock *sk)
+static int tcp_prune_ofo_queue(struct sock *sk)
 {
 	struct tcp_sock *tp = tcp_sk(sk);
+	int res = 0;
 
 	if (!skb_queue_empty(&tp->out_of_order_queue)) {
 		NET_INC_STATS_BH(LINUX_MIB_OFOPRUNED);
@@ -4228,7 +4232,9 @@ static void tcp_prune_ofo_queue(struct sock *sk)
 		if (tp->rx_opt.sack_ok)
 			tcp_sack_reset(&tp->rx_opt);
 		sk_mem_reclaim(sk);
+		res = 1;
 	}
+	return res;
 }
 
 /* Reduce allocated memory if we can, trying to get
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ