lpfc: fix races for miscdevice open vs. rmmod
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 15 Apr 2013 02:39:37 +0000 (22:39 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 29 Apr 2013 19:41:44 +0000 (15:41 -0400)
mind you, I'm not sure WTF would anybody _need_ that miscdevice
at all - no IO is possible for it, opening it only pins the module
down and is seriously racy, at that.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
drivers/scsi/lpfc/lpfc_init.c

index 314b4f61b9e3fc73035fbdf48995e34bb31ed4dc..8b9c191a70198bda139e4f58afe9cec8e0303385 100644 (file)
@@ -10368,36 +10368,6 @@ lpfc_io_resume(struct pci_dev *pdev)
        return;
 }
 
-/**
- * lpfc_mgmt_open - method called when 'lpfcmgmt' is opened from userspace
- * @inode: pointer to the inode representing the lpfcmgmt device
- * @filep: pointer to the file representing the open lpfcmgmt device
- *
- * This routine puts a reference count on the lpfc module whenever the
- * character device is opened
- **/
-static int
-lpfc_mgmt_open(struct inode *inode, struct file *filep)
-{
-       try_module_get(THIS_MODULE);
-       return 0;
-}
-
-/**
- * lpfc_mgmt_release - method called when 'lpfcmgmt' is closed in userspace
- * @inode: pointer to the inode representing the lpfcmgmt device
- * @filep: pointer to the file representing the open lpfcmgmt device
- *
- * This routine removes a reference count from the lpfc module when the
- * character device is closed
- **/
-static int
-lpfc_mgmt_release(struct inode *inode, struct file *filep)
-{
-       module_put(THIS_MODULE);
-       return 0;
-}
-
 static struct pci_device_id lpfc_id_table[] = {
        {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_VIPER,
                PCI_ANY_ID, PCI_ANY_ID, },
@@ -10515,8 +10485,7 @@ static struct pci_driver lpfc_driver = {
 };
 
 static const struct file_operations lpfc_mgmt_fop = {
-       .open = lpfc_mgmt_open,
-       .release = lpfc_mgmt_release,
+       .owner = THIS_MODULE,
 };
 
 static struct miscdevice lpfc_mgmt_dev = {
This page took 0.031486 seconds and 5 git commands to generate.