lkml.org 
[lkml]   [2004]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[Bugfix] Set more than 32K pid_max

I found this is a bug in alloc_pidmap(). If one sets
/proc/sys/kernel/pid_max more than 32768, "map" will
increases 1 at (pid from 32767 to 32768)

110: map = pidmap_array + pid / BITS_PER_PAGE;

But at

126: map = next_free_map(map, &max_steps);

"map" will increase 1 again, because offset == 0.

This is not correct, but only happens when pid_max > 32k.



--- pid.c.old 2004-01-05 14:53:03.000000000 +0800
+++ pid.c 2004-01-05 17:27:53.000000000 +0800
@@ -122,6 +122,8 @@
}

if (!offset || !atomic_read(&map->nr_free)) {
+ if (!offset)
+ map--;
next_map:
map = next_free_map(map, &max_steps);
if (!map)

--
-----------------------------------------------------------------
Opinions expressed are those of the author and do not represent
Intel Corp.
Zhu Yi (Chuyee)

GnuPG v1.0.6 (GNU/Linux)
http://cn.geocities.com/chewie_chuyee/gpg.txt or
$ gpg --keyserver wwwkeys.pgp.net --recv-keys 71C34820
1024D/71C34820 C939 2B0B FBCE 1D51 109A 55E5 8650 DB90 71C3 4820

-
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/

\
 
 \ /
  Last update: 2005-03-22 13:59    [W:0.093 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site