public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Race in fs/proc/generic.c:make_inode_number()
@ 2001-04-05  5:14 Tom Leete
  2001-04-05 14:36 ` [PATCH] " Tom Leete
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Leete @ 2001-04-05  5:14 UTC (permalink / raw)
  To: linux-kernel

Hello,

The proc_alloc_map bitfield is unprotected by any lock, and
find_first_zero_bit() is not atomic. Concurrent module loading can race
here.

static unsigned char proc_alloc_map[PROC_NDYNAMIC / 8];

static int make_inode_number(void)
{
	int i = find_first_zero_bit((void *) proc_alloc_map, PROC_NDYNAMIC);
	if (i<0 || i>=PROC_NDYNAMIC) 
		return -1;
	set_bit(i, (void *) proc_alloc_map);
	return PROC_DYNAMIC_FIRST + i;
}

Cheers,
Tom

-- 
The Daemons lurk and are dumb. -- Emerson

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

end of thread, other threads:[~2001-04-06 15:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-04-05  5:14 Race in fs/proc/generic.c:make_inode_number() Tom Leete
2001-04-05 14:36 ` [PATCH] " Tom Leete
2001-04-06 12:01   ` Maneesh Soni
2001-04-06 15:47     ` Tom Leete

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox