Commit b62892ca authored by Alexander Shishkin's avatar Alexander Shishkin Committed by Stefan Bader

stm class: Fix unlocking braino in the error path

BugLink: https://bugs.launchpad.net/bugs/1826212

[ Upstream commit 1810f2c4 ]

If an illegal attempt is made to unlink stm source device from an
stm device, the stm device's link spinlock mistakenly remains locked.
While this really shouldn't happen (there's a warning in place), the
locking should remain in order so that we can still recover from this
situation if it indeed does happen.

This patch unifies the unlocking in the exit path of
__stm_source_link_drop() to fix this.
Reported-by: default avatarLaurent Fert <laurent.fert@intel.com>
Signed-off-by: default avatarAlexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 9391b33e
......@@ -817,10 +817,8 @@ static void __stm_source_link_drop(struct stm_source_device *src,
spin_lock(&stm->link_lock);
spin_lock(&src->link_lock);
link = srcu_dereference_check(src->link, &stm_source_srcu, 1);
if (WARN_ON_ONCE(link != stm)) {
spin_unlock(&src->link_lock);
return;
}
if (WARN_ON_ONCE(link != stm))
goto unlock;
stm_output_free(link, &src->output);
list_del_init(&src->link_entry);
......@@ -828,6 +826,7 @@ static void __stm_source_link_drop(struct stm_source_device *src,
stm_put_device(link);
rcu_assign_pointer(src->link, NULL);
unlock:
spin_unlock(&src->link_lock);
spin_unlock(&stm->link_lock);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment