From d0e375e8f26edd2e577e3afa9d952f91037cbd87 Mon Sep 17 00:00:00 2001 From: Borislav Petkov Date: Sat, 20 Apr 2019 21:39:24 +0200 Subject: [PATCH] RAS/CEC: Fix potential memory leak Free the array page if a failure is encountered while creating the debugfs nodes. Signed-off-by: Borislav Petkov Cc: Tony Luck Cc: linux-edac --- drivers/ras/cec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c index 31868bd99e8d..f57e869dfea2 100644 --- a/drivers/ras/cec.c +++ b/drivers/ras/cec.c @@ -504,8 +504,10 @@ void __init cec_init(void) return; } - if (create_debugfs_nodes()) + if (create_debugfs_nodes()) { + free_page((unsigned long)ce_arr.array); return; + } INIT_DELAYED_WORK(&cec_work, cec_work_fn); schedule_delayed_work(&cec_work, CEC_DECAY_DEFAULT_INTERVAL);