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

Commit 5c134be0 authored by Liangwei Dong's avatar Liangwei Dong Committed by nshrivas
Browse files

qcacmn: Clear lock->lock.dev to NULL after wake lock destroyed

In kernel 5.4, Wake lock API wakeup_source_register requires
"struct device *" parameter, and it can be NULL value. If it is
NULL, the wakeup_source_register will create a "device" node and return
it by wakeup_source struct.
In qcacld driver, the qdf_wake_lock_create will save the "wakeup_source"
to cld's private struct qdf_wake_lock->lock.
When the cld driver destroy os wake lock by wakeup_source_unregister,
"dev" will also be invalid in kernel, we need to clear the "dev"
field in local copy of wakeup_source in qdf_wake_lock->lock.
This will fix the potential reuse of qdf_wake_lock->lock.dev after it has
been destroyed.

Change-Id: I1de6e95c64b35929bef8be2cdeeb86422bc38515
CRs-Fixed: 2634032
parent 967cabbd
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -269,6 +269,7 @@ qdf_export_symbol(qdf_wake_lock_name);
	defined(WAKEUP_SOURCE_DEV)
QDF_STATUS qdf_wake_lock_create(qdf_wake_lock_t *lock, const char *name)
{
	qdf_mem_zero(lock, sizeof(*lock));
	lock->priv = wakeup_source_register(lock->lock.dev, name);
	if (!(lock->priv)) {
		QDF_BUG(0);