Commit 7220fe8b authored by Horst Hummel's avatar Horst Hummel Committed by Linus Torvalds

[PATCH] s390: dasd proc entries

The proc_mkdir calls in the dasd driver are not check for NULL pointers.  Add
code to check the pointers and bail out if one of the proc entries could not
be created.
Signed-off-by: default avatarHorst Hummel <horst.hummel@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 25ee4cf8
...@@ -294,23 +294,40 @@ out_error: ...@@ -294,23 +294,40 @@ out_error:
#endif /* CONFIG_DASD_PROFILE */ #endif /* CONFIG_DASD_PROFILE */
} }
/*
* Create dasd proc-fs entries.
* In case creation failed, cleanup and return -ENOENT.
*/
int int
dasd_proc_init(void) dasd_proc_init(void)
{ {
dasd_proc_root_entry = proc_mkdir("dasd", &proc_root); dasd_proc_root_entry = proc_mkdir("dasd", &proc_root);
if (!dasd_proc_root_entry)
goto out_nodasd;
dasd_proc_root_entry->owner = THIS_MODULE; dasd_proc_root_entry->owner = THIS_MODULE;
dasd_devices_entry = create_proc_entry("devices", dasd_devices_entry = create_proc_entry("devices",
S_IFREG | S_IRUGO | S_IWUSR, S_IFREG | S_IRUGO | S_IWUSR,
dasd_proc_root_entry); dasd_proc_root_entry);
if (!dasd_devices_entry)
goto out_nodevices;
dasd_devices_entry->proc_fops = &dasd_devices_file_ops; dasd_devices_entry->proc_fops = &dasd_devices_file_ops;
dasd_devices_entry->owner = THIS_MODULE; dasd_devices_entry->owner = THIS_MODULE;
dasd_statistics_entry = create_proc_entry("statistics", dasd_statistics_entry = create_proc_entry("statistics",
S_IFREG | S_IRUGO | S_IWUSR, S_IFREG | S_IRUGO | S_IWUSR,
dasd_proc_root_entry); dasd_proc_root_entry);
if (!dasd_statistics_entry)
goto out_nostatistics;
dasd_statistics_entry->read_proc = dasd_statistics_read; dasd_statistics_entry->read_proc = dasd_statistics_read;
dasd_statistics_entry->write_proc = dasd_statistics_write; dasd_statistics_entry->write_proc = dasd_statistics_write;
dasd_statistics_entry->owner = THIS_MODULE; dasd_statistics_entry->owner = THIS_MODULE;
return 0; return 0;
out_nostatistics:
remove_proc_entry("devices", dasd_proc_root_entry);
out_nodevices:
remove_proc_entry("dasd", &proc_root);
out_nodasd:
return -ENOENT;
} }
void void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment