From 565476d3b2959db954384b424de0947a870053cb Mon Sep 17 00:00:00 2001 From: Lars-Ivar Hesselberg Simonsen Date: Fri, 8 Nov 2024 16:25:40 +0100 Subject: [PATCH] pan/genxml: Fix decode of exception_handler 0x0 Fixes the check for address 0x0 or length 0 when decoding set_exception_handler. Reviewed-by: Boris Brezillon Part-of: --- src/panfrost/lib/genxml/decode_csf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/panfrost/lib/genxml/decode_csf.c b/src/panfrost/lib/genxml/decode_csf.c index 68af25f05a2..474537a4801 100644 --- a/src/panfrost/lib/genxml/decode_csf.c +++ b/src/panfrost/lib/genxml/decode_csf.c @@ -837,6 +837,12 @@ interpret_ceu_jump(struct pandecode_context *ctx, struct queue_ctx *qctx, /* Map the entire subqueue now */ uint64_t address = ((uint64_t)address_hi << 32) | address_lo; + /* Return if the jump is for an exception handler that's set to zero */ + if (qctx->in_exception_handler && (!address || !length)) { + qctx->in_exception_handler = false; + qctx->call_stack_depth--; + return true; + } uint64_t *cs = pandecode_fetch_gpu_mem(ctx, address, length); qctx->ip = cs; @@ -980,8 +986,6 @@ interpret_ceu_instr(struct pandecode_context *ctx, struct queue_ctx *qctx) case MALI_CS_OPCODE_SET_EXCEPTION_HANDLER: { pan_unpack(bytes, CS_SET_EXCEPTION_HANDLER, I); - if (!I.address) return true; - assert(qctx->call_stack_depth < MAX_CALL_STACK_DEPTH); qctx->ip++;