aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHorst Hummel <horst.hummel@de.ibm.com>2006-04-11 01:53:48 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-04-11 09:18:38 -0400
commit7220fe8b7915af4ffcd42d73c285c5898734d087 (patch)
treef7e15da7fdbb16b9749d3a0f3a79ae2fd99aec40
parent25ee4cf831fcc2855927c175d246a25e5ebe5902 (diff)
[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: Horst Hummel <horst.hummel@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/s390/block/dasd_proc.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/s390/block/dasd_proc.c b/drivers/s390/block/dasd_proc.c
index 1aa3c261718a..ad23aede356c 100644
--- a/drivers/s390/block/dasd_proc.c
+++ b/drivers/s390/block/dasd_proc.c
@@ -294,23 +294,40 @@ out_error:
294#endif /* CONFIG_DASD_PROFILE */ 294#endif /* CONFIG_DASD_PROFILE */
295} 295}
296 296
297/*
298 * Create dasd proc-fs entries.
299 * In case creation failed, cleanup and return -ENOENT.
300 */
297int 301int
298dasd_proc_init(void) 302dasd_proc_init(void)
299{ 303{
300 dasd_proc_root_entry = proc_mkdir("dasd", &proc_root); 304 dasd_proc_root_entry = proc_mkdir("dasd", &proc_root);
305 if (!dasd_proc_root_entry)
306 goto out_nodasd;
301 dasd_proc_root_entry->owner = THIS_MODULE; 307 dasd_proc_root_entry->owner = THIS_MODULE;
302 dasd_devices_entry = create_proc_entry("devices", 308 dasd_devices_entry = create_proc_entry("devices",
303 S_IFREG | S_IRUGO | S_IWUSR, 309 S_IFREG | S_IRUGO | S_IWUSR,
304 dasd_proc_root_entry); 310 dasd_proc_root_entry);
311 if (!dasd_devices_entry)
312 goto out_nodevices;
305 dasd_devices_entry->proc_fops = &dasd_devices_file_ops; 313 dasd_devices_entry->proc_fops = &dasd_devices_file_ops;
306 dasd_devices_entry->owner = THIS_MODULE; 314 dasd_devices_entry->owner = THIS_MODULE;
307 dasd_statistics_entry = create_proc_entry("statistics", 315 dasd_statistics_entry = create_proc_entry("statistics",
308 S_IFREG | S_IRUGO | S_IWUSR, 316 S_IFREG | S_IRUGO | S_IWUSR,
309 dasd_proc_root_entry); 317 dasd_proc_root_entry);
318 if (!dasd_statistics_entry)
319 goto out_nostatistics;
310 dasd_statistics_entry->read_proc = dasd_statistics_read; 320 dasd_statistics_entry->read_proc = dasd_statistics_read;
311 dasd_statistics_entry->write_proc = dasd_statistics_write; 321 dasd_statistics_entry->write_proc = dasd_statistics_write;
312 dasd_statistics_entry->owner = THIS_MODULE; 322 dasd_statistics_entry->owner = THIS_MODULE;
313 return 0; 323 return 0;
324
325 out_nostatistics:
326 remove_proc_entry("devices", dasd_proc_root_entry);
327 out_nodevices:
328 remove_proc_entry("dasd", &proc_root);
329 out_nodasd:
330 return -ENOENT;
314} 331}
315 332
316void 333void