]> git.baikalelectronics.ru Git - kernel.git/commit
drivers: base: dd: fix memory leak with using debugfs_lookup()
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 Feb 2023 14:16:21 +0000 (15:16 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 11 Mar 2023 12:55:39 +0000 (13:55 +0100)
commit57a6b03aea908a47a4ad423c9fff5b1287d8c5ca
treeba82ed1cb6c326aad2b5de347f2d91db4c7162c9
parent678c7fe435e3c3f578c83c42c0c04c008c8ff3ba
drivers: base: dd: fix memory leak with using debugfs_lookup()

[ Upstream commit 1c269147203bd08a2cad90bf8beaca6a5ed43294 ]

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: "Rafael J. Wysocki" <rafael@kernel.org>
Link: https://lore.kernel.org/r/20230202141621.2296458-2-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/base/dd.c