Re: [patch] Yenta module race condition

From: Jan Kasprzak (kas@informatics.muni.cz)
Date: Thu May 04 2000 - 16:53:23 EST


Linus Torvalds wrote:
:
: No, the right solution (in my opinion) is to
: - link yenta.o and pci_socket.o into _one_ object file (somewhat like the
: other pcmcia object files are packaged together)
: - make the threads increment the module counters on entry, and
: decrement them on exit

        OK, the second try - patch attached. I have named the resulting module
"pci_sockets.o" - feel free to suggest a better name.

        But I think this is still not a clean solution of the problem:
Suppose they are other cardbus bridge drivers than yenta.o -- they all
have to be linked to one object with pci_socket.o. Not very modular, IMHO.

-Yenya

--- linux/drivers/pcmcia/Makefile.orig Thu May 4 23:01:33 2000
+++ linux/drivers/pcmcia/Makefile Thu May 4 23:25:14 2000
@@ -42,7 +42,9 @@
     endif
      ifeq ($(CONFIG_CARDBUS),y)
         CORE_OBJS += cardbus.o
- MX_OBJS += cb_enabler.o yenta.o pci_socket.o
+ MX_OBJS += cb_enabler.o
+ MIX_OBJS += yenta.o pci_socket.o
+ M_OBJS += pci_sockets.o
      endif
   endif
 endif
@@ -51,3 +53,7 @@
 
 pcmcia_core.o: $(CORE_OBJS)
         $(LD) $(LD_RFLAG) -r -o $@ $(CORE_OBJS)
+
+pci_sockets.o: pci_socket.o yenta.o
+ $(LD) $(LD_RFLAG) -r -o $@ pci_socket.o yenta.o
+
--- linux/drivers/pcmcia/yenta.c.orig Thu May 4 14:50:08 2000
+++ linux/drivers/pcmcia/yenta.c Thu May 4 23:01:26 2000
@@ -478,6 +478,7 @@
         DECLARE_WAITQUEUE(wait, current);
 
         daemonize();
+ MOD_INC_USE_COUNT;
         strcpy(current->comm, "CardBus Watcher");
 
         do {
@@ -495,6 +496,7 @@
                         schedule_timeout(HZ);
                 remove_wait_queue(&socket->wait, &wait);
         } while (!signal_pending(current));
+ MOD_DEC_USE_COUNT;
         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:16 EST