dma-buf: fill dmabuf->name in dma_buf_export

From 5.3+ kernels we have an option that users of the dmabuf can
provide unique name to the dmabuf object which is stored in the ->name
field of dma_buf structure. The change, commit bf93f26d49 ("UPSTREAM:
dma-buf: add DMA_BUF_SET_NAME ioctls"), brought as an LSK merges can
break some users. These users, say display, relies on the readlink() to
get the dmabuf name which is used to uniquely identify the dmabuf
exported buffers and thus take some decissions, Eg: Whether to redraw
the eglimage. But this LSK change  will always give the "/dmabuf:" as
name for all the dmabuf objects thus breaking such users. This can be
avoided by filling the dmabuf->name with the default unique name, thus
the dma_buf->buf_name,name will share the common name till the user
overrides it.

This fix also indirectly solves the memory leak issue associated with
the dmabuf->buf_name filled in the dma_buf_export().

Change-Id: If4ba945b49c98f1d109ec83400299af12dac1232
Fixes: bf93f26d49 ("UPSTREAM: dma-buf: add DMA_BUF_SET_NAME ioctls")
Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
This commit is contained in:
Charan Teja Reddy 2020-05-12 11:39:06 +05:30
parent 1edb650f82
commit 707379eaac

View file

@ -623,6 +623,7 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info)
dmabuf->cb_excl.poll = dmabuf->cb_shared.poll = &dmabuf->poll;
dmabuf->cb_excl.active = dmabuf->cb_shared.active = 0;
dmabuf->buf_name = bufname;
dmabuf->name = bufname;
dmabuf->ktime = ktime_get();
atomic_set(&dmabuf->dent_count, 1);