netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Emelyanov <xemul@parallels.com>
To: David Miller <davem@davemloft.net>,
	Eric Dumazet <eric.dumazet@gmail.com>
Cc: Linux Netdev List <netdev@vger.kernel.org>
Subject: [PATCH 2/3] tcp: Schedule rmem for rcvq repair send
Date: Thu, 10 May 2012 15:50:01 +0400	[thread overview]
Message-ID: <4FABAB69.70401@parallels.com> (raw)
In-Reply-To: <4FABAB39.6090201@parallels.com>

As noted by Eric, no checks are performed on the data size we're
putting in the read queue during repair. Thus, validate the given
data size with the common rmem management routine.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
---
 net/ipv4/tcp_input.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 7c6c99d..164659f 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4769,6 +4769,9 @@ int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size)
 	struct tcphdr *th;
 	bool fragstolen;
 
+	if (tcp_try_rmem_schedule(sk, size + sizeof(*th)))
+		goto err;
+
 	skb = alloc_skb(size + sizeof(*th), sk->sk_allocation);
 	if (!skb)
 		goto err;
-- 
1.5.5.6

  parent reply	other threads:[~2012-05-10 11:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-10 11:49 [PATCH 0/3] tcp: Validate recv queue on repair and related stuff Pavel Emelyanov
2012-05-10 11:49 ` [PATCH 1/3] tcp: Move rcvq sending to tcp_input.c Pavel Emelyanov
2012-05-10 12:00   ` Eric Dumazet
2012-05-11  3:25     ` David Miller
2012-05-10 11:50 ` Pavel Emelyanov [this message]
2012-05-10 12:00   ` [PATCH 2/3] tcp: Schedule rmem for rcvq repair send Eric Dumazet
2012-05-11  3:25     ` David Miller
2012-05-10 11:50 ` [PATCH 3/3] tcp: Out-line tcp_try_rmem_schedule Pavel Emelyanov
2012-05-10 12:00   ` Eric Dumazet
2012-05-11  3:25     ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FABAB69.70401@parallels.com \
    --to=xemul@parallels.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).