Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pcmcia: Fix a NULL pointer dereference in __iodyn_find_io_region()

In __iodyn_find_io_region(), pcmcia_make_resource() is assigned to
res and used in pci_bus_alloc_resource(). There is 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.

Cc: stable@vger.kernel.org
Fixes: 49b1153adfe1 ("pcmcia: move all pcmcia_resource_ops providers into one module")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>

authored by

Ma Ke and committed by
Dominik Brodowski
44822df8 d1dfcdd3

+3
+3
drivers/pcmcia/rsrc_iodyn.c
··· 62 62 unsigned long min = base; 63 63 int ret; 64 64 65 + if (!res) 66 + return NULL; 67 + 65 68 data.mask = align - 1; 66 69 data.offset = base & data.mask; 67 70