All of lore.kernel.org
 help / color / mirror / Atom feed
* A possible bug in reqsk_queue_hash_req()
@ 2010-04-20 10:35 Li Yu
  2010-04-20 11:06 ` Eric Dumazet
  0 siblings, 1 reply; 5+ messages in thread
From: Li Yu @ 2010-04-20 10:35 UTC (permalink / raw)
  To: netdev; +Cc: linux-kernel

Hi,

     I found out a possible bug in reqsk_queue_hash_req(), it seem
that we should move "req->dl_next = lopt->syn_table[hash];" statement
into follow write lock protected scope.

     As I browsed source code, this function only can be call at rx
code path which is protected a spin lock over struct sock , but its
caller (  inet_csk_reqsk_queue_hash_add() ) is a GPL exported symbol,
so I think that we'd best move this statement into below write lock
protected scope.

     Below is the patch to play this change, please do not apply it on
source code, it's just for show.

    Thanks.

Yu

--- include/net/request_sock.h  2010-04-09 15:27:14.000000000 +0800
+++ include/net/request_sock.h        2010-04-20 18:11:32.000000000 +0800
@@ -247,9 +247,9 @@ static inline void reqsk_queue_hash_req(
        req->expires = jiffies + timeout;
        req->retrans = 0;
        req->sk = NULL;
-       req->dl_next = lopt->syn_table[hash];

        write_lock(&queue->syn_wait_lock);
+       req->dl_next = lopt->syn_table[hash];
        lopt->syn_table[hash] = req;
        write_unlock(&queue->syn_wait_lock);
 }

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

end of thread, other threads:[~2010-04-21  2:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-20 10:35 A possible bug in reqsk_queue_hash_req() Li Yu
2010-04-20 11:06 ` Eric Dumazet
2010-04-20 21:24   ` David Miller
2010-04-20 21:29     ` Eric Dumazet
     [not found]   ` <u2m9b948ee41004200621zf829996y813c37c5f6a3691f@mail.gmail.com>
     [not found]     ` <1271775681.7895.21.camel@edumazet-laptop>
2010-04-21  2:02       ` Li Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.