Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1ee6d052 authored by Ashok Vuyyuru's avatar Ashok Vuyyuru
Browse files

msm: ipa3: Fix to null pointer access



After PM client deregister trying to access the PM handle causing the
NULL pointer access. Adding changes to avoid NULL pointer access.

Change-Id: Ieee7864989e8c54f09c8df659bfc91dca8e89b3b
Signed-off-by: default avatarAshok Vuyyuru <avuyyuru@codeaurora.org>
parent 6aaa5e31
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
 */

#include <linux/debugfs.h>
@@ -459,6 +459,11 @@ static void delayed_deferred_deactivate_work_func(struct work_struct *work)
	dwork = container_of(work, struct delayed_work, work);
	client = container_of(dwork, struct ipa_pm_client, deactivate_work);

	if (unlikely(client == NULL)) {
		IPA_PM_ERR("Client already deregistered\n");
		return;
	}

	spin_lock_irqsave(&client->state_lock, flags);
	IPA_PM_DBG_STATE(client->hdl, client->name, client->state);
	switch (client->state) {
@@ -1188,6 +1193,8 @@ int ipa_pm_deactivate_sync(u32 hdl)
	client->state = IPA_PM_DEACTIVATED;
	IPA_PM_DBG_STATE(hdl, client->name, client->state);
	spin_unlock_irqrestore(&client->state_lock, flags);
	/*Check any delayed work queue scheduled*/
	cancel_delayed_work_sync(&client->deactivate_work);
	deactivate_client(hdl);
	do_clk_scaling();