···703703 xfs_trans_log_inode(tp, dp, XFS_ILOG_CORE);704704 return 0;705705}706706+707707+/* Returns true if the directory entry name is valid. */708708+bool709709+xfs_dir2_namecheck(710710+ const void *name,711711+ size_t length)712712+{713713+ /*714714+ * MAXNAMELEN includes the trailing null, but (name/length) leave it715715+ * out, so use >= for the length check.716716+ */717717+ if (length >= MAXNAMELEN)718718+ return false;719719+720720+ /* There shouldn't be any slashes or nulls here */721721+ return !memchr(name, '/', length) && !memchr(name, 0, length);722722+}
···129129 goto out;130130 }131131132132+ /* Does this name make sense? */133133+ if (!xfs_dir2_namecheck(name, namelen)) {134134+ xchk_fblock_set_corrupt(sdc->sc, XFS_DATA_FORK, offset);135135+ goto out;136136+ }137137+132138 if (!strncmp(".", name, namelen)) {133139 /* If this is "." then check that the inum matches the dir. */134140 if (xfs_sb_version_hasftype(&mp->m_sb) && type != DT_DIR)