summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2018-02-22 17:50:12 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-15 10:56:48 +0100
commitdf441ada39cdb1f12435574417cd29b005282d2f (patch)
treee16f73fe1c09b13bc7348a457a0de67a75eea904 /arch
parent3eaedec0cd82f32fa341314b2c01e9600fcf05e6 (diff)
MIPS: ath25: Check for kzalloc allocation failure
commit 1b22b4b28fd5fbc51855219e3238b3ab81da8466 upstream. Currently there is no null check on a failed allocation of board_data, and hence a null pointer dereference will occurr. Fix this by checking for the out of memory null pointer. Fixes: a7473717483e ("MIPS: ath25: add board configuration detection") Signed-off-by: Colin Ian King <colin.king@canonical.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: linux-mips@linux-mips.org Cc: <stable@vger.kernel.org> # 3.19+ Patchwork: https://patchwork.linux-mips.org/patch/18657/ Signed-off-by: James Hogan <jhogan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/ath25/board.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/mips/ath25/board.c b/arch/mips/ath25/board.c
index 9ab48ff80c1c..6d11ae581ea7 100644
--- a/arch/mips/ath25/board.c
+++ b/arch/mips/ath25/board.c
@@ -135,6 +135,8 @@ int __init ath25_find_config(phys_addr_t base, unsigned long size)
}
board_data = kzalloc(BOARD_CONFIG_BUFSZ, GFP_KERNEL);
+ if (!board_data)
+ goto error;
ath25_board.config = (struct ath25_boarddata *)board_data;
memcpy_fromio(board_data, bcfg, 0x100);
if (broken_boarddata) {