* kobject_register needs return value checks (was: What protection does sysfs_readdir have with SMP/Preemption?)
[not found] ` <1132755654.13395.37.camel@localhost.localdomain>
@ 2005-11-23 15:24 ` Steven Rostedt
0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2005-11-23 15:24 UTC (permalink / raw)
To: maneesh
Cc: Thibaut VARENE, linux-scsi, linuxraid, Matt Tolentino, len.brown,
Ingo Molnar, LKML, Greg KH
I'm doing some tests to see what happens on a failure of setting up
something in the sysfs, and I've discovered a few areas that don't test
the return value of kobject_register. The test was due to a memory
problem in a custom kernel that showed that sysfs didn't quite handle
the error cases well.
I did the following command:
find . -name "*.c" ! -type d | xargs grep "kobject_register"
I found 27 hits. Of these:
14 - checked the return value.
1 - reference in .mod.c file /* ignore it */
3 - in comments /* ignore it */
1 - declaration of actual function /* ignore it */
1 - EXPORT_SYMBOL /* ignore it */
1 - inside a printk quote. /* ignore it */
and ...
6 - calls without checking return values.
Here are the culprits:
./drivers/acpi/scan.c: kobject_register(&device->kobj);
./drivers/firmware/efivars.c: kobject_register(&new_efivar->kobj);
./drivers/md/md.c: kobject_register(&mddev->kobj);
./drivers/parisc/pdc_stable.c: kobject_register(&entry->kobj);
./fs/partitions/check.c: kobject_register(&p->kobj);
./kernel/params.c: kobject_register(&mk->kobj);
Normally, these would not return errors, but in case they do, the kernel
should be robust enough to handle it.
I tried to CC all the maintainers of the above files.
-- Steve
^ permalink raw reply [flat|nested] only message in thread