netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* TCP minisock tcp_create_openreq_child() typo?
@ 2007-02-28 11:03 KOVACS Krisztian
  2007-02-28 12:10 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: KOVACS Krisztian @ 2007-02-28 11:03 UTC (permalink / raw)
  To: netdev


  Hi,

  While reading TCP minisock code I've found this suspiciously looking
code fragment:

- 8< -
struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req, struct sk_buff *skb)
{
	struct sock *newsk = inet_csk_clone(sk, req, GFP_ATOMIC);

	if (newsk != NULL) {
		const struct inet_request_sock *ireq = inet_rsk(req);
		struct tcp_request_sock *treq = tcp_rsk(req);
		struct inet_connection_sock *newicsk = inet_csk(sk);
		struct tcp_sock *newtp;
- 8< -

  The above code initializes newicsk to inet_csk(sk), isn't that supposed
to be inet_csk(newsk)?  As far as I can tell this might leave
icsk_ack.last_seg_size zero even if we do have received data.

-- 
 Regards,
  Krisztian Kovacs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: TCP minisock tcp_create_openreq_child() typo?
  2007-02-28 11:03 TCP minisock tcp_create_openreq_child() typo? KOVACS Krisztian
@ 2007-02-28 12:10 ` Arnaldo Carvalho de Melo
  2007-02-28 19:06   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2007-02-28 12:10 UTC (permalink / raw)
  To: KOVACS Krisztian; +Cc: netdev

[-- Attachment #1: Type: text/plain, Size: 985 bytes --]

On 2/28/07, KOVACS Krisztian <hidden@balabit.hu> wrote:
>
>   Hi,
>
>   While reading TCP minisock code I've found this suspiciously looking
> code fragment:
>
> - 8< -
> struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req, struct sk_buff *skb)
> {
>         struct sock *newsk = inet_csk_clone(sk, req, GFP_ATOMIC);
>
>         if (newsk != NULL) {
>                 const struct inet_request_sock *ireq = inet_rsk(req);
>                 struct tcp_request_sock *treq = tcp_rsk(req);
>                 struct inet_connection_sock *newicsk = inet_csk(sk);
>                 struct tcp_sock *newtp;
> - 8< -
>
>   The above code initializes newicsk to inet_csk(sk), isn't that supposed
> to be inet_csk(newsk)?  As far as I can tell this might leave
> icsk_ack.last_seg_size zero even if we do have received data.

Good catch!

David, please apply the attached patch.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Thanks Krisztian!

- Arnaldo

[-- Attachment #2: newicsk.patch --]
[-- Type: text/x-patch, Size: 559 bytes --]

diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 30b1e52..6b5c64f 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -381,7 +381,7 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req,
 	if (newsk != NULL) {
 		const struct inet_request_sock *ireq = inet_rsk(req);
 		struct tcp_request_sock *treq = tcp_rsk(req);
-		struct inet_connection_sock *newicsk = inet_csk(sk);
+		struct inet_connection_sock *newicsk = inet_csk(newsk);
 		struct tcp_sock *newtp;
 
 		/* Now setup tcp_sock */

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: TCP minisock tcp_create_openreq_child() typo?
  2007-02-28 12:10 ` Arnaldo Carvalho de Melo
@ 2007-02-28 19:06   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2007-02-28 19:06 UTC (permalink / raw)
  To: acme; +Cc: hidden, netdev

From: "Arnaldo Carvalho de Melo" <acme@ghostprotocols.net>
Date: Wed, 28 Feb 2007 09:10:10 -0300

> On 2/28/07, KOVACS Krisztian <hidden@balabit.hu> wrote:
> >
> >   Hi,
> >
> >   While reading TCP minisock code I've found this suspiciously looking
> > code fragment:
> >
> > - 8< -
> > struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req, struct sk_buff *skb)
> > {
> >         struct sock *newsk = inet_csk_clone(sk, req, GFP_ATOMIC);
> >
> >         if (newsk != NULL) {
> >                 const struct inet_request_sock *ireq = inet_rsk(req);
> >                 struct tcp_request_sock *treq = tcp_rsk(req);
> >                 struct inet_connection_sock *newicsk = inet_csk(sk);
> >                 struct tcp_sock *newtp;
> > - 8< -
> >
> >   The above code initializes newicsk to inet_csk(sk), isn't that supposed
> > to be inet_csk(newsk)?  As far as I can tell this might leave
> > icsk_ack.last_seg_size zero even if we do have received data.
> 
> Good catch!
> 
> David, please apply the attached patch.
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Applied, thanks everyone.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-02-28 19:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-28 11:03 TCP minisock tcp_create_openreq_child() typo? KOVACS Krisztian
2007-02-28 12:10 ` Arnaldo Carvalho de Melo
2007-02-28 19:06   ` David Miller

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).