From: Borislav Petkov Date: Tue, 29 Mar 2011 16:10:53 +0000 (+0200) Subject: amd64_edac: Fix potential memleak X-Git-Tag: v2.6.38.3~81 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=53a624a9467771174585e85b4b6b3d7f23ec9526;p=thirdparty%2Fkernel%2Fstable.git amd64_edac: Fix potential memleak commit a9f0fbe2bbf328f869fc5ee5a12c6a4118c32689 upstream. We check the pointers together but at least one of them could be invalid due to failed allocation. Since we cannot continue if either of the two allocations has failed, exit early by freeing them both. Reported-by: Mauro Carvalho Chehab Signed-off-by: Borislav Petkov Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 23e03554f0d3a..7e0e66037e025 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -2765,7 +2765,7 @@ static int __init amd64_edac_init(void) mcis = kzalloc(amd_nb_num() * sizeof(mcis[0]), GFP_KERNEL); ecc_stngs = kzalloc(amd_nb_num() * sizeof(ecc_stngs[0]), GFP_KERNEL); if (!(mcis && ecc_stngs)) - goto err_ret; + goto err_free; msrs = msrs_alloc(); if (!msrs)