From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752681AbdGSHAA (ORCPT ); Wed, 19 Jul 2017 03:00:00 -0400 Received: from paleale.coelho.fi ([176.9.41.70]:39360 "EHLO farmhouse.coelho.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751228AbdGSG77 (ORCPT ); Wed, 19 Jul 2017 02:59:59 -0400 Message-ID: <1500447592.22048.256.camel@coelho.fi> From: Luca Coelho To: Christophe JAILLET , johannes.berg@intel.com, emmanuel.grumbach@intel.com, linuxwifi@intel.com, kvalo@codeaurora.org, sara.sharon@intel.com Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Date: Wed, 19 Jul 2017 09:59:52 +0300 In-Reply-To: <20170714100659.26369-1-christophe.jaillet@wanadoo.fr> References: <20170714100659.26369-1-christophe.jaillet@wanadoo.fr> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 91.156.4.241 X-SA-Exim-Mail-From: luca@coelho.fi Subject: Re: [PATCH v2] iwlwifi: mvm: Fix a memory leak in an error handling path in 'iwl_mvm_sar_get_wgds_table()' X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on farmhouse.coelho.fi) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2017-07-14 at 12:06 +0200, Christophe JAILLET wrote: > We should free 'wgds.pointer' here as done a few lines above in another > error handling path. > It was allocated within 'acpi_evaluate_object()'. > > Signed-off-by: Christophe JAILLET > --- > v2: rebase after 7fe90e0e3d60 ("iwlwifi: mvm: refactor geo init") Thanks, Christophe! I've pushed this to our internal tree and it will eventually reach the mainline via our normal process. > Moreovern a comment in '/drivers/acpi/acpica/utalloc.c' states that: > /* [...] Note: The caller should use acpi_os_free to free this > * buffer created via ACPI_ALLOCATE_BUFFER. > */ > > So, at the end of this function: > out_free: > kfree(wgds.pointer); > should maybe be: > out_free: > acpi_os_free(wgds.pointer); > > If correct, several places should be fixed accordingly. Thanks for pointing out! I'm about to do some refactoring in this code and I'll make sure I check the proper way to free the acpi buffer when doing so. -- Cheers, Luca.