Nouveau Archive on lore.kernel.org
 help / color / mirror / Atom feed
  • * [PATCH AUTOSEL 5.4 23/24] drm/nouveau/gem: fix "refcount_t: underflow; use-after-free"
           [not found] <20201103012007.183429-1-sashal@kernel.org>
           [not found] ` <20201103012007.183429-1-sashal-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    @ 2020-11-03  1:20 ` Sasha Levin
      1 sibling, 0 replies; 2+ messages in thread
    From: Sasha Levin @ 2020-11-03  1:20 UTC (permalink / raw)
      To: linux-kernel, stable
      Cc: Karol Herbst, Ben Skeggs, Sasha Levin, dri-devel, nouveau
    
    From: Karol Herbst <kherbst@redhat.com>
    
    [ Upstream commit 925681454d7b557d404b5d28ef4469fac1b2e105 ]
    
    we can't use nouveau_bo_ref here as no ttm object was allocated and
    nouveau_bo_ref mainly deals with that. Simply deallocate the object.
    
    Signed-off-by: Karol Herbst <kherbst@redhat.com>
    Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
     drivers/gpu/drm/nouveau/nouveau_gem.c | 3 ++-
     1 file changed, 2 insertions(+), 1 deletion(-)
    
    diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
    index 7d39d4949ee77..2dd9fcab464b1 100644
    --- a/drivers/gpu/drm/nouveau/nouveau_gem.c
    +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
    @@ -197,7 +197,8 @@ nouveau_gem_new(struct nouveau_cli *cli, u64 size, int align, uint32_t domain,
     	 * to the caller, instead of a normal nouveau_bo ttm reference. */
     	ret = drm_gem_object_init(drm->dev, &nvbo->bo.base, size);
     	if (ret) {
    -		nouveau_bo_ref(NULL, &nvbo);
    +		drm_gem_object_release(&nvbo->bo.base);
    +		kfree(nvbo);
     		return ret;
     	}
     
    -- 
    2.27.0
    
    ^ permalink raw reply related	[flat|nested] 2+ messages in thread

  • end of thread, other threads:[~2020-11-03  1:20 UTC | newest]
    
    Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
    -- links below jump to the message on this page --
         [not found] <20201103012007.183429-1-sashal@kernel.org>
         [not found] ` <20201103012007.183429-1-sashal-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2020-11-03  1:20   ` [PATCH AUTOSEL 5.4 22/24] drm/nouveau/nouveau: fix the start/end range for migration Sasha Levin
    2020-11-03  1:20 ` [PATCH AUTOSEL 5.4 23/24] drm/nouveau/gem: fix "refcount_t: underflow; use-after-free" Sasha Levin
    

    This is a public inbox, see mirroring instructions
    for how to clone and mirror all data and code used for this inbox