mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-11 16:29:05 +00:00
[SCSI] SCSI megaraid_sas: handle thrown errors
- handle clear_user() error - handle and properly unwind from sysfs errors thrown during mod init - adjust order of calls in megasas_exit() to precisely match registration order in megasas_init() Signed-off-by: Jeff Garzik <jeff@garzik.org> Updated for extra attribute and Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
This commit is contained in:
parent
bb0766204c
commit
83aabc1be5
@ -2864,7 +2864,8 @@ static int megasas_mgmt_compat_ioctl_fw(struct file *file, unsigned long arg)
|
||||
int i;
|
||||
int error = 0;
|
||||
|
||||
clear_user(ioc, sizeof(*ioc));
|
||||
if (clear_user(ioc, sizeof(*ioc)))
|
||||
return -EFAULT;
|
||||
|
||||
if (copy_in_user(&ioc->host_no, &cioc->host_no, sizeof(u16)) ||
|
||||
copy_in_user(&ioc->sgl_off, &cioc->sgl_off, sizeof(u32)) ||
|
||||
@ -3010,16 +3011,33 @@ static int __init megasas_init(void)
|
||||
|
||||
if (rval) {
|
||||
printk(KERN_DEBUG "megasas: PCI hotplug regisration failed \n");
|
||||
unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl");
|
||||
goto err_pcidrv;
|
||||
}
|
||||
|
||||
driver_create_file(&megasas_pci_driver.driver, &driver_attr_version);
|
||||
driver_create_file(&megasas_pci_driver.driver,
|
||||
&driver_attr_release_date);
|
||||
driver_create_file(&megasas_pci_driver.driver,
|
||||
&driver_attr_dbg_lvl);
|
||||
rval = driver_create_file(&megasas_pci_driver.driver,
|
||||
&driver_attr_version);
|
||||
if (rval)
|
||||
goto err_dcf_attr_ver;
|
||||
rval = driver_create_file(&megasas_pci_driver.driver,
|
||||
&driver_attr_release_date);
|
||||
if (rval)
|
||||
goto err_dcf_rel_date;
|
||||
rval = driver_create_file(&megasas_pci_driver.driver,
|
||||
&driver_attr_dbg_lvl);
|
||||
if (rval)
|
||||
goto err_dcf_dbg_lvl;
|
||||
|
||||
return rval;
|
||||
err_dcf_dbg_lvl:
|
||||
driver_remove_file(&megasas_pci_driver.driver,
|
||||
&driver_attr_release_date);
|
||||
err_dcf_rel_date:
|
||||
driver_remove_file(&megasas_pci_driver.driver, &driver_attr_version);
|
||||
err_dcf_attr_ver:
|
||||
pci_unregister_driver(&megasas_pci_driver);
|
||||
err_pcidrv:
|
||||
unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl");
|
||||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3027,11 +3045,11 @@ static int __init megasas_init(void)
|
||||
*/
|
||||
static void __exit megasas_exit(void)
|
||||
{
|
||||
driver_remove_file(&megasas_pci_driver.driver, &driver_attr_version);
|
||||
driver_remove_file(&megasas_pci_driver.driver,
|
||||
&driver_attr_release_date);
|
||||
driver_remove_file(&megasas_pci_driver.driver,
|
||||
&driver_attr_dbg_lvl);
|
||||
driver_remove_file(&megasas_pci_driver.driver,
|
||||
&driver_attr_release_date);
|
||||
driver_remove_file(&megasas_pci_driver.driver, &driver_attr_version);
|
||||
|
||||
pci_unregister_driver(&megasas_pci_driver);
|
||||
unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl");
|
||||
|
Loading…
x
Reference in New Issue
Block a user