Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/lfs lfs_truncate: handle synlinks with length > maxs...



details:   https://anonhg.NetBSD.org/src/rev/39e1feead3c8
branches:  trunk
changeset: 483521:39e1feead3c8
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sun Mar 12 01:45:01 2000 +0000

description:
lfs_truncate: handle synlinks with length > maxsymlink_len as regular files.
For symlinks > 60 chars we were bzero'ing part of (struct inode) past the
actual inode struct, corrupting memory following the current (struct inode)
resuling in a 'panic: pool_get(lfsinopl): free list modified' later.
This could also be the cause of random panics. With this fix LFS seems to be
useable for me now.

diffstat:

 sys/ufs/lfs/lfs_inode.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r d62f9be78a0f -r 39e1feead3c8 sys/ufs/lfs/lfs_inode.c
--- a/sys/ufs/lfs/lfs_inode.c   Sun Mar 12 01:15:04 2000 +0000
+++ b/sys/ufs/lfs/lfs_inode.c   Sun Mar 12 01:45:01 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_inode.c,v 1.30 2000/01/19 00:03:04 perseant Exp $  */
+/*     $NetBSD: lfs_inode.c,v 1.31 2000/03/12 01:45:01 bouyer Exp $    */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -243,7 +243,10 @@
        
        ip = VTOI(vp);
 
-       if (vp->v_type == VLNK && vp->v_mount->mnt_maxsymlinklen > 0) {
+       if (vp->v_type == VLNK &&
+          (ip->i_ffs_size < vp->v_mount->mnt_maxsymlinklen ||
+            (vp->v_mount->mnt_maxsymlinklen == 0 &&
+             ip->i_din.ffs_din.di_blocks == 0))) {
 #ifdef DIAGNOSTIC
                if (length != 0)
                        panic("lfs_truncate: partial truncate of symlink");



Home | Main Index | Thread Index | Old Index