Skip to contentSkip to conversation

drm/nouveau/kms/nvd9-: Fix file release memory leak

PATCH In review Wei Yongjun 2 participants 2 messages Jul 21, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/nouveau/kms/nvd9-: Fix file release memory leak

When using single_open() for opening, single_release() should be used instead of seq_release(), otherwise there is a memory leak.

Fixes 12885ecbfe62 ("drm/nouveau/kms/nvd9-: Add CRC support")
---
 drivers/gpu/drm/nouveau/dispnv50/crc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/nouveau/dispnv50/crc.c +1 -0
index f17fb6d56757..4971a1042415 100644
@@ -706,6 +706,7 @@ static const struct file_operations nv50_crc_flip_threshold_fops = {
 	.open = nv50_crc_debugfs_flip_threshold_open,
 	.read = seq_read,
 	.write = nv50_crc_debugfs_flip_threshold_set,
+	.release = single_release,
 };
 
 int nv50_head_crc_late_register(struct nv50_head *head)
maintainer Reviewed-by on v1 1/1
#1 lore raw

Thanks!

Quoted 27 lines · Wei Yongjun

When using single_open() for opening, single_release() should be used instead of seq_release(), otherwise there is a memory leak.

Fixes 12885ecbfe62 ("drm/nouveau/kms/nvd9-: Add CRC support")
---
 drivers/gpu/drm/nouveau/dispnv50/crc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/nouveau/dispnv50/crc.c +1 -0
index f17fb6d56757..4971a1042415 100644
@@ -706,6 +706,7 @@ static const struct file_operations
 nv50_crc_flip_threshold_fops = {
 	.open = nv50_crc_debugfs_flip_threshold_open,
 	.read = seq_read,
 	.write = nv50_crc_debugfs_flip_threshold_set,
+	.release = single_release,
 };
 

int nv50_head_crc_late_register(struct nv50_head *head)

Signature · 3 lines
Cheers,
	Lyude Paul (she/her)
	Software Engineer at Red Hat