All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: "Marcin Ślusarz" <marcin.slusarz@arm.com>
Cc: "Adrián Larumbe" <adrian.larumbe@collabora.com>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	"Steven Price" <steven.price@arm.com>,
	kernel@collabora.com, "Liviu Dudau" <liviu.dudau@arm.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Alice Ryhl" <aliceryhl@google.com>,
	nd@arm.com
Subject: Re: [PATCH v10 5/6] drm/panthor: Support sparse mappings
Date: Tue, 5 May 2026 10:33:45 +0200	[thread overview]
Message-ID: <20260505103345.5bc1984a@fedora> (raw)
In-Reply-To: <afmm-gRz7W3LTW3H@e129842.arm.com>

On Tue, 5 May 2026 10:14:50 +0200
Marcin Ślusarz <marcin.slusarz@arm.com> wrote:

> On Wed, Apr 29, 2026 at 07:32:17PM +0100, Adri�n Larumbe wrote:
> > @@ -1651,6 +1715,13 @@ int panthor_vm_pool_create(struct panthor_file *pfile)
> >  		return -ENOMEM;
> >  
> >  	xa_init_flags(&pfile->vms->xa, XA_FLAGS_ALLOC1);
> > +
> > +	pfile->vms->dummy = panthor_dummy_bo_create(pfile->ptdev);
> > +	if (IS_ERR(pfile->vms->dummy)) {
> > +		kfree(pfile->vms);
> > +		return PTR_ERR(pfile->vms->dummy);  
> 
> This is use-after-free.

Indeed. Let's add a proper error path where panthor_vm_pool_destroy()
is called to make sure we don't leak resources when an error occurs
anywhere in the creation path, and let's make panthor_vm_pool_destroy()
safe against dummy=NULL.

void panthor_vm_pool_destroy(struct panthor_file *pfile)
{
...

	if (pfile->vms->dummy)
		drm_gem_object_put(&pfile->vms->dummy->base);

...
}

int panthor_vm_pool_create(struct panthor_file *pfile)
{
	struct panthor_gem_object *dummy;

	...

	dummy = panthor_dummy_bo_create(pfile->ptdev);
	if (IS_ERR(dummy)) {
		ret = PTR_ERR(dummy);
		goto err_destroy_vm_pool;
	}

	pfile->vms->dummy = dummy;

	...

	return 0;

err_destroy_vm_pool:
	panthor_vm_pool_destroy(pfile);
	return ret;
}

> 
> > +	}
> > +
> >  	return 0;
> >  }  


  reply	other threads:[~2026-05-05  8:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-29 18:32 [PATCH v10 0/6] Support sparse mappings in Panthor Adrián Larumbe
2026-04-29 18:32 ` [PATCH v10 1/6] drm/panthor: Expose GPU page sizes to UM Adrián Larumbe
2026-04-29 18:32 ` [PATCH v10 2/6] drm/panthor: Pass vm_bind_op to vm_prepare_map_op_ctx Adrián Larumbe
2026-04-29 18:32 ` [PATCH v10 3/6] drm/panthor: Delete spurious whitespace from uAPI header Adrián Larumbe
2026-04-29 18:32 ` [PATCH v10 4/6] drm/panthor: Remove unused operation context field Adrián Larumbe
2026-04-29 18:32 ` [PATCH v10 5/6] drm/panthor: Support sparse mappings Adrián Larumbe
2026-04-30  7:57   ` Boris Brezillon
2026-04-30  9:57     ` Boris Brezillon
2026-05-05  8:14   ` Marcin Ślusarz
2026-05-05  8:33     ` Boris Brezillon [this message]
2026-04-29 18:32 ` [PATCH v10 6/6] drm/panthor: Bump the driver version to 1.9 Adrián Larumbe

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=20260505103345.5bc1984a@fedora \
    --to=boris.brezillon@collabora.com \
    --cc=adrian.larumbe@collabora.com \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=daniel.almeida@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=marcin.slusarz@arm.com \
    --cc=mripard@kernel.org \
    --cc=nd@arm.com \
    --cc=simona@ffwll.ch \
    --cc=steven.price@arm.com \
    --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.