* dma-buf: fix a use-after-free

* radeon: don't init the TTM page pool manually
 * ttm: unexport ttm_pool_{init,fini}()
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEchf7rIzpz2NEoWjlaA3BHVMLeiMFAl/4JtwACgkQaA3BHVML
 eiPF0QgAjOQ/7MN+0xV0fdKc900vRUSm51P2gkTdVTfmRkp4TGD0pjQkY/HL3XQ6
 LH4vAHgjizpJR7pFV3n6xlK8QlgnSlHf0Ca2xhEPIFXlxuLmqX37u1hLiSnr/aV4
 IE3MO3GP4qv81NaTzBsT4Fa6+el/xhbd02zLylJpnUdqauGhHt3Gp70SMIoHiS1R
 ZD9mRhyMKMDEo9Wz23VoSRuqoaUxwY0e22m62XNoOufc7tjvgm1zSNL4SVzusCPZ
 Zjbax7LfMIII/NfwTilyPcSP3GJ0FSxNsmg31cr9q6icQXEN0LFYOz56f/r3zCLC
 cYnyVuRO16tgVkcc9F5GAWa/nbyA8g==
 =P3W3
 -----END PGP SIGNATURE-----

Merge tag 'drm-misc-fixes-2021-01-08' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes

* dma-buf: fix a use-after-free
* radeon: don't init the TTM page pool manually
* ttm: unexport ttm_pool_{init,fini}()

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
From: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/X/gnKs52t8xUuAlE@linux-uq9g
This commit is contained in:
Daniel Vetter 2021-01-08 10:39:17 +01:00
Родитель 25ea8ecf4d a73858ef4d
Коммит 29f95f2058
3 изменённых файлов: 17 добавлений и 9 удалений

Просмотреть файл

@ -76,10 +76,6 @@ static void dma_buf_release(struct dentry *dentry)
dmabuf->ops->release(dmabuf);
mutex_lock(&db_list.lock);
list_del(&dmabuf->list_node);
mutex_unlock(&db_list.lock);
if (dmabuf->resv == (struct dma_resv *)&dmabuf[1])
dma_resv_fini(dmabuf->resv);
@ -88,6 +84,22 @@ static void dma_buf_release(struct dentry *dentry)
kfree(dmabuf);
}
static int dma_buf_file_release(struct inode *inode, struct file *file)
{
struct dma_buf *dmabuf;
if (!is_dma_buf_file(file))
return -EINVAL;
dmabuf = file->private_data;
mutex_lock(&db_list.lock);
list_del(&dmabuf->list_node);
mutex_unlock(&db_list.lock);
return 0;
}
static const struct dentry_operations dma_buf_dentry_ops = {
.d_dname = dmabuffs_dname,
.d_release = dma_buf_release,
@ -413,6 +425,7 @@ static void dma_buf_show_fdinfo(struct seq_file *m, struct file *file)
}
static const struct file_operations dma_buf_fops = {
.release = dma_buf_file_release,
.mmap = dma_buf_mmap_internal,
.llseek = dma_buf_llseek,
.poll = dma_buf_poll,

Просмотреть файл

@ -730,9 +730,6 @@ int radeon_ttm_init(struct radeon_device *rdev)
}
rdev->mman.initialized = true;
ttm_pool_init(&rdev->mman.bdev.pool, rdev->dev, rdev->need_swiotlb,
dma_addressing_limited(&rdev->pdev->dev));
r = radeon_ttm_init_vram(rdev);
if (r) {
DRM_ERROR("Failed initializing VRAM heap.\n");

Просмотреть файл

@ -507,7 +507,6 @@ void ttm_pool_init(struct ttm_pool *pool, struct device *dev,
ttm_pool_type_init(&pool->caching[i].orders[j],
pool, i, j);
}
EXPORT_SYMBOL(ttm_pool_init);
/**
* ttm_pool_fini - Cleanup a pool
@ -525,7 +524,6 @@ void ttm_pool_fini(struct ttm_pool *pool)
for (j = 0; j < MAX_ORDER; ++j)
ttm_pool_type_fini(&pool->caching[i].orders[j]);
}
EXPORT_SYMBOL(ttm_pool_fini);
#ifdef CONFIG_DEBUG_FS
/* Count the number of pages available in a pool_type */