From patchwork Fri Apr 29 19:03:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleg Drokin X-Patchwork-Id: 742011 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3TJ4Fi6027475 for ; Fri, 29 Apr 2011 19:04:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933447Ab1D2TED (ORCPT ); Fri, 29 Apr 2011 15:04:03 -0400 Received: from c-71-228-165-73.hsd1.tn.comcast.net ([71.228.165.73]:45748 "EHLO fatbox1.localnet" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933238Ab1D2TDx (ORCPT ); Fri, 29 Apr 2011 15:03:53 -0400 Received: from fatbox1.localnet (fatbox1.localnet [127.0.0.1]) by fatbox1.localnet (8.14.4/8.14.4) with ESMTP id p3TJ3kuF014091; Fri, 29 Apr 2011 15:03:46 -0400 Received: (from green@localhost) by fatbox1.localnet (8.14.4/8.14.4/Submit) id p3TJ3k89014089; Fri, 29 Apr 2011 15:03:46 -0400 X-Authentication-Warning: fatbox1.localnet: green set sender to green@linuxhacker.ru using -f From: green@linuxhacker.ru To: linux-omap@vger.kernel.org Cc: Artem Bityutskiy , Oleg Drokin Subject: [PATCH] Fix incorrect structure freeing in omap_nand_remove() Date: Fri, 29 Apr 2011 15:03:25 -0400 Message-Id: <1304103805-14057-1-git-send-email-green@linuxhacker.ru> X-Mailer: git-send-email 1.7.4.4 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 29 Apr 2011 19:04:16 +0000 (UTC) From: Oleg Drokin Attempt to kfree(&info->mtd) is a bad idea since it's a different substructure in the middle of a properly allocated struct omap_nand_info. I guess nobody tripped it before since nobody really removes NAND flash and nobody unloads the module either. Signed-off-by: Oleg Drokin --- drivers/mtd/nand/omap2.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index da9a351..39f5034 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c @@ -1139,7 +1139,7 @@ static int omap_nand_remove(struct platform_device *pdev) /* Release NAND device, its internal structures and partitions */ nand_release(&info->mtd); iounmap(info->nand.IO_ADDR_R); - kfree(&info->mtd); + kfree(info); return 0; }