kernel-hacking-2024-linux-s.../drivers/base
Thomas Gleixner e6309e7568 Driver-core: Fix bogus 0 error return in device_add()
If device_add() is called with a device which does not have dev->p set
up, then device_private_init() is called. If that succeeds, then the
error variable is set to 0. Now if the dev_name(dev) check further
down fails, then device_add() correctly terminates, but returns 0.
That of course lets the driver progress. If later another driver uses
this half set up device as parent then device_add() of the child
device explodes and renders sysfs completely unusable.

Set the error to -EINVAL if dev_name() check fails.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: "Hans J. Koch" <hjk@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-12-23 11:23:44 -08:00
..
power PM / Runtime: Use device type and device class callbacks 2009-12-22 20:43:17 +01:00
attribute_container.c
base.h Driver Core: devtmpfs - kernel-maintained tmpfs-based /dev 2009-09-15 09:50:49 -07:00
bus.c Driver core: allow certain drivers prohibit bind/unbind via sysfs 2009-10-30 14:59:51 -07:00
class.c Driver core: Add support for compatibility classes 2009-09-15 09:50:48 -07:00
core.c Driver-core: Fix bogus 0 error return in device_add() 2009-12-23 11:23:44 -08:00
cpu.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu 2009-12-14 09:58:24 -08:00
dd.c tree-wide: fix assorted typos all over the place 2009-12-04 15:39:55 +01:00
devres.c devres: WARN() and return, don't crash on device_del() of uninitialized device 2009-07-12 13:02:09 -07:00
devtmpfs.c devtmpfs: Convert dirlock to a mutex 2009-12-23 11:23:42 -08:00
dma-coherent.c driver-core: move dma-coherent.c from kernel to driver/base 2009-09-15 09:50:47 -07:00
dma-mapping.c
driver.c Driver core: driver_attribute parameters can often be const* 2009-12-23 11:23:43 -08:00
firmware.c
firmware_class.c firmware_class: make request_firmware_nowait more useful 2009-12-11 11:24:52 -08:00
hypervisor.c
init.c Driver Core: devtmpfs - kernel-maintained tmpfs-based /dev 2009-09-15 09:50:49 -07:00
iommu.c drivers/base/iommu.c: add missing includes 2009-05-06 16:36:10 -07:00
isa.c dma-mapping: replace all DMA_24BIT_MASK macro with DMA_BIT_MASK(24) 2009-04-07 08:31:12 -07:00
Kconfig Driver Core: devtmpfs - kernel-maintained tmpfs-based /dev 2009-09-15 09:50:49 -07:00
Makefile Driver Core: devtmpfs - kernel-maintained tmpfs-based /dev 2009-09-15 09:50:49 -07:00
map.c
memory.c mm: Add notifier in pageblock isolation for balloon drivers 2009-12-18 14:53:36 +11:00
module.c
node.c mm: slab-allocate memory section nodemask for large systems 2009-12-15 08:53:20 -08:00
platform.c Driver Core: Early platform driver buffer 2009-12-11 11:24:55 -08:00
sys.c driver core: sysdev: do not send KOBJ_ADD uevent if kobject_init_and_add fails 2009-07-28 13:45:22 -07:00
topology.c
transport_class.c