[PATCH 4/5] firewire: core: Prevent device_find_child() from modifying caller's match data
From: Zijun Hu
Date: Sat Aug 10 2024 - 20:20:07 EST
From: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
It does not make sense for lookup_existing_device() as match function
of device_find_child() to modify caller's match data, fixed by using
constify_device_find_child_helper() instead of device_find_child().
Signed-off-by: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
---
drivers/firewire/core-device.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c
index 00e9a13e6c45..04b150bc876d 100644
--- a/drivers/firewire/core-device.c
+++ b/drivers/firewire/core-device.c
@@ -1087,8 +1087,9 @@ static void fw_device_init(struct work_struct *work)
return;
}
- revived_dev = device_find_child(card->device,
- device, lookup_existing_device);
+ revived_dev = constify_device_find_child_helper(card->device,
+ device,
+ lookup_existing_device);
if (revived_dev) {
put_device(revived_dev);
fw_device_release(&device->device);
--
2.34.1