All of lore.kernel.org
 help / color / mirror / Atom feed
From: green@liuxhacker.ru
To: linux-omap@vger.kernel.org
Cc: Oleg Drokin <green@linuxhacker.ru>
Subject: [PATCH] Fix incorrect structure freeing in omap_nand_remove()
Date: Thu, 10 Mar 2011 19:26:39 -0500	[thread overview]
Message-ID: <1299803199-12790-1-git-send-email-green@liuxhacker.ru> (raw)

From: Oleg Drokin <green@linuxhacker.ru>

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 <green@linuxhacker.ru>
---
 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 4e33972..7c71716 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -1131,7 +1131,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;
 }
 
-- 
1.7.4


             reply	other threads:[~2011-03-11  0:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-11  0:26 green [this message]
2011-04-29 19:03 [PATCH] Fix incorrect structure freeing in omap_nand_remove() green

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1299803199-12790-1-git-send-email-green@liuxhacker.ru \
    --to=green@liuxhacker.ru \
    --cc=green@linuxhacker.ru \
    --cc=linux-omap@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.