[PATCH v3 1/2] drm/gem: drm_gem_dumb_map_offset(): reject dma-buf
Noralf Trønnes
noralf at tronnes.org
Fri Aug 18 16:13:14 UTC 2017
(cc affected parties)
Den 18.08.2017 09.46, skrev Daniel Vetter:
> On Thu, Aug 17, 2017 at 06:21:30PM +0200, Noralf Trønnes wrote:
>> Reject mapping an imported dma-buf since is's an invalid use-case.
>>
>> Cc: Philipp Zabel <p.zabel at pengutronix.de>
>> Cc: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
>> Cc: Sean Paul <seanpaul at chromium.org>
>> Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
>> Signed-off-by: Noralf Trønnes <noralf at tronnes.org>
> I think acks from someone using mali would be good too. amdgpu already has
> such checks, so I think on the desktop side we're ok.
>
> Acked-by: Daniel Vetter <daniel.vetter at ffwll.ch>
>
> But I think this one here definitely needs a few more acks. I could break
> uabi if we're unlucky, so let's not rush it.
Ok, I've CC'ed the affected parties to increase the odds that they look
at this. These are the drivers using drm_gem_dumb_map_offset()
(hopefully I got the list right):
arc
atmel-hlcdc
cirrus
exynos
fsl-dcu
gma500
hdlcd
imx
kirin
mali-dp
mediatek
meson
mxsfb
pl111
rcar-du
rockchip
shmobile
sti
stm
sun4i
tegra
tilcd
vc4
zte
Noralf.
> -Daniel
>
>> ---
>> drivers/gpu/drm/drm_gem.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
>> index ad4e9cf..8da5801 100644
>> --- a/drivers/gpu/drm/drm_gem.c
>> +++ b/drivers/gpu/drm/drm_gem.c
>> @@ -333,6 +333,12 @@ int drm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,
>> if (!obj)
>> return -ENOENT;
>>
>> + /* Don't allow imported objects to be mapped */
>> + if (obj->import_attach) {
>> + ret = -EINVAL;
>> + goto out;
>> + }
>> +
>> ret = drm_gem_create_mmap_offset(obj);
>> if (ret)
>> goto out;
>> --
>> 2.7.4
>>
More information about the dri-devel
mailing list