From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752607Ab2AIKBj (ORCPT ); Mon, 9 Jan 2012 05:01:39 -0500 Received: from mms3.broadcom.com ([216.31.210.19]:4327 "EHLO MMS3.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751403Ab2AIKBi (ORCPT ); Mon, 9 Jan 2012 05:01:38 -0500 X-Server-Uuid: B55A25B1-5D7D-41F8-BC53-C57E7AD3C201 Message-ID: <4F0ABAEB.5070306@broadcom.com> Date: Mon, 9 Jan 2012 11:01:15 +0100 From: "Arend van Spriel" User-Agent: Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20111124 Thunderbird/8.0 MIME-Version: 1.0 To: "Jesper Juhl" cc: "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Alwin Beukers" , "Pieter-Paul Giesberts" , "John W. Linville" , "Franky (Zhenhui) Lin" Subject: Re: [PATCH] brcm80211: Don't leak 'vbuffer' in brcmf_sdbrcm_write_vars() References: In-Reply-To: X-Enigmail-Version: 1.4a1pre OpenPGP: id=B5E1A116 X-WSS-ID: 6314635950411883529-01-01 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/08/2012 11:41 PM, Jesper Juhl wrote: > If the memory allocation 'nvram_ularray = kmalloc(varsize, > GFP_ATOMIC);' fails we'll leak the memory allocated to 'vbuffer' when > we return -ENOMEM from the function. > > This patch resolves the leak by kfree()'ing the allocated memory > before the return. > > Signed-off-by: Jesper Juhl Nice catch. Thanks. Acked-by: Arend van Spriel Gr. AvS