Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 205adda7 authored by Shawn Lin's avatar Shawn Lin Committed by Bjorn Helgaas
Browse files

PCI: cpqphp: Fix possible NULL pointer dereference



Check io_node for NULL before dereferencing it.

Signed-off-by: default avatarShawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: default avatarBjorn Helgaas <helgaas@kernel.org>
parent 7928b2cb
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -2812,18 +2812,16 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func

					dbg("CND:      length = 0x%x\n", base);
					io_node = get_io_resource(&(resources->io_head), base);
					if (!io_node)
						return -ENOMEM;
					dbg("Got io_node start = %8.8x, length = %8.8x next (%p)\n",
					    io_node->base, io_node->length, io_node->next);
					dbg("func (%p) io_head (%p)\n", func, func->io_head);

					/* allocate the resource to the board */
					if (io_node) {
					base = io_node->base;

					io_node->next = func->io_head;
					func->io_head = io_node;
					} else
						return -ENOMEM;
				} else if ((temp_register & 0x0BL) == 0x08) {
					/* Map prefetchable memory */
					base = temp_register & 0xFFFFFFF0;