linux/drivers/pcmcia
Zhou Qingyang 977d2e7c63 pcmcia: rsrc_nonstatic: Fix a NULL pointer dereference in nonstatic_find_mem_region()
In nonstatic_find_mem_region(), pcmcia_make_resource() is assigned to
res and used in pci_bus_alloc_resource(). There a dereference of res
in pci_bus_alloc_resource(), which could lead to a NULL pointer
dereference on failure of pcmcia_make_resource().

Fix this bug by adding a check of res.

This bug was found by a static analyzer. The analysis employs
differential checking to identify inconsistent security operations
(e.g., checks or kfrees) between two code paths and confirms that the
inconsistent operations are not recovered in the current function or
the callers, so they constitute bugs.

Note that, as a bug found by static analysis, it can be a false
positive or hard to trigger. Multiple researchers have cross-reviewed
the bug.

Builds with CONFIG_PCCARD_NONSTATIC=y show no new warnings,
and our static analyzer no longer warns about this code.

Fixes: 49b1153adf ("pcmcia: move all pcmcia_resource_ops providers into one module")
Signed-off-by: Zhou Qingyang <zhou1615@umn.edu>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
2022-01-02 19:01:37 +01:00
..
at91_cf.c pcmcia: at91_cf: remove platform data support 2020-11-27 22:25:15 +01:00
bcm63xx_pcmcia.c drivers/pcmcia: Convert timers to use timer_setup() 2017-11-04 12:03:13 +01:00
bcm63xx_pcmcia.h
cardbus.c pcmcia: include cs_internal.h for missing declarations 2019-11-22 07:03:04 +01:00
cirrus.h
cistpl.c pcmcia: cistpl: Demote non-conformant kernel-doc headers to standard comments 2021-03-15 08:22:22 +01:00
cs_internal.h pcmcia: make pccard_loop_tuple() static 2020-05-18 11:16:39 +02:00
cs.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
db1xxx_ss.c pcmcia: db1xxx_ss: Fix fall-through warning for Clang 2021-10-13 14:47:48 -05:00
ds.c bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
electra_cf.c pcmcia/electra_cf: Fix some return values in 'electra_cf_probe()' in case of error 2020-12-05 09:31:37 +01:00
i82092.c pcmcia: i82092: fix a null pointer dereference bug 2021-07-23 08:08:54 +02:00
i82092aa.h PCMCIA/i82092: delete enter/leave macro 2019-12-16 11:49:54 +01:00
i82365.c drivers/pcmcia: Convert timers to use timer_setup() 2017-11-04 12:03:13 +01:00
i82365.h
Kconfig pcmcia: clean up dead drivers for CompuLab CM-X255/CM-X270 boards 2022-01-02 18:34:24 +01:00
Makefile pcmcia: clean up dead drivers for CompuLab CM-X255/CM-X270 boards 2022-01-02 18:34:24 +01:00
max1600.c pcmcia: add MAX1600 library 2018-12-04 22:37:38 +00:00
max1600.h pcmcia: add MAX1600 library 2018-12-04 22:37:38 +00:00
o2micro.h
omap_cf.c pcmcia: omap: Fix error return code in omap_cf_probe() 2020-12-05 09:59:13 +01:00
pcmcia_cis.c ethernet: replace netdev->dev_addr assignment loops 2021-10-14 09:22:25 -07:00
pcmcia_resource.c pcmcia: pcmcia_resource: Fix some kernel-doc formatting/disparities and demote others 2021-03-15 08:22:23 +01:00
pd6729.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
pd6729.h
pxa2xx_balloon3.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pxa2xx_base.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 256 2019-06-05 17:30:27 +02:00
pxa2xx_base.h
pxa2xx_colibri.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pxa2xx_e740.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pxa2xx_hx4700.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pxa2xx_mainstone.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pxa2xx_palmld.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pxa2xx_palmtc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pxa2xx_palmtx.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pxa2xx_sharpsl.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pxa2xx_stargate2.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pxa2xx_trizeps4.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pxa2xx_viper.c
pxa2xx_vpac270.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ricoh.h pcmcia: Implement CLKRUN protocol disabling for Ricoh bridges 2018-10-01 12:17:03 +02:00
rsrc_iodyn.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
rsrc_mgr.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
rsrc_nonstatic.c pcmcia: rsrc_nonstatic: Fix a NULL pointer dereference in nonstatic_find_mem_region() 2022-01-02 19:01:37 +01:00
sa11xx_base.c
sa11xx_base.h
sa1100_generic.c ARM: sa1100/shannon: convert to generic CF sockets 2018-04-06 15:53:22 +01:00
sa1100_generic.h ARM: sa1100/shannon: convert to generic CF sockets 2018-04-06 15:53:22 +01:00
sa1100_h3600.c ARM: sa1100/h3xxx: switch h3xxx PCMCIA to use gpiod APIs 2018-03-24 14:17:09 +00:00
sa1100_simpad.c pcmcia: remove some unused space characters 2020-03-31 18:48:22 +02:00
sa1111_badge4.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
sa1111_generic.c ARM: 9048/1: sa1111: make sa1111 bus's remove callback return void 2021-02-01 19:42:13 +00:00
sa1111_generic.h
sa1111_jornada720.c ARM: sa1100/jornada720: switch PCMCIA to gpiod APIs 2018-12-04 22:37:38 +00:00
sa1111_lubbock.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
sa1111_neponset.c ARM: sa1100/neponset: switch PCMCIA to MAX1600 library and gpiod APIs 2018-12-04 22:37:38 +00:00
soc_common.c gpiolib: Pass array info to get/set array functions 2018-09-13 11:16:54 +02:00
soc_common.h pcmcia: soc_common.h: Replace zero-length array with flexible-array member 2020-03-28 07:52:13 +01:00
socket_sysfs.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
tcic.c drivers/pcmcia: Convert timers to use timer_setup() 2017-11-04 12:03:13 +01:00
tcic.h
ti113x.h
topic.h
vg468.h
vrc4171_card.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
xxs1500_ss.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
yenta_socket.c pcmcia: comment out unused exca_readw() function 2022-01-02 18:39:12 +01:00
yenta_socket.h