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
------=_Part_1051_32727407.1110363674902
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
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?
------=_Part_1051_32727407.1110363674902
Content-Type: text/plain; name="ext2.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="ext2.txt"
Index: sys/gnu/ext2fs/ext2_vnops.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
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=0911 Jan 2005 09:10:45 -0000=091.97
+++ sys/gnu/ext2fs/ext2_vnops.c=099 Mar 2005 10:19:40 -0000
@@ -249,16 +249,21 @@
=09=09struct thread *a_td;
=09} */ *ap;
{
+=09struct vnode *vp =3D ap->a_vp;
+=09struct inode *ip;
=20
-=09if (ap->a_vp->v_type =3D=3D VBLK || ap->a_vp->v_type =3D=3D VCHR)
+=09if (vp->v_type =3D=3D VBLK || vp->v_type =3D=3D VCHR)
=09=09return (EOPNOTSUPP);
=20
=09/*
=09 * Files marked append-only must be opened for appending.
=09 */
-=09if ((VTOI(ap->a_vp)->i_flags & APPEND) &&
+=09ip =3D VTOI(vp);
+=09if ((ip->i_flags & APPEND) &&
=09 (ap->a_mode & (FWRITE | O_APPEND)) =3D=3D FWRITE)
=09=09return (EPERM);
+
+=09vnode_create_vobject(vp, ip->i_size, ap->a_td);
=09return (0);
}
=20
------=_Part_1051_32727407.1110363674902--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?34cb7c84050309022130766a33>
