• Julian Ruess's avatar
    s390/ism: Fix trying to free already-freed IRQ by repeated ism_dev_exit() · 78d0f949
    Julian Ruess authored
    This patch prevents the system from crashing when unloading the ISM module.
    
    How to reproduce: Attach an ISM device and execute 'rmmod ism'.
    
    Error-Log:
    - Trying to free already-free IRQ 0
    - WARNING: CPU: 1 PID: 966 at kernel/irq/manage.c:1890 free_irq+0x140/0x540
    
    After calling ism_dev_exit() for each ISM device in the exit routine,
    pci_unregister_driver() will execute ism_remove() for each ISM device.
    Because ism_remove() also calls ism_dev_exit(),
    free_irq(pci_irq_vector(pdev, 0), ism) is called twice for each ISM
    device. This results in a crash with the error
    'Trying to free already-free IRQ'.
    
    In the exit routine, it is enough to call pci_unregister_driver()
    because it ensures that ism_dev_exit() is called once per
    ISM device.
    
    Cc: <stable@vger.kernel.org> # 6.3+
    Fixes: 89e7d2ba
    
     ("net/ism: Add new API for client registration")
    Reviewed-by: default avatarNiklas Schnelle <schnelle@linux.ibm.com>
    Signed-off-by: default avatarJulian Ruess <julianr@linux.ibm.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    78d0f949
ism_drv.c 19.3 KB