]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/scsi/3w-9xxx.c
libertas: make lbs_ibss_join_existing() return error code on rates overflow
[mirror_ubuntu-bionic-kernel.git] / drivers / scsi / 3w-9xxx.c
index 00e7968a1d70f6b120aa0309087d196f77f5f145..dd342207095af001581bce325583e0c991339d45 100644 (file)
@@ -886,6 +886,11 @@ static int twa_chrdev_open(struct inode *inode, struct file *file)
        unsigned int minor_number;
        int retval = TW_IOCTL_ERROR_OS_ENODEV;
 
+       if (!capable(CAP_SYS_ADMIN)) {
+               retval = -EACCES;
+               goto out;
+       }
+
        minor_number = iminor(inode);
        if (minor_number >= twa_device_extension_count)
                goto out;
@@ -2037,6 +2042,7 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
 
        if (twa_initialize_device_extension(tw_dev)) {
                TW_PRINTK(tw_dev->host, TW_DRIVER, 0x25, "Failed to initialize device extension");
+               retval = -ENOMEM;
                goto out_free_device_extension;
        }
 
@@ -2059,6 +2065,7 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
        tw_dev->base_addr = ioremap(mem_addr, mem_len);
        if (!tw_dev->base_addr) {
                TW_PRINTK(tw_dev->host, TW_DRIVER, 0x35, "Failed to ioremap");
+               retval = -ENOMEM;
                goto out_release_mem_region;
        }
 
@@ -2066,8 +2073,10 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
        TW_DISABLE_INTERRUPTS(tw_dev);
 
        /* Initialize the card */
-       if (twa_reset_sequence(tw_dev, 0))
+       if (twa_reset_sequence(tw_dev, 0)) {
+               retval = -ENOMEM;
                goto out_iounmap;
+       }
 
        /* Set host specific parameters */
        if ((pdev->device == PCI_DEVICE_ID_3WARE_9650SE) ||