From 27fe8e06f3ceb6bcd606daeca5fb572c1ccdb9e7 Mon Sep 17 00:00:00 2001 From: Mikael Olsson Date: Wed, 23 Aug 2023 10:43:08 +0200 Subject: Fix mailbox clean up on inference request failure When an inference request fails, the mailbox message registered for the request is not unregistered, causing the mailbox's IDR to be left with an entry for the message with a dangling pointer to the freed inference. The dangling pointer later causes the mailbox clean up to crash when it attempts to call the fail callback for the IDR entry. The clean up for a failed inference request has now been fixed so it unregisters the message from the mailbox. Change-Id: Ida8015c88afee9cad074289be4d65947854c9e6b Signed-off-by: Mikael Olsson --- kernel/ethosu_inference.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/ethosu_inference.c b/kernel/ethosu_inference.c index 50007d0..6d3405d 100644 --- a/kernel/ethosu_inference.c +++ b/kernel/ethosu_inference.c @@ -385,6 +385,8 @@ put_ifm: while (inf->ifm_count-- > 0) ethosu_buffer_put(inf->ifm[inf->ifm_count]); + ethosu_mailbox_deregister(mailbox, &inf->msg); + kfree: memset(inf, 0, sizeof(*inf)); devm_kfree(dev, inf); -- cgit v1.2.1