From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: fbdev: fbcon: fix memory leak in error path of fbcon_do_set_font() Date: Tue, 26 May 2026 07:32:10 +1000 Message-ID: In-Reply-To: <20260525082741.600003-1-w15303746062@163.com> References: <20260525082741.600003-1-w15303746062@163.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Overall Series Review Subject: fbdev: fbcon: fix memory leak in error path of fbcon_do_set_font() Author: w15303746062@163.com Patches: 1 Reviewed: 2026-05-26T07:32:10.831353 --- This is a single patch (not a series) that fixes a real memory leak bug in `fbcon_do_set_font()`. The bug analysis is correct: in the error path (`err_out`), the `p->userfont = old_userfont` restoration was inside the `if (userfont)` block, meaning when setting a builtin font failed (i.e., `userfont == 0`), the userfont flag was never restored. This could leave `p->userfont == 0` while `p->fontdata` still pointed to a previously-allocated user font, causing `fbcon_free_font()` to skip freeing it on console teardown. **However, this patch does not apply to current mainline (drm-next).** As the author acknowledges, mainline has been refactored to use `font_data_t` with proper reference counting (`font_data_get()`/`font_data_put()`), which completely eliminated the `userfont` flag and the associated bug class. I confirmed that the current tree has zero references to `userfont` in `fbcon.c`, and the error path now simply calls `font_data_put(data)` to release the new font data. **This patch is only applicable to stable/older kernels (7.0 and earlier)** that still use the legacy `userfont` logic. It should be submitted to the stable mailing list (stable@vger.kernel.org) with the appropriate stable tree version targeting, not to dri-devel as a mainline patch. **Verdict: The fix is logically correct for the old code, but it is NAK for mainline since the code it modifies no longer exists. It needs to be resubmitted targeting the appropriate stable branches.** --- Generated by Claude Code Patch Reviewer