Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Mar 2005 10:21:14 +0000
From:      Peter Edwards <peadar.edwards@gmail.com>
To:        Eric Kjeldergaard <kjelderg@gmail.com>
Cc:        FreeBSD Current <current@freebsd.org>
Subject:   Re: a relatively major problem with ext2.
Message-ID:  <34cb7c84050309022130766a33@mail.gmail.com>
In-Reply-To: <d9175cad0503081854b1a6a22@mail.gmail.com>
References:  <d9175cad0503081854b1a6a22@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Tue, 8 Mar 2005 20:54:44 -0600, Eric Kjeldergaard <kjelderg@gmail.com> wrote:
> After a bit of discussion on the kde list regarding a problem I've
> been having with kreadconfig (which uses mmap), I've stumbled (largely
> directed by Michael Nottebrock) upon an ext2 bug.  Michael wrote and
> posted the following code:
> [snip mmap failures, crash]
Hi Eric,
Can you try the attached patch?

[-- Attachment #2 --]
Index: sys/gnu/ext2fs/ext2_vnops.c
===================================================================
RCS file: /home/ncvs/src/sys/gnu/ext2fs/ext2_vnops.c,v
retrieving revision 1.97
diff -u -r1.97 ext2_vnops.c
--- sys/gnu/ext2fs/ext2_vnops.c	11 Jan 2005 09:10:45 -0000	1.97
+++ sys/gnu/ext2fs/ext2_vnops.c	9 Mar 2005 10:19:40 -0000
@@ -249,16 +249,21 @@
 		struct thread *a_td;
 	} */ *ap;
 {
+	struct vnode *vp = ap->a_vp;
+	struct inode *ip;
 
-	if (ap->a_vp->v_type == VBLK || ap->a_vp->v_type == VCHR)
+	if (vp->v_type == VBLK || vp->v_type == VCHR)
 		return (EOPNOTSUPP);
 
 	/*
 	 * Files marked append-only must be opened for appending.
 	 */
-	if ((VTOI(ap->a_vp)->i_flags & APPEND) &&
+	ip = VTOI(vp);
+	if ((ip->i_flags & APPEND) &&
 	    (ap->a_mode & (FWRITE | O_APPEND)) == FWRITE)
 		return (EPERM);
+
+	vnode_create_vobject(vp, ip->i_size, ap->a_td);
 	return (0);
 }
 

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?34cb7c84050309022130766a33>