kobject_register needs return value checks (was: What protection does sysfs_readdir have with SMP/Preemption?)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


-
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]
  Powered by Linux