Messages in this thread Patch in this message | ![/](/images/icornerl.gif) | | Date | Mon, 27 Mar 2000 19:54:01 +0100 (BST) | From | Tim Waugh <> | 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/
| ![\](/images/icornerr.gif) |