From: sashiko-bot@kernel.org
To: "Thomas Zimmermann" <tzimmermann@suse.de>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 3/3] drm/armada: Make armada_framebuffer_create() an internal interface
Date: Thu, 11 Jun 2026 07:28:21 +0000 [thread overview]
Message-ID: <20260611072821.F2A601F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260611072121.71492-4-tzimmermann@suse.de>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Reference leak of GEM object on error path in `armada_fb_create`
--
commit 6143d70290da395a0c8c1c0addd0695192664072
Author: Thomas Zimmermann <tzimmermann@suse.de>
drm/armada: Make armada_framebuffer_create() an internal interface
The only caller of armada_framebuffer_create() is armada_fb_create()
from the same source file. Declare the former as static.
> diff --git a/drivers/gpu/drm/armada/armada_fb.c b/drivers/gpu/drm/armada/armada_fb.c
> index b828bba419bfb..2f2348d543fd7 100644
> --- a/drivers/gpu/drm/armada/armada_fb.c
> +++ b/drivers/gpu/drm/armada/armada_fb.c
> @@ -18,10 +18,11 @@ static const struct drm_framebuffer_funcs armada_fb_funcs = {
> .create_handle = drm_gem_fb_create_handle,
> };
>
> -struct armada_framebuffer *armada_framebuffer_create(struct drm_device *dev,
> - const struct drm_format_info *info,
> - const struct drm_mode_fb_cmd2 *mode,
> - struct armada_gem_object *obj)
> +static struct armada_framebuffer *
> +armada_framebuffer_create(struct drm_device *dev,
> + const struct drm_format_info *info,
> + const struct drm_mode_fb_cmd2 *mode,
> + struct armada_gem_object *obj)
> {
[Severity: High]
This is a pre-existing issue, but while reviewing the caller of this newly
static function, it appears there might be a resource leak on the error path.
In armada_fb_create(), we get a reference to the GEM object:
obj = armada_gem_object_lookup(dfile, mode->handles[0]);
But if the call to armada_framebuffer_create() fails, the code jumps to the
'err' label instead of 'err_unref':
dfb = armada_framebuffer_create(dev, info, mode, obj);
if (IS_ERR(dfb)) {
ret = PTR_ERR(dfb);
goto err;
}
drm_gem_object_put(&obj->obj);
return &dfb->fb;
err_unref:
drm_gem_object_put(&obj->obj);
err:
DRM_ERROR("failed to initialize framebuffer: %d\n", ret);
Does this bypass the drm_gem_object_put() call and leak the GEM object
reference? Since armada_fb_create() is reachable from userspace via the
DRM_IOCTL_MODE_ADDFB2 ioctl, could a user repeatedly request invalid formats
to leak references and cause memory exhaustion?
> struct armada_framebuffer *dfb;
> uint8_t format, config;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260611072121.71492-1-tzimmermann@suse.de?part=3
prev parent reply other threads:[~2026-06-11 7:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-11 7:20 [PATCH v2 0/3] drm/armada: fbdev: Use client buffers Thomas Zimmermann
2026-06-11 7:20 ` [PATCH v2 1/3] drm/armada: fbdev: Calculate buffer geometry with format helpers Thomas Zimmermann
2026-06-11 7:30 ` sashiko-bot
2026-06-11 7:20 ` [PATCH v2 2/3] drm/armada: fbdev: Use a DRM client buffer Thomas Zimmermann
2026-06-11 7:20 ` [PATCH v2 3/3] drm/armada: Make armada_framebuffer_create() an internal interface Thomas Zimmermann
2026-06-11 7:28 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260611072821.F2A601F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.