devfs - Fix broken assertion
authorMatthew Dillon <dillon@apollo.backplane.com>
Wed, 20 Oct 2010 16:45:19 +0000 (09:45 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Wed, 20 Oct 2010 16:45:19 +0000 (09:45 -0700)
* When checking fp->f_flag against ap->a_mode both sides must be
  masked with FMASK.

* Fixes a panic which can occur when a unix domain socket is being
  garbage collected (FMARK set).

sys/vfs/devfs/devfs_vnops.c

index 4916632..013e06f 100644 (file)
@@ -996,7 +996,7 @@ devfs_spec_open(struct vop_open_args *ap)
 
        if (ap->a_fp) {
                KKASSERT(ap->a_fp->f_type == DTYPE_VNODE);
-               KKASSERT(ap->a_fp->f_flag == (ap->a_mode & FMASK));
+               KKASSERT((ap->a_fp->f_flag & FMASK) == (ap->a_mode & FMASK));
                ap->a_fp->f_ops = &devfs_dev_fileops;
                KKASSERT(ap->a_fp->f_data == (void *)vp);
        }