From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756054Ab2JPTPM (ORCPT ); Tue, 16 Oct 2012 15:15:12 -0400 Received: from mail-da0-f46.google.com ([209.85.210.46]:59494 "EHLO mail-da0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755838Ab2JPTOS (ORCPT ); Tue, 16 Oct 2012 15:14:18 -0400 Date: Tue, 16 Oct 2012 12:14:16 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Jesper Juhl cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, Len Brown Subject: Re: [PATCH] [resend] ACPI: Fix memory leak in acpi_bind_one() (fwd) In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 15 Oct 2012, Jesper Juhl wrote: > Memory is allocated with kzalloc() and assigned to > 'physical_node'. Then 'physical_node->node_id' is initialized with a > call to 'find_first_zero_bit()', if that results in a value greater > than ACPI_MAX_PHYSICAL_NODE we'll end up jumping to the 'err:' label > and there leave the function and let 'physical_node' go out of scope > and leak the memory we allocated. > This patch fixes the leak by simply freeing the unused/unneeded memory > pointed to by 'physical_node' just before we jump to 'err:'. > > Signed-off-by: Jesper Juhl Acked-by: David Rientjes