The branch stable/13 has been updated by mckusick:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=57d877348b2cb53a502a1bd305f973105f064a58

commit 57d877348b2cb53a502a1bd305f973105f064a58
Author:     Kirk McKusick <mckus...@freebsd.org>
AuthorDate: 2021-05-17 00:02:42 +0000
Commit:     Kirk McKusick <mckus...@freebsd.org>
CommitDate: 2021-05-31 00:40:44 +0000

    Fix handling of embedded symbolic links (and history lesson).
    
    Sponsored by: Netflix
    
    (cherry picked from commit 9a2fac6ba65fbd14d37ccedbc2aec27a190128ea)
---
 sys/kern/vfs_subr.c     | 3 ++-
 sys/sys/mount.h         | 2 +-
 sys/ufs/ffs/ffs_inode.c | 4 +---
 sys/ufs/ufs/ufs_vnops.c | 4 +---
 4 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index ee570f216b40..ba02d0600a6e 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -4403,7 +4403,8 @@ DB_SHOW_COMMAND(mount, db_show_mount)
            mp->mnt_lazyvnodelistsize);
        db_printf("    mnt_writeopcount = %d (with %d in the struct)\n",
            vfs_mount_fetch_counter(mp, MNT_COUNT_WRITEOPCOUNT), 
mp->mnt_writeopcount);
-       db_printf("    mnt_maxsymlinklen = %d\n", mp->mnt_maxsymlinklen);
+       db_printf("    mnt_maxsymlinklen = %jd\n",
+           (uintmax_t)mp->mnt_maxsymlinklen);
        db_printf("    mnt_iosize_max = %d\n", mp->mnt_iosize_max);
        db_printf("    mnt_hashseed = %u\n", mp->mnt_hashseed);
        db_printf("    mnt_lockref = %d (with %d in the struct)\n",
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index 8b5712d19215..ae12c9fc8197 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -222,7 +222,7 @@ struct mount {
        int             mnt_writeopcount;       /* (i) write syscalls pending */
        struct vfsoptlist *mnt_opt;             /* current mount options */
        struct vfsoptlist *mnt_optnew;          /* new options passed to fs */
-       int             mnt_maxsymlinklen;      /* max size of short symlink */
+       uint64_t        mnt_maxsymlinklen;      /* max size of short symlink */
        struct statfs   mnt_stat;               /* cache of filesystem stats */
        struct ucred    *mnt_cred;              /* credentials of mounter */
        void *          mnt_data;               /* private data */
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c
index 3df7bf8e8596..7bb532e7d26c 100644
--- a/sys/ufs/ffs/ffs_inode.c
+++ b/sys/ufs/ffs/ffs_inode.c
@@ -329,9 +329,7 @@ ffs_truncate(vp, length, flags, cred)
        }
        if ((flags & IO_NORMAL) == 0)
                return (0);
-       if (vp->v_type == VLNK &&
-           (ip->i_size < vp->v_mount->mnt_maxsymlinklen ||
-            datablocks == 0)) {
+       if (vp->v_type == VLNK && ip->i_size < vp->v_mount->mnt_maxsymlinklen) {
 #ifdef INVARIANTS
                if (length != 0)
                        panic("ffs_truncate: partial truncate of symlink");
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index 301c583291d1..70bf1a1d9036 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -2458,10 +2458,8 @@ ufs_readlink(ap)
        doff_t isize;
 
        isize = ip->i_size;
-       if ((isize < vp->v_mount->mnt_maxsymlinklen) ||
-           DIP(ip, i_blocks) == 0) { /* XXX - for old fastlink support */
+       if (isize < vp->v_mount->mnt_maxsymlinklen)
                return (uiomove(SHORTLINK(ip), isize, ap->a_uio));
-       }
        return (VOP_READ(vp, ap->a_uio, 0, ap->a_cred));
 }
 
_______________________________________________
dev-commits-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"

Reply via email to