public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Viorel Canja, Softwin" <vcanja@bitdefender.com>
To: linux-kernel@vger.kernel.org
Subject: problem in tcp_v4_synq_add ?
Date: Tue, 9 Mar 2004 13:27:41 +0200	[thread overview]
Message-ID: <684501482.20040309132741@bitdefender.com> (raw)

Hello all,

I was looking through the networking code in 2.6.1 kernel and it seems
to me there could be a problem in tcp_ipv4.c in function tcp_v4_synq_add :

904 static void tcp_v4_synq_add(struct sock *sk, struct open_request *req)
905 {
906         struct tcp_opt *tp = tcp_sk(sk);
907         struct tcp_listen_opt *lopt = tp->listen_opt;
908         u32 h = tcp_v4_synq_hash(req->af.v4_req.rmt_addr, req->rmt_port, lopt->hash_rnd);
909 
910         req->expires = jiffies + TCP_TIMEOUT_INIT;
911         req->retrans = 0;
912         req->sk = NULL;
913         req->dl_next = lopt->syn_table[h];
914 
915         write_lock(&tp->syn_wait_lock);
916         lopt->syn_table[h] = req;
917         write_unlock(&tp->syn_wait_lock);
918 
919         tcp_synq_added(sk);
920 }

Shouldn't  "write_lock(&tp->syn_wait_lock);" be moved before
"req->dl_next = lopt->syn_table[h];" to avoid a race condition ?

I am new to the linux kernel so it is likely that I am missing
something. What am I missing ?

Thanks in advance,
Viorel


             reply	other threads:[~2004-03-09 11:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-09 11:27 Viorel Canja, Softwin [this message]
2004-03-09 19:30 ` problem in tcp_v4_synq_add ? David S. Miller
2004-03-10  9:04   ` Paul Wagland
2004-03-10 11:42     ` Re[2]: " Viorel Canja, Softwin
2004-03-10 21:37     ` David S. 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=684501482.20040309132741@bitdefender.com \
    --to=vcanja@bitdefender.com \
    --cc=linux-kernel@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