kernel - Fix cross-mount handling in tmpfs hardlink code
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 22 Feb 2013 21:03:04 +0000 (13:03 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 22 Feb 2013 21:03:04 +0000 (13:03 -0800)
* Fix tmpfs to properly report EXDEV when a cross-mount hardlink is
  attempted instead of asserting and causing a panic.

Reported-by: ftigeot
sys/vfs/tmpfs/tmpfs_vnops.c

index c52ef65..619af37 100644 (file)
@@ -935,8 +935,9 @@ tmpfs_nlink(struct vop_nlink_args *v)
        struct mount *mp;
        int error;
 
+       if (dvp->v_mount != vp->v_mount)
+               return(EXDEV);
        mp = dvp->v_mount;
-       KKASSERT(dvp->v_mount == vp->v_mount);
 
        lwkt_gettoken(&mp->mnt_token);
        KKASSERT(dvp != vp); /* XXX When can this be false? */