public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: green@linuxhacker.ru
To: linux-omap@vger.kernel.org
Cc: Artem Bityutskiy <dedekind1@gmail.com>,
	Oleg Drokin <green@linuxhacker.ru>
Subject: [PATCH] Fix incorrect structure freeing in omap_nand_remove()
Date: Fri, 29 Apr 2011 15:03:25 -0400	[thread overview]
Message-ID: <1304103805-14057-1-git-send-email-green@linuxhacker.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 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;
 }
 
-- 
1.7.4.4


             reply	other threads:[~2011-04-29 19:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-29 19:03 green [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-03-11  0:26 [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=1304103805-14057-1-git-send-email-green@linuxhacker.ru \
    --to=green@linuxhacker.ru \
    --cc=dedekind1@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox