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

Commit cde7e660 authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Greg Kroah-Hartman
Browse files

MIPS: OCTEON: irq: Fix potential NULL pointer dereference



commit 792a402c2840054533ef56279c212ef6da87d811 upstream.

There is a potential NULL pointer dereference in case kzalloc()
fails and returns NULL.

Fix this by adding a NULL check on *cd*

This bug was detected with the help of Coccinelle.

Fixes: 64b139f9 ("MIPS: OCTEON: irq: add CIB and other fixes")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 67dea3c7
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -2199,6 +2199,9 @@ static int octeon_irq_cib_map(struct irq_domain *d,
	}
	}


	cd = kzalloc(sizeof(*cd), GFP_KERNEL);
	cd = kzalloc(sizeof(*cd), GFP_KERNEL);
	if (!cd)
		return -ENOMEM;

	cd->host_data = host_data;
	cd->host_data = host_data;
	cd->bit = hw;
	cd->bit = hw;