[Skiboot] [PATCH] opal: use for_each_safe to iterate over opal_syncers

Stewart Smith stewart at linux.ibm.com
Tue Sep 18 17:37:54 AEST 2018

Vaibhav Jain <vaibhav at linux.ibm.com> writes:
> Presently a fault will happen in opal_sync_host_reboot if a callback
> tries to remove itself from the opal_syncers list by calling
> opal_del_host_sync_notifier.
> This happens as iteration over opal_syncers is done using the
> list_for_each() which doesn't preserve list_node->next. So when
> the current opal_syncers callback removes itself from the list, current
> node contents are lost and current_node->next pointer is rendered
> invalid.
> To fix this we simply switch from list_for_each() to
> list_for_each_safe() which keeps the current_node->next cached hence
> even if the current node is freed, iteration over subsequent nodes can
> still continue.
> Signed-off-by: Vaibhav Jain <vaibhav at linux.ibm.com>
> ---
>  core/opal.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Fair enough, merged to master as of 5f728c53d42c664234b45a33218ba522a6e8f216
Stewart Smith
OPAL Architect, IBM.

More information about the Skiboot mailing list