linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: Konstantin Boldyshev <konst@linuxassembly.org>
Cc: Kernel Mailing List <linux-kernel@vger.kernel.org>,
	<marcelo.tosatti@cyclades.com>,
	Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
Subject: Re: minix fs corruption fix for 2.4
Date: Mon, 3 Nov 2003 08:55:42 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.44.0311030851430.20373-100000@home.osdl.org> (raw)
In-Reply-To: <Pine.LNX.4.43L.0311031557480.1077-200000@alpha.linuxassembly.org>


On Mon, 3 Nov 2003, Konstantin Boldyshev wrote:
> 
> Enclosed is a simple patch to fix corruption of minix filesystem
> when deleting character and block device nodes (special files).
> From what I've found out the bug was introduced somehwere in 2.3
> and is present in all 2.4 versions, and I guess also goes into 2.6.

Oops, yes.

The problem is that block and character devices put not a block number but 
a _device_ number in the place where other files put their block 
allocations.

Your patch is wrong, though - you shouldn't test for APPEND and IMMUTABLE 
here. That should be done at higher layers. 

I'd also prefer to do the test the other way around: test for CHRDEV and 
BLKDEV in inode.c the same way the other functions do. Something like the 
appended..

Al, can you verify? I think this crept in when you did the block lookup 
cleanups. I also worry whether anybody else got the bug?

		Linus

===== fs/minix/inode.c 1.38 vs edited =====
--- 1.38/fs/minix/inode.c	Fri Sep  5 04:31:53 2003
+++ edited/fs/minix/inode.c	Mon Nov  3 08:51:01 2003
@@ -547,6 +547,8 @@
  */
 void minix_truncate(struct inode * inode)
 {
+	if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode))
+		return;
 	if (INODE_VERSION(inode) == MINIX_V1)
 		V1_minix_truncate(inode);
 	else


  reply	other threads:[~2003-11-03 16:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-03 13:21 minix fs corruption fix for 2.4 Konstantin Boldyshev
2003-11-03 16:55 ` Linus Torvalds [this message]
2003-11-03 17:19   ` viro
2003-11-03 17:50     ` Linus Torvalds
2003-11-04  6:30   ` Konstantin Boldyshev

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=Pine.LNX.4.44.0311030851430.20373-100000@home.osdl.org \
    --to=torvalds@osdl.org \
    --cc=konst@linuxassembly.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.com \
    --cc=viro@parcelfarce.linux.theplanet.co.uk \
    /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;
as well as URLs for NNTP newsgroup(s).