linux-stable/drivers/pcmcia
Yang Yingliang f258fd94ab pcmcia: ds: fix possible name leak in error path in pcmcia_device_add()
[ Upstream commit 99e1241049 ]

Afer commit 1fa5ae857b ("driver core: get rid of struct device's
bus_id string array"), the name of device is allocated dynamically.
Therefore, it needs to be freed, which is done by the driver core for
us once all references to the device are gone. Therefore, move the
dev_set_name() call immediately before the call device_register(), which
either succeeds (then the freeing will be done upon subsequent remvoal),
or puts the reference in the error call. Also, it is not unusual that the
return value of dev_set_name is not checked.

Fixes: 1fa5ae857b ("driver core: get rid of struct device's bus_id string array")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
[linux@dominikbrodowski.net: simplification, commit message modified]
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-11-20 11:52:13 +01:00
..
Kconfig
Makefile
bcm63xx_pcmcia.c
bcm63xx_pcmcia.h
cardbus.c
cirrus.h
cistpl.c
cs.c
cs_internal.h
db1xxx_ss.c
ds.c pcmcia: ds: fix possible name leak in error path in pcmcia_device_add() 2023-11-20 11:52:13 +01:00
electra_cf.c
i82092.c
i82092aa.h
i82365.c
i82365.h
max1600.c
max1600.h
o2micro.h
omap_cf.c
pcmcia_cis.c
pcmcia_resource.c
pd6729.c
pd6729.h
pxa2xx_base.c
pxa2xx_base.h
pxa2xx_mainstone.c
pxa2xx_sharpsl.c
ricoh.h
rsrc_iodyn.c
rsrc_mgr.c
rsrc_nonstatic.c
sa11xx_base.c
sa11xx_base.h
sa1100_generic.c
sa1100_generic.h
sa1100_h3600.c
sa1100_simpad.c
sa1111_badge4.c
sa1111_generic.c
sa1111_generic.h
sa1111_jornada720.c
sa1111_lubbock.c
sa1111_neponset.c
soc_common.c
soc_common.h
socket_sysfs.c
tcic.c
tcic.h
ti113x.h
topic.h
vg468.h
xxs1500_ss.c
yenta_socket.c
yenta_socket.h