Skip to content

Commit bad356b

Browse files
author
Al Viro
committed
functionfs, gadgetfs: use simple_recursive_removal()
usual mount leaks if something had been bound on top of disappearing files there. Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 1664a91 commit bad356b

2 files changed

Lines changed: 2 additions & 8 deletions

File tree

drivers/usb/gadget/function/f_fs.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2369,8 +2369,7 @@ static void ffs_epfiles_destroy(struct ffs_epfile *epfiles, unsigned count)
23692369
for (; count; --count, ++epfile) {
23702370
BUG_ON(mutex_is_locked(&epfile->mutex));
23712371
if (epfile->dentry) {
2372-
d_delete(epfile->dentry);
2373-
dput(epfile->dentry);
2372+
simple_recursive_removal(epfile->dentry, NULL);
23742373
epfile->dentry = NULL;
23752374
}
23762375
}

drivers/usb/gadget/legacy/inode.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,7 +1561,6 @@ static void destroy_ep_files (struct dev_data *dev)
15611561
spin_lock_irq (&dev->lock);
15621562
while (!list_empty(&dev->epfiles)) {
15631563
struct ep_data *ep;
1564-
struct inode *parent;
15651564
struct dentry *dentry;
15661565

15671566
/* break link to FS */
@@ -1571,7 +1570,6 @@ static void destroy_ep_files (struct dev_data *dev)
15711570

15721571
dentry = ep->dentry;
15731572
ep->dentry = NULL;
1574-
parent = d_inode(dentry->d_parent);
15751573

15761574
/* break link to controller */
15771575
mutex_lock(&ep->lock);
@@ -1586,10 +1584,7 @@ static void destroy_ep_files (struct dev_data *dev)
15861584
put_ep (ep);
15871585

15881586
/* break link to dcache */
1589-
inode_lock(parent);
1590-
d_delete (dentry);
1591-
dput (dentry);
1592-
inode_unlock(parent);
1587+
simple_recursive_removal(dentry, NULL);
15931588

15941589
spin_lock_irq (&dev->lock);
15951590
}

0 commit comments

Comments
 (0)