Skip to content

Commit

Permalink
drm/prime: fix sgt NULL checking
Browse files Browse the repository at this point in the history
The drm_gem_map_detach() can be called with sgt is NULL.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
  • Loading branch information
Joonyoung Shim authored and Dave Airlie committed Jul 5, 2013
1 parent 63eef60 commit f9d8a12
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions drivers/gpu/drm/drm_prime.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,13 @@ static void drm_gem_map_detach(struct dma_buf *dma_buf,
return;

sgt = prime_attach->sgt;
if (sgt) {
if (prime_attach->dir != DMA_NONE)
dma_unmap_sg(attach->dev, sgt->sgl, sgt->nents,
prime_attach->dir);
sg_free_table(sgt);
}

if (prime_attach->dir != DMA_NONE)
dma_unmap_sg(attach->dev, sgt->sgl, sgt->nents,
prime_attach->dir);

sg_free_table(sgt);
kfree(sgt);
kfree(prime_attach);
attach->priv = NULL;
Expand Down

0 comments on commit f9d8a12

Please sign in to comment.