All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
To: Gaosheng Cui <cuigaosheng1@huawei.com>
Cc: tzimmermann@suse.de, airlied@linux.ie, chris@chris-wilson.co.uk,
	dri-devel@lists.freedesktop.org, alexander.deucher@amd.com
Subject: Re: [PATCH] drm: Fix possible memleak and UAF in drm_addmap_core()
Date: Fri, 25 Nov 2022 15:24:09 +0100	[thread overview]
Message-ID: <20221125142409.GA782501@linux.intel.com> (raw)
In-Reply-To: <20221124010219.2653190-1-cuigaosheng1@huawei.com>

On Thu, Nov 24, 2022 at 09:02:19AM +0800, Gaosheng Cui wrote:
> The dma_free_coherent() should be called when memory fails to
> be allocated for list, or drm_map_handle() fails, otherwise there
> will be a memory leak, so add dma_free_coherent to fix it.
> 
> In addition, if drm_map_handle() fails in drm_addmap_core(), list
> will be freed, but list->head will not be removed from dev->map_list,
> then list traversal may cause UAF, fix it by removeing it from
> dev->map_list before kfree().
> 
> Fixes: 8e4ff9b56957 ("drm: Remove the dma_alloc_coherent wrapper for internal usage")
> Fixes: 8d153f7107ff ("drm: update user token hashing and map handles")
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>

Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>


      reply	other threads:[~2022-11-25 14:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24  1:02 [PATCH] drm: Fix possible memleak and UAF in drm_addmap_core() Gaosheng Cui
2022-11-25 14:24 ` Stanislaw Gruszka [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=20221125142409.GA782501@linux.intel.com \
    --to=stanislaw.gruszka@linux.intel.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=cuigaosheng1@huawei.com \
    --cc=dri-devel@lists.freedesktop.org \
    --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.