@@ -281,6 +281,12 @@ struct dentry *securityfs_create_symlink(const char *name,
281281}
282282EXPORT_SYMBOL_GPL (securityfs_create_symlink );
283283
284+ static void remove_one (struct dentry * victim )
285+ {
286+ if (victim -> d_parent == victim -> d_sb -> s_root )
287+ simple_release_fs (& mount , & mount_count );
288+ }
289+
284290/**
285291 * securityfs_remove - removes a file or directory from the securityfs filesystem
286292 *
@@ -293,44 +299,11 @@ EXPORT_SYMBOL_GPL(securityfs_create_symlink);
293299 * This function is required to be called in order for the file to be
294300 * removed. No automatic cleanup of files will happen when a module is
295301 * removed; you are responsible here.
296- */
297- void securityfs_remove (struct dentry * dentry )
298- {
299- struct inode * dir ;
300-
301- if (IS_ERR_OR_NULL (dentry ))
302- return ;
303-
304- dir = d_inode (dentry -> d_parent );
305- inode_lock (dir );
306- if (simple_positive (dentry )) {
307- if (d_is_dir (dentry ))
308- simple_rmdir (dir , dentry );
309- else
310- simple_unlink (dir , dentry );
311- }
312- inode_unlock (dir );
313- if (dir == dir -> i_sb -> s_root -> d_inode )
314- simple_release_fs (& mount , & mount_count );
315- }
316- EXPORT_SYMBOL_GPL (securityfs_remove );
317-
318- static void remove_one (struct dentry * victim )
319- {
320- if (victim -> d_parent == victim -> d_sb -> s_root )
321- simple_release_fs (& mount , & mount_count );
322- }
323-
324- /**
325- * securityfs_recursive_remove - recursively removes a file or directory
326- *
327- * @dentry: a pointer to a the dentry of the file or directory to be removed.
328302 *
329- * This function recursively removes a file or directory in securityfs that was
330- * previously created with a call to another securityfs function (like
331- * securityfs_create_file() or variants thereof.)
303+ * AV: when applied to directory it will take all children out; no need to call
304+ * it for descendents if ancestor is getting killed.
332305 */
333- void securityfs_recursive_remove (struct dentry * dentry )
306+ void securityfs_remove (struct dentry * dentry )
334307{
335308 if (IS_ERR_OR_NULL (dentry ))
336309 return ;
@@ -339,7 +312,7 @@ void securityfs_recursive_remove(struct dentry *dentry)
339312 simple_recursive_removal (dentry , remove_one );
340313 simple_release_fs (& mount , & mount_count );
341314}
342- EXPORT_SYMBOL_GPL (securityfs_recursive_remove );
315+ EXPORT_SYMBOL_GPL (securityfs_remove );
343316
344317#ifdef CONFIG_SECURITY
345318static struct dentry * lsm_dentry ;
0 commit comments