Print this page
7656 unlinking directory on tmpfs can cause kernel panic

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/tmpfs/tmp_vnops.c
          +++ new/usr/src/uts/common/fs/tmpfs/tmp_vnops.c
↓ open down ↓ 1097 lines elided ↑ open up ↑
1098 1098          error = tdirlookup(parent, nm, &tp, cred);
1099 1099          if (error)
1100 1100                  return (error);
1101 1101  
1102 1102          ASSERT(tp);
1103 1103          rw_enter(&parent->tn_rwlock, RW_WRITER);
1104 1104          rw_enter(&tp->tn_rwlock, RW_WRITER);
1105 1105  
1106 1106          if (tp->tn_type != VDIR ||
1107 1107              (error = secpolicy_fs_linkdir(cred, dvp->v_vfsp)) == 0)
1108      -                error = tdirdelete(parent, tp, nm, tp->tn_type == VDIR ?
1109      -                    DR_RMDIR : DR_REMOVE, cred);
     1108 +                error = tdirdelete(parent, tp, nm, DR_REMOVE, cred);
1110 1109  
1111 1110          rw_exit(&tp->tn_rwlock);
1112 1111          rw_exit(&parent->tn_rwlock);
1113 1112          vnevent_remove(TNTOV(tp), dvp, nm, ct);
1114 1113          tmpnode_rele(tp);
1115 1114  
1116 1115          TRACE_3(TR_FAC_TMPFS, TR_TMPFS_REMOVE,
1117 1116              "tmpfs remove:dvp %p nm %s error %d", dvp, nm, error);
1118 1117          return (error);
1119 1118  }
↓ open down ↓ 1352 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX