Author: davide
Date: Mon Nov 26 04:29:47 2012
New Revision: 243548
URL: http://svnweb.freebsd.org/changeset/base/243548

Log:
  - smbfs_rename() might return an error value without correctly upgrading
  the vnode use count, and this might cause the kernel to panic if compiled
  with WITNESS enable.
  - Be sure to put the '\0' terminator to the rpath string.
  
  Sponsored by: iXsystems inc.

Modified:
  head/sys/fs/smbfs/smbfs_node.c
  head/sys/fs/smbfs/smbfs_vnops.c

Modified: head/sys/fs/smbfs/smbfs_node.c
==============================================================================
--- head/sys/fs/smbfs/smbfs_node.c      Mon Nov 26 04:26:27 2012        
(r243547)
+++ head/sys/fs/smbfs/smbfs_node.c      Mon Nov 26 04:29:47 2012        
(r243548)
@@ -187,6 +187,7 @@ smbfs_node_alloc(struct mount *mp, struc
                bcopy(name, p, nmlen);
                p += nmlen;
        }
+       *p = '\0';
        MPASS(p == rpath + rplen);
        lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL);
        /* Vnode initialization */

Modified: head/sys/fs/smbfs/smbfs_vnops.c
==============================================================================
--- head/sys/fs/smbfs/smbfs_vnops.c     Mon Nov 26 04:26:27 2012        
(r243547)
+++ head/sys/fs/smbfs/smbfs_vnops.c     Mon Nov 26 04:29:47 2012        
(r243548)
@@ -583,12 +583,12 @@ smbfs_rename(ap)
        /* Check for cross-device rename */
        if ((fvp->v_mount != tdvp->v_mount) ||
            (tvp && (fvp->v_mount != tvp->v_mount))) {
-               return EXDEV;
+               error = EXDEV;
                goto out;
        }
 
        if (tvp && vrefcnt(tvp) > 1) {
-               return EBUSY;
+               error = EBUSY;
                goto out;
        }
        flags = 0x10;                   /* verify all writes */
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to