]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
ASoC: soc-dapm: fix two incorrect uses of list iterator
authorXiaomeng Tong <xiam0nd.tong@gmail.com>
Tue, 29 Mar 2022 01:21:34 +0000 (09:21 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 22 Jun 2022 12:22:21 +0000 (14:22 +0200)
commited10cc3d1af93d075eabba4fc25218bc601df0e1
treed9fd754d9e27a99c4e05526c717ad12bf9e53d7d
parent92dfcf0b2ba8c827c358677b93901fc206da96ac
ASoC: soc-dapm: fix two incorrect uses of list iterator

BugLink: https://bugs.launchpad.net/bugs/1972905
commit f730a46b931d894816af34a0ff8e4ad51565b39f upstream.

These two bug are here:
list_for_each_entry_safe_continue(w, n, list,
power_list);
list_for_each_entry_safe_continue(w, n, list,
power_list);

After the list_for_each_entry_safe_continue() exits, the list iterator
will always be a bogus pointer which point to an invalid struct objdect
containing HEAD member. The funciton poniter 'w->event' will be a
invalid value which can lead to a control-flow hijack if the 'w' can be
controlled.

The original intention was to continue the outer list_for_each_entry_safe()
loop with the same entry if w->event is NULL, but misunderstanding the
meaning of list_for_each_entry_safe_continue().

So just add a 'continue;' to fix the bug.

Cc: stable@vger.kernel.org
Fixes: 163cac061c973 ("ASoC: Factor out DAPM sequence execution")
Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Link: https://lore.kernel.org/r/20220329012134.9375-1-xiam0nd.tong@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
sound/soc/soc-dapm.c