Skip to content

Commit d728600

Browse files
Ma Kegregkh
authored andcommitted
pcmcia: Fix a NULL pointer dereference in __iodyn_find_io_region()
commit 44822df upstream. 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: 49b1153 ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6bb712a commit d728600

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/pcmcia/rsrc_iodyn.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ static struct resource *__iodyn_find_io_region(struct pcmcia_socket *s,
6262
unsigned long min = base;
6363
int ret;
6464

65+
if (!res)
66+
return NULL;
67+
6568
data.mask = align - 1;
6669
data.offset = base & data.mask;
6770

0 commit comments

Comments
 (0)