Commit e681f878 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Todd Kjos
Browse files

UPSTREAM: debugfs: add debugfs_lookup_and_remove()



There is a very common pattern of using
debugfs_remove(debufs_lookup(..)) which results in a dentry leak of the
dentry that was looked up.  Instead of having to open-code the correct
pattern of calling dput() on the dentry, create
debugfs_lookup_and_remove() to handle this pattern automatically and
properly without any memory leaks.

Bug: 255284914

Cc: stable <stable@kernel.org>
Reported-by: default avatarKuyo Chang <kuyo.chang@mediatek.com>
Tested-by: default avatarKuyo Chang <kuyo.chang@mediatek.com>
Link: https://lore.kernel.org/r/YxIaQ8cSinDR881k@kroah.com


Change-Id: I9cf6f7213406a48fcc290d0c8816a9f3338ea732
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit dec9b2f1
git: //git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git)
Signed-off-by: default avatarXuewen Yan <xuewen.yan@unisoc.com>
parent 08ef1640
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment