misc: bluedroid_pm: Verify wakeup registration

The structure returned from the function wakeup_source_register() is not
currently checked to see that a valid structure is returned. If
wakeup_source_register fails to register the wake-up source, then this
function will return a NULL pointer and this will lead to a crash when
defereferencing this pointer. Therefore, check that a valid structure is
returned from wakeup_source_register() and if not then return an error
from the probe function.

JIRA LINQPJ14-60
Bug 4958861

Change-Id: I03356700ab03d6c25080b3806ea8b7da3983a302
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3394894
(cherry picked from commit 14286052fb9dd496b243221fa1066f828451b294)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3405519
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Jon Hunter
2025-06-27 11:23:04 +01:00
committed by mobile promotions
parent 8407ab4b3e
commit 7c70fbf0cf

View File

@@ -470,6 +470,11 @@ static int bluedroid_pm_probe(struct platform_device *pdev)
/* initialize wake lock */ /* initialize wake lock */
bluedroid_pm->wake_lock = wakeup_source_register(&pdev->dev, bluedroid_pm->wake_lock = wakeup_source_register(&pdev->dev,
dev_name(&pdev->dev)); dev_name(&pdev->dev));
if (!bluedroid_pm->wake_lock) {
BDP_ERR("Failed to register wakeup source");
goto free_ext_wake;
}
/* Initialize timer */ /* Initialize timer */
timer_setup(&bluedroid_pm->bluedroid_pm_timer, timer_setup(&bluedroid_pm->bluedroid_pm_timer,
bluedroid_pm_timer_expire, 0); bluedroid_pm_timer_expire, 0);