Subject: Re: ancient ufs patch
To: Matt Fredette <fredette@theory.lcs.mit.edu>
From: Jaromir Dolecek <dolecek@conference.tele2.cz>
List: tech-kern
Date: 07/20/2003 20:50:20
Matt Fredette wrote:
> ufs_vnops.c is generally good about dealing with mnt_maxsymlinklen <= 0,
> but I think I found two places that were missed - in ufs_symlink() and 
> ufs_readlink().  Since I don't do filesystems, does the attached patch
> look ok?  It seems to fix the problem.  (fsdb and dump had no problems.)

Appears to be fine. I think it's okay to commit.

Jaromir

> Thanks,
> 
> -- 
> Matt Fredette
> 
> [snip]
> Index: ufs_vnops.c
> ===================================================================
> RCS file: /cvsroot/src/sys/ufs/ufs/ufs_vnops.c,v
> retrieving revision 1.102
> diff -u -r1.102 ufs_vnops.c
> --- ufs_vnops.c	2003/06/29 22:32:48	1.102
> +++ ufs_vnops.c	2003/07/16 17:12:34
> @@ -1538,7 +1538,8 @@
>  	VN_KNOTE(ap->a_dvp, NOTE_WRITE);
>  	vp = *vpp;
>  	len = strlen(ap->a_target);
> -	if (len < vp->v_mount->mnt_maxsymlinklen) {
> +	if (vp->v_mount->mnt_maxsymlinklen > 0 &&
> +	    len < vp->v_mount->mnt_maxsymlinklen) {
>  		ip = VTOI(vp);
>  		memcpy((char *)SHORTLINK(ip), ap->a_target, len);
>  		ip->i_size = len;
> @@ -1707,7 +1708,7 @@
>  	ip = VTOI(vp);
>  	isize = ip->i_size;
>  	if (isize < vp->v_mount->mnt_maxsymlinklen ||
> -	    (vp->v_mount->mnt_maxsymlinklen == 0 && DIP(ip, blocks) == 0)) {
> +	    (vp->v_mount->mnt_maxsymlinklen <= 0 && DIP(ip, blocks) == 0)) {
>  		uiomove((char *)SHORTLINK(ip), isize, ap->a_uio);
>  		return (0);
>  	}
> [snip]
> 

-- 
Jaromir Dolecek <jdolecek@NetBSD.org>            http://www.NetBSD.cz/
-=- We should be mindful of the potential goal, but as the tantric    -=-
-=- Buddhist masters say, ``You may notice during meditation that you -=-
-=- sometimes levitate or glow.   Do not let this distract you.''     -=-