]> git.baikalelectronics.ru Git - kernel.git/commit
USB: gadget: lpc32xx_udc: fix memory leak with using debugfs_lookup()
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 Feb 2023 15:32:32 +0000 (16:32 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 11 Mar 2023 12:55:37 +0000 (13:55 +0100)
commite270ad41ee4d4b8212750861b0cdd95d4647f29e
treec8c3da1ce633434fac3b2b834ed4c5818d2e7731
parentc684daade37270de2bd7fffc42c14a76dcf84313
USB: gadget: lpc32xx_udc: fix memory leak with using debugfs_lookup()

[ Upstream commit ad7ade0444342c5198ee88c63cc280cce433d850 ]

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: Jakob Koschel <jakobkoschel@gmail.com>
Cc: Miaoqian Lin <linmq006@gmail.com>
Acked-by: Vladimir Zapolskiy <vz@mleia.com>
Link: https://lore.kernel.org/r/20230202153235.2412790-10-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/gadget/udc/lpc32xx_udc.c