[PATCH master 2/2] FIT: fuzz: fix reference count underflow
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Jan 26 02:44:30 PST 2026
Now that FIT images are reference counted, we need to initialize the
count to 1, otherwise __fit_close will underflow it.
Reported-by: Claude Sonnet 4.5 <noreply at anthropic.com>
Fixes: f3aadb274abe ("FIT: add support to cache opened fit images")
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
Issue was found by Claude while reviewing the previous patch
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
common/image-fit.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/common/image-fit.c b/common/image-fit.c
index b5d0e2e5381f..26bd8e265b25 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1120,6 +1120,8 @@ static int fuzz_fit(const u8 *data, size_t size)
handle.fit = data;
handle.fit_alloc = NULL;
+ refcount_set(&handle.users, 1);
+
ret = fit_do_open(&handle);
if (ret)
goto out;
--
2.47.3
More information about the barebox
mailing list