thunderbolt: Fix memory leak in margining_port_remove()
authorYaxiong Tian <tianyaxiong@kylinos.cn>
Wed, 22 Nov 2023 08:02:43 +0000 (16:02 +0800)
committerMika Westerberg <mika.westerberg@linux.intel.com>
Mon, 27 Nov 2023 10:45:47 +0000 (12:45 +0200)
commitac43c9122e4287bbdbe91e980fc2528acb72cc1e
treed45f106dc4f564c46746379622739b7c03a9282b
parent2cc14f52aeb78ce3f29677c2de1f06c0e91471ab
thunderbolt: Fix memory leak in margining_port_remove()

The dentry returned by debugfs_lookup() needs to be released by calling
dput() which is missing in margining_port_remove(). Fix this by calling
debugfs_lookup_and_remove() that combines both and avoids the memory leak.

Fixes: d0f1e0c2a699 ("thunderbolt: Add support for receiver lane margining")
Cc: stable@vger.kernel.org
Signed-off-by: Yaxiong Tian <tianyaxiong@kylinos.cn>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/thunderbolt/debugfs.c