Skip to content

Commit 6e4a61c

Browse files
committed
Merge tag 'drm-misc-fixes-2022-05-20' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes
Fix for a memory leak in dp_mst, a (userspace) build fix for DMA_BUF_SET_NAME defines and a directory name generation fix for dmabuf stats Signed-off-by: Dave Airlie <[email protected]> From: Maxime Ripard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/20220520072408.cpjzy2taugagvrh7@houat
2 parents 4862b74 + 6e03b13 commit 6e4a61c

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

drivers/dma-buf/dma-buf.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ static inline int is_dma_buf_file(struct file *file)
407407

408408
static struct file *dma_buf_getfile(struct dma_buf *dmabuf, int flags)
409409
{
410+
static atomic64_t dmabuf_inode = ATOMIC64_INIT(0);
410411
struct file *file;
411412
struct inode *inode = alloc_anon_inode(dma_buf_mnt->mnt_sb);
412413

@@ -416,6 +417,13 @@ static struct file *dma_buf_getfile(struct dma_buf *dmabuf, int flags)
416417
inode->i_size = dmabuf->size;
417418
inode_set_bytes(inode, dmabuf->size);
418419

420+
/*
421+
* The ->i_ino acquired from get_next_ino() is not unique thus
422+
* not suitable for using it as dentry name by dmabuf stats.
423+
* Override ->i_ino with the unique and dmabuffs specific
424+
* value.
425+
*/
426+
inode->i_ino = atomic64_add_return(1, &dmabuf_inode);
419427
file = alloc_file_pseudo(inode, dma_buf_mnt, "dmabuf",
420428
flags, &dma_buf_fops);
421429
if (IS_ERR(file))

drivers/gpu/drm/dp/drm_dp_mst_topology.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4852,6 +4852,7 @@ static void fetch_monitor_name(struct drm_dp_mst_topology_mgr *mgr,
48524852

48534853
mst_edid = drm_dp_mst_get_edid(port->connector, mgr, port);
48544854
drm_edid_get_monitor_name(mst_edid, name, namelen);
4855+
kfree(mst_edid);
48554856
}
48564857

48574858
/**

include/uapi/linux/dma-buf.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ struct dma_buf_sync {
9292
* between them in actual uapi, they're just different numbers.
9393
*/
9494
#define DMA_BUF_SET_NAME _IOW(DMA_BUF_BASE, 1, const char *)
95-
#define DMA_BUF_SET_NAME_A _IOW(DMA_BUF_BASE, 1, u32)
96-
#define DMA_BUF_SET_NAME_B _IOW(DMA_BUF_BASE, 1, u64)
95+
#define DMA_BUF_SET_NAME_A _IOW(DMA_BUF_BASE, 1, __u32)
96+
#define DMA_BUF_SET_NAME_B _IOW(DMA_BUF_BASE, 1, __u64)
9797

9898
#endif

0 commit comments

Comments
 (0)