summaryrefslogtreecommitdiff
path: root/rust/kernel/debugfs/file_ops.rs
diff options
context:
space:
mode:
authorMa Ke <make24@iscas.ac.cn>2025-09-30 16:16:18 +0800
committerRob Herring (Arm) <robh@kernel.org>2025-10-01 09:33:23 -0500
commita8de554774ae48efbe48ace79f8badae2daa2bf1 (patch)
tree341d1eb856c7c311beefdec05914b05da5de5637 /rust/kernel/debugfs/file_ops.rs
parent4e66293bb141df33d5eb1f922e16fe05913bf296 (diff)
of: unittest: Fix device reference count leak in of_unittest_pci_node_verify
In of_unittest_pci_node_verify(), when the add parameter is false, device_find_any_child() obtains a reference to a child device. This function implicitly calls get_device() to increment the device's reference count before returning the pointer. However, the caller fails to properly release this reference by calling put_device(), leading to a device reference count leak. Add put_device() in the else branch immediately after child_dev is no longer needed. As the comment of device_find_any_child states: "NOTE: you will need to drop the reference with put_device() after use". Found by code review. Cc: stable@vger.kernel.org Fixes: 26409dd04589 ("of: unittest: Add pci_dt_testdrv pci driver") Signed-off-by: Ma Ke <make24@iscas.ac.cn> Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Diffstat (limited to 'rust/kernel/debugfs/file_ops.rs')
0 files changed, 0 insertions, 0 deletions