projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b32d922
)
USB: fix memory leak with using debugfs_lookup()
author
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Fri, 6 Jan 2023 15:28:28 +0000
(16:28 +0100)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Sat, 11 Mar 2023 12:57:34 +0000
(13:57 +0100)
[ Upstream commit
30374434edab20e25776f8ecb4bc9d1e54309487
]
When calling debugfs_lookup() the result must have dput() called on it,
otherwise the memory will leak over time. To make things simpler, just
call debugfs_lookup_and_remove() instead which handles all of the logic at
once.
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Jilin Yuan <yuanjilin@cdjrlc.com>
Link:
https://lore.kernel.org/r/20230106152828.3790902-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/core/usb.c
patch
|
blob
|
history
diff --git
a/drivers/usb/core/usb.c
b/drivers/usb/core/usb.c
index 62368c4ed37afb840dc180f42b92565b674d5043..cc36f9f228148dc3f92b5b7ea09ac52f35a3d07d 100644
(file)
--- a/
drivers/usb/core/usb.c
+++ b/
drivers/usb/core/usb.c
@@
-1036,7
+1036,7
@@
static void usb_debugfs_init(void)
static void usb_debugfs_cleanup(void)
{
- debugfs_
remove(debugfs_lookup("devices", usb_debug_root)
);
+ debugfs_
lookup_and_remove("devices", usb_debug_root
);
}
/*