lkml.org 
[lkml]   [2000]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch] 2.3.99-pre3: xd_open race
Folks,

Here is a patch to close a race condition in xd_open. We drop the kernel
lock when sleeping, so we have to call MOD_INC_USE_COUNT _first_, to avoid
being unloaded.

There are _lots_ and _lots_ of places in the kernel that do this wrong. I
have a huge list here.

Maintainers -- check your code for this kind of stuff!

Tim.
*/

--- linux/drivers/block/xd.c~ Mon Feb 21 21:38:51 2000
+++ linux/drivers/block/xd.c Mon Mar 27 19:50:50 2000
@@ -258,12 +258,10 @@ static int xd_open (struct inode *inode,
int dev = DEVICE_NR(inode->i_rdev);

if (dev < xd_drives) {
+ MOD_INC_USE_COUNT;
+
while (!xd_valid[dev])
sleep_on(&xd_wait_open);
-
-#ifdef MODULE
- MOD_INC_USE_COUNT;
-#endif /* MODULE */

xd_access[dev]++;


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

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