]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
amd64_edac: Fix potential memleak
authorBorislav Petkov <borislav.petkov@amd.com>
Tue, 29 Mar 2011 16:10:53 +0000 (18:10 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 14 Apr 2011 20:02:03 +0000 (13:02 -0700)
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 <mchehab@redhat.com>
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/edac/amd64_edac.c

index 23e03554f0d3af68053f1ae56427fbd577217360..7e0e66037e02560f3ef3d3d2fc635c40e85d932a 100644 (file)
@@ -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)