public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Richard Purdie <rpurdie@rpsys.net>
To: linux-mtd <linux-mtd@lists.infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: 2.6.18-rc4 jffs2 problems
Date: Thu, 17 Aug 2006 23:09:47 +0100	[thread overview]
Message-ID: <1155852587.5530.30.camel@localhost.localdomain> (raw)
In-Reply-To: <1154976111.17725.8.camel@localhost.localdomain>

Read the return value before we release the nand device otherwise the
value can become corrupted by another user of chip->ops, ultimately
resulting in filesystem corruption.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>

---

This fixes the jffs2 errors and filesystem corruption I reported. It
should be applied for 2.6.18.

 drivers/mtd/nand/nand_base.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: git/drivers/mtd/nand/nand_base.c
===================================================================
--- git.orig/drivers/mtd/nand/nand_base.c	2006-08-17 22:46:19.000000000 +0100
+++ git/drivers/mtd/nand/nand_base.c	2006-08-17 22:47:27.000000000 +0100
@@ -1093,9 +1093,10 @@ static int nand_read(struct mtd_info *mt
 
 	ret = nand_do_read_ops(mtd, from, &chip->ops);
 
+	*retlen = chip->ops.retlen;
+
 	nand_release_device(mtd);
 
-	*retlen = chip->ops.retlen;
 	return ret;
 }
 
@@ -1691,9 +1692,10 @@ static int nand_write(struct mtd_info *m
 
 	ret = nand_do_write_ops(mtd, to, &chip->ops);
 
+	*retlen = chip->ops.retlen;
+
 	nand_release_device(mtd);
 
-	*retlen = chip->ops.retlen;
 	return ret;
 }
 

  parent reply	other threads:[~2006-08-17 22:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-07 18:41 2.6.18-rc4 jffs2 problems Richard Purdie
2006-08-08  6:40 ` Andrew Morton
2006-08-08  7:15 ` Artem B. Bityutskiy
2006-08-09  9:34 ` Jonathan McDowell
2006-08-10  6:04   ` Jonathan McDowell
2006-08-10  9:29     ` Artem B. Bityutskiy
2006-08-15 22:29     ` Richard Purdie
2006-08-17 22:09 ` Richard Purdie [this message]
2006-08-20  1:34   ` Josh Boyer
2006-08-21  1:35     ` Greg KH
2006-08-22 14:12       ` David Woodhouse
2006-08-22 14:39         ` Josh Boyer

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=1155852587.5530.30.camel@localhost.localdomain \
    --to=rpurdie@rpsys.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=tglx@linutronix.de \
    /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