The patch titled Char: sx, lock boards struct has been added to the -mm tree. Its filename is char-sx-lock-boards-struct.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: Char: sx, lock boards struct From: Jiri Slaby <jirislaby@xxxxxxxxx> Fix race condition which may occurs when multiple cards are probed at the same time. Add mutex to critical sections to avoid this situation. Signed-off-by: Jiri Slaby <jirislaby@xxxxxxxxx> Cc: Alan Cox <alan@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- drivers/char/sx.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff -puN drivers/char/sx.c~char-sx-lock-boards-struct drivers/char/sx.c --- a/drivers/char/sx.c~char-sx-lock-boards-struct +++ a/drivers/char/sx.c @@ -298,6 +298,7 @@ static int sx_init_drivers(void); static struct tty_driver *sx_driver; +static DEFINE_MUTEX(sx_boards_lock); static struct sx_board boards[SX_NBOARDS]; static struct sx_port *sx_ports; static int sx_initialized; @@ -1980,7 +1981,6 @@ static int sx_init_board (struct sx_boar } if (chans) { - /* board->flags |= SX_BOARD_PRESENT; */ if(board->irq > 0) { /* fixed irq, probably PCI */ if(sx_irqmask & (1 << board->irq)) { /* may we use this irq? */ @@ -2115,8 +2115,6 @@ static int __devinit probe_sx (struct sx return 0; sx_dprintk (SX_DEBUG_INIT, "reset the board...\n"); - board->flags |= SX_BOARD_PRESENT; - func_exit(); return 1; } @@ -2211,8 +2209,6 @@ static int __devinit probe_si (struct sx return 0; sx_dprintk (SX_DEBUG_INIT, "reset the board...\n"); - board->flags |= SX_BOARD_PRESENT; - func_exit(); return 1; } @@ -2396,10 +2392,15 @@ static int __devinit sx_eisa_probe(struc unsigned int i; int retval = -EIO; + mutex_lock(&sx_boards_lock); i = sx_find_free_board(); - - if (i == SX_NBOARDS) + if (i == SX_NBOARDS) { + mutex_unlock(&sx_boards_lock); goto err; + } + board = &boards[i]; + board->flags |= SX_BOARD_PRESENT; + mutex_unlock(&sx_boards_lock); dev_info(dev, "XIO : Signature found in EISA slot %lu, " "Product %d Rev %d (REPORT THIS TO LKLM)\n", @@ -2407,7 +2408,6 @@ static int __devinit sx_eisa_probe(struc inb(eisa_slot + EISA_VENDOR_ID_OFFSET + 2), inb(eisa_slot + EISA_VENDOR_ID_OFFSET + 3)); - board = &boards[i]; board->eisa_base = eisa_slot; board->flags &= ~SX_BOARD_TYPE; board->flags |= SI_EISA_BOARD; @@ -2430,6 +2430,7 @@ static int __devinit sx_eisa_probe(struc return 0; err_unmap: iounmap(board->base); + board->flags &= ~SX_BOARD_PRESENT; err: return retval; } @@ -2498,16 +2499,19 @@ static int __devinit sx_pci_probe(struct unsigned int i; int retval = -EIO; + mutex_lock(&sx_boards_lock); i = sx_find_free_board(); - - if (i == SX_NBOARDS) + if (i == SX_NBOARDS) { + mutex_unlock(&sx_boards_lock); goto err; + } + board = &boards[i]; + board->flags |= SX_BOARD_PRESENT; + mutex_unlock(&sx_boards_lock); retval = pci_enable_device(pdev); if (retval) - goto err; - - board = &boards[i]; + goto err_flag; board->flags &= ~SX_BOARD_TYPE; board->flags |= (pdev->subsystem_vendor == 0x200) ? SX_PCI_BOARD : @@ -2522,7 +2526,7 @@ static int __devinit sx_pci_probe(struct board->base = ioremap(board->hw_base, WINDOW_LEN (board)); if (!board->base) { dev_err(&pdev->dev, "ioremap failed\n"); - goto err; + goto err_flag; } /* Most of the stuff on the CF board is offset by 0x18000 .... */ @@ -2546,6 +2550,8 @@ static int __devinit sx_pci_probe(struct return 0; err_unmap: iounmap(board->base2); +err_flag: + board->flags &= ~SX_BOARD_PRESENT; err: return retval; } @@ -2611,6 +2617,7 @@ static int __init sx_init(void) board->irq = sx_irqmask?-1:0; if (probe_sx (board)) { + board->flags |= SX_BOARD_PRESENT; found++; } else { iounmap(board->base); @@ -2627,6 +2634,7 @@ static int __init sx_init(void) board->irq = sx_irqmask ?-1:0; if (probe_si (board)) { + board->flags |= SX_BOARD_PRESENT; found++; } else { iounmap (board->base); @@ -2642,6 +2650,7 @@ static int __init sx_init(void) board->irq = sx_irqmask ?-1:0; if (probe_si (board)) { + board->flags |= SX_BOARD_PRESENT; found++; } else { iounmap (board->base); _ Patches currently in -mm which might be from jirislaby@xxxxxxxxx are mxser-correct-tty-driver-name.patch pci-mxser-pci-refcounts.patch mxser-make-an-experimental-clone.patch char-mxser_new-correct-include-file.patch char-mxser_new-upgrade-to-191.patch char-mxser_new-rework-to-allow-dynamic-structs.patch char-mxser_new-use-__devinit-macros.patch char-mxser_new-pci_request_region-for-pci-regions.patch char-mxser_new-check-request_region-retvals.patch char-mxser_new-kill-unneeded-memsets.patch char-mxser_new-revert-spin_lock-changes.patch char-mxser_new-remove-request-for-testers-line.patch char-mxser_new-debug-printk-dependent-on-debug.patch char-mxser_new-alter-license-terms.patch char-mxser_new-code-upside-down.patch char-mxser_new-cmspar-is-defined.patch char-remove-unneded-termbits-redefinitions-mxser_new.patch char-mxser_new-eliminate-tty-ldisc-deref.patch char-mxser_new-testbit-for-bit-testing.patch char-mxser_new-correct-fail-paths.patch char-mxser_new-dont-check-tty_unregister-retval.patch char-mxser_new-compress-isa-finding.patch char-mxser_new-register-tty-devices-on-the-fly.patch char-mxser_new-compact-structures-round2.patch char-mxser_new-reverse-if-else-paths-patch.patch char-mxser_new-comments-cleanup.patch char-mxser_new-correct-intr-handler-proto.patch char-mxser_new-delete-ttys-and-termios.patch char-mxser_new-pci-probing.patch char-mxser_new-clean-macros.patch maintainers-add-me-to-isicom-mxser.patch mxser_new-correct-tty-driver-name.patch char-stallion-use-pr_debug-macro.patch char-stallion-remove-unneeded-casts.patch char-stallion-kill-typedefs.patch char-stallion-move-init-deinit.patch char-stallion-uninline-functions.patch char-stallion-mark-functions-as-init.patch char-stallion-remove-many-prototypes.patch char-isicom-expand-function.patch char-isicom-rename-init-function.patch char-isicom-remove-isa-code.patch char-isicom-remove-unneeded-memset.patch char-isicom-move-to-tty_register_device.patch char-isicom-use-pci_request_region.patch char-isicom-check-kmalloc-retval.patch char-isicom-use-completion.patch char-isicom-simplify-timer.patch char-isicom-remove-cvs-stuff.patch char-isicom-fix-tty-index-check.patch char-sx-convert-to-pci-probing.patch char-sx-use-kcalloc.patch char-sx-mark-functions-as-devinit.patch char-sx-use-eisa-probing.patch char-sx-ifdef-isa-code.patch char-sx-lock-boards-struct.patch char-sx-remove-duplicite-code.patch char-sx-whitespace-cleanup.patch char-sx-remove-unneeded-stuff.patch char-sx-simplify-timer-logic.patch char-sx-fix-return-in-module-init.patch char-sx-use-pci_iomap.patch char-sx-request-regions.patch char-stallion-convert-to-pci-probing.patch char-stallion-prints-cleanup.patch char-stallion-implement-fail-paths.patch char-stallion-correct-__init-macros.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html