Re: segfault with latest arm64 linux kernel build

Dan Carpenter <[email protected]> Wed, 17 Jun 2026 17:37:02 +0300
Newsgroups org.kernel.vger.linux-sparse
Message-ID <[email protected]>
There is a NULL dereference parsing a goto.

The got is in the msm_gem_lock_vm_and_obj() function when it calls
the drm_exec_retry_on_contention(exec) macro.

The pre-processed code looks something like this:

__UNIQUE_ID_drm_exec_1299:
	for (void *const __attribute__((__unused__)) __drm_exec_retry_ptr = &&__UNIQUE_ID_drm_exec_1299;
		drm_exec_cleanup(exec);) {
...
		if (drm_exec_is_contended(exec))
			goto *__drm_exec_retry_ptr;

Adding a NULL check fixes the crash but that might not be the
right way to actually fix it.

---
 simplify.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/simplify.c b/simplify.c
index 68c5f9c74021..897fc827dc98 100644
--- a/simplify.c
+++ b/simplify.c
@@ -2734,7 +2734,7 @@ static int simplify_cgoto(struct instruction *insn)
 		break;
 	case OP_LABEL:
 		target = def->bb_true;
-		if (!target->ep)
+		if (!target || !target->ep)
 			return 0;
 		FOR_EACH_PTR(insn->multijmp_list, jmp) {
 			if (jmp->target == target)
-- 
2.53.0