Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753515Ab0BVSCC (ORCPT ); Mon, 22 Feb 2010 13:02:02 -0500 Received: from gw1.transmode.se ([213.115.205.20]:45733 "EHLO gw1.transmode.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752889Ab0BVSCA convert rfc822-to-8bit (ORCPT ); Mon, 22 Feb 2010 13:02:00 -0500 X-Greylist: delayed 502 seconds by postgrey-1.27 at vger.kernel.org; Mon, 22 Feb 2010 13:02:00 EST In-Reply-To: References: Subject: Re: [PATCH] jffs2: fix memory leak if the sector was successfully erased X-KeepSent: B51E93AB:187F855F-C12576D2:00618F62; type=4; name=$KeepSent To: niam Cc: David Woodhouse , Joe Perches , linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org X-Mailer: Lotus Notes Release 8.5.1 September 28, 2009 Message-ID: From: Joakim Tjernlund Date: Mon, 22 Feb 2010 18:49:00 +0100 X-MIMETrack: Serialize by Router on sesr04/Transmode(Release 8.5.1|September 28, 2009) at 2010-02-22 18:53:36 MIME-Version: 1.0 Content-type: text/plain; charset=ISO-8859-15 Content-transfer-encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1201 Lines: 39 niam wrote on 2010/02/22 17:40:11: > > Resending patch to proper people/mailing list. > > Memory allocated for erase instruction is not freed if the sector was > successfully erased. NAK, jffs2_erase_callback() will free it so you have added a double free I think. Did you measure a memory leak? > > Signed-off-by: Dmytro Milinevskyy > --- > ?fs/jffs2/erase.c | ? ?4 +++- > ?1 files changed, 3 insertions(+), 1 deletions(-) > > diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c > index b47679b..c0a5604 100644 > --- a/fs/jffs2/erase.c > +++ b/fs/jffs2/erase.c > @@ -74,8 +74,10 @@ static void jffs2_erase_block(struct jffs2_sb_info *c, > ? ? ? ?((struct erase_priv_struct *)instr->priv)->c = c; > > ? ? ? ?ret = c->mtd->erase(c->mtd, instr); > - ? ? ? if (!ret) > + ? ? ? if (!ret) { > + ? ? ? ?kfree(instr); > ? ? ? ? ? ? ? ?return; > + ? ?} > > ? ? ? ?bad_offset = instr->fail_addr; > ? ? ? ?kfree(instr); > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/