tilcdc: tilcdc_external: fix an incorrect NULL check on list iterator
stable inclusion from stable-v5.10.121 commit c521f42dd241aacb78599aeb879aac14334fd9be category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I5L6CQ Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=c521f42dd241aacb78599aeb879aac14334fd9be -------------------------------- commit 8b917cbe upstream. The bug is here: if (!encoder) { The list iterator value 'encoder' will *always* be set and non-NULL by list_for_each_entry(), so it is incorrect to assume that the iterator value will be NULL if the list is empty or no element is found. To fix the bug, use a new variable 'iter' as the list iterator, while use the original variable 'encoder' as a dedicated pointer to point to the found element. Cc: stable@vger.kernel.org Fixes: ec9eab09 ("drm/tilcdc: Add drm bridge support for attaching drm bridge drivers") Signed-off-by:Xiaomeng Tong <xiam0nd.tong@gmail.com> Reviewed-by:
Jyri Sarha <jyri.sarha@iki.fi> Tested-by:
Jyri Sarha <jyri.sarha@iki.fi> Signed-off-by:
Jyri Sarha <jyri.sarha@iki.fi> Link: https://patchwork.freedesktop.org/patch/msgid/20220327061516.5076-1-xiam0nd.tong@gmail.com Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by:
Zheng Zengkai <zhengzengkai@huawei.com> Acked-by:
Xie XiuQi <xiexiuqi@huawei.com>
Loading
Please sign in to comment