mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
hwspinlock: rockchip: object to unlocking someone else's lock
Check hwlock user id and object to unlocking someone else's lock when invoking unlock() API. Signed-off-by: Frank Wang <frank.wang@rock-chips.com> Change-Id: I46c256fd703fa56ce3d175ff2d721f53d3615ec0
This commit is contained in:
@@ -45,6 +45,14 @@ static int rockchip_hwspinlock_trylock(struct hwspinlock *lock)
|
||||
static void rockchip_hwspinlock_unlock(struct hwspinlock *lock)
|
||||
{
|
||||
void __iomem *lock_addr = lock->priv;
|
||||
u32 lock_owner = readl(lock_addr) & HWSPINLOCK_ID_MASK;
|
||||
|
||||
if (lock_owner != hwlock_user_id) {
|
||||
dev_warn(lock->bank->dev,
|
||||
"WARNING: against user %u release a lock held by %u\n",
|
||||
hwlock_user_id, lock_owner);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Release the lock by writing 0 to it */
|
||||
writel(0, lock_addr);
|
||||
|
||||
Reference in New Issue
Block a user