reproducible bug in 2.2.19 & 2.4.x

From: Rainer Keller (Keller@hlrs.de)
Date: Fri Sep 28 2001 - 06:38:52 EST


Hi Balazs,

Well, reading & running (on UP, no SIGSEGVs) Your code, I get the
impression, that there might be a small bug in it.

Your while-loop looks like this:
 while (1)
    {
      int newfd;
      int tmplen;
      pthread_t t;
      tmplen = sizeof(sin);
      newfd = accept(fd, (struct sockaddr *) &sin, &tmplen);
      ...
      pthread_create(&t, NULL, thread_func, &newfd);
   }

Now, if the thread_func is not started immediately on Your SMP-machine,
the next iteration of the loop might already have started the accept
with a new file-descriptor, leaving two threads reading on the same fd.

This should be per-thread data.

Just my 2 cents.

Greetings,
raY

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Sep 30 2001 - 21:01:01 EST