• Russell King's avatar
    [PCMCIA] Fix deadlocks caused between PCMCIA card fix and device model · 1d921834
    Russell King authored
    The problem was that the semaphore which prevents ds interfering with
    the sleepy card initialisation (skt_sem in pccardd) is blocking insmod
    of the socket driver.  However, the socket driver is being called with
    the PCI bus semaphore held by the driver model.
    
    pccardd in turn discovered a cardbus card (with skt_sem held), so it
    is trying to add the PCI devices to the PCI bus, and this requires the
    driver model to grab the PCI bus semaphore, but its already locked.
    
    We move the class device register into pccardd so we get a natural
    ordering between the ds socket initialisation and pccardd trying to
    detect inserted cards.
    
    We also fix a potential use-after-free caused by rmmod'ing the socket
    driver before ds has shut down.
    1d921834
cs.c 70.2 KB