[patch] Yenta module race condition

From: Jan Kasprzak (kas@informatics.muni.cz)
Date: Thu May 04 2000 - 08:31:00 EST


        Hello,

        while trying to make my Compaq Armada cardbus bridge working
under the 2.3.x kernel (in 2.2.x works flawlessly) I have found
the following problem: When the pci_socket.o module is being unloaded,
the kernel oopses in yenta.o - the CardBus Watcher processes are not
properly terminated on socket close.

        I have created the following patch to yenta.c, which tries
to terminate its kernel threads when the socket is about to close.
I am not sure whether the socket->private is the appropriate part
of the pci_socket_t structure to put the thread PID in.

        Linus, please apply this patch.

-Yenya

--- linux/drivers/pcmcia/yenta.c.orig Thu May 4 13:04:42 2000
+++ linux/drivers/pcmcia/yenta.c Thu May 4 14:34:57 2000
@@ -722,6 +722,8 @@
  */
 static void yenta_close(pci_socket_t *sock)
 {
+ kill_proc(sock->private[7], SIGTERM, 0);
+ schedule();
         if (sock->cb_irq)
                 free_irq(sock->cb_irq, sock);
         if (sock->base)
@@ -830,7 +832,8 @@
         /* Figure out what the dang thing can do for the PCMCIA layer... */
         yenta_get_socket_capabilities(socket, isa_interrupts);
 
- kernel_thread(yenta_socket_thread, socket, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
+ socket->private[7] = kernel_thread(yenta_socket_thread, socket,
+ CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
         printk("Socket status: %08x\n", cb_readl(socket, CB_SOCKET_STATE));
         return 0;
 }
        

-- 
\ Jan "Yenya" Kasprzak <kas at fi.muni.cz>       http://www.fi.muni.cz/~kas/
\\ PGP: finger kas at aisa.fi.muni.cz   0D99A7FB206605D7 8B35FCDE05B18A5E //
\\\             Czech Linux Homepage:  http://www.linux.cz/              ///
\\\\ I could be wrong, of course. But I'm never wrong.           -Linus ////

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



This archive was generated by hypermail 2b29 : Sun May 07 2000 - 21:00:14 EST