Thank you Jeff.
Regards,
Sumant
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Jeff Garzik
Sent: Wednesday, October 04, 2006 3:34 AM
To: [email protected]
Cc: Andrew Morton; LKML
Subject: [PATCH] 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 <[email protected]>
---
drivers/scsi/megaraid/megaraid_sas.c | 26 ++++++++++++++++++++------
1 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/megaraid/megaraid_sas.c
b/drivers/scsi/megaraid/megaraid_sas.c
index 4cab5b5..8e0ab99 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.c
@@ -2716,7 +2716,8 @@ static int megasas_mgmt_compat_ioctl_fw(
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)) ||
@@ -2842,13 +2843,26 @@ 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);
+ 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;
+ return 0;
+
+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;
}
@@ -2857,9 +2871,9 @@ 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_version);
pci_unregister_driver(&megasas_pci_driver);
unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl");
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]