]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
MIPS: OCTEON: irq: Fix potential NULL pointer dereference
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Tue, 22 Jan 2019 20:18:42 +0000 (14:18 -0600)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 29 Apr 2020 12:56:05 +0000 (14:56 +0200)
BugLink: https://bugs.launchpad.net/bugs/1874502
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: 64b139f97c01 ("MIPS: OCTEON: irq: add CIB and other fixes")
Cc: stable@vger.kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
arch/mips/cavium-octeon/octeon-irq.c

index b3aec101a65d4ed96f4f986ea22c2210b297cdef..a27b3d70393f7927c2206113ce49164e79c44c53 100644 (file)
@@ -2199,6 +2199,9 @@ static int octeon_irq_cib_map(struct irq_domain *d,
        }
 
        cd = kzalloc(sizeof(*cd), GFP_KERNEL);
+       if (!cd)
+               return -ENOMEM;
+
        cd->host_data = host_data;
        cd->bit = hw;