Skip to contentSkip to conversation

drm/nouveau/kms/nv50-: fix file release memory leak

PATCH In review Yang Yingliang 2 participants 4 messages Sep 11, 2021 – Sep 28, 2021

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

PATCH 1/2 drm/nouveau/kms/nv50-: fix file release memory leak

When using single_open() for opening, single_release() should be called, otherwise the 'op' allocated in single_open() will be leaked.

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 b8c31b697797..66f32d965c72 100644
@@ -704,6 +704,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 · 1 line
2.25.1
#1 lore raw

PATCH 2/2 drm/nouveau/debugfs: fix file release memory leak

When using single_open() for opening, single_release() should be called, otherwise the 'op' allocated in single_open() will be leaked.

Fixes 6e9fc177399f ("drm/nouveau/debugfs: add copy of sysfs pstate interface ported to debugfs")
---
 drivers/gpu/drm/nouveau/nouveau_debugfs.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/nouveau/nouveau_debugfs.c +1 -0
index c2bc05eb2e54..1cbe01048b93 100644
@@ -207,6 +207,7 @@ static const struct file_operations nouveau_pstate_fops = {
 	.open = nouveau_debugfs_pstate_open,
 	.read = seq_read,
 	.write = nouveau_debugfs_pstate_set,
+	.release = single_release,
 };
 
 static struct drm_info_list nouveau_debugfs_list[] = {
Signature · 1 line
2.25.1
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] drm/nouveau/debugfs: fix file release memory leak

Quoted 26 lines · Yang Yingliang

When using single_open() for opening, single_release() should be called, otherwise the 'op' allocated in single_open() will be leaked.

Fixes 6e9fc177399f ("drm/nouveau/debugfs: add copy of sysfs pstate interface ported to debugfs")
---
 drivers/gpu/drm/nouveau/nouveau_debugfs.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/nouveau/nouveau_debugfs.c +1 -1
index c2bc05eb2e54..1cbe01048b93 100644
@@ -207,6 +207,7 @@ static const struct file_operations nouveau_pstate_fops = {
        .open = nouveau_debugfs_pstate_open,
        .read = seq_read,
        .write = nouveau_debugfs_pstate_set,
+       .release = single_release,
 };
 
 static struct drm_info_list nouveau_debugfs_list[] = {
--

2.25.1

Reviewed-by on v1 1/2
#3 lore raw
In reply to Yang Yingliang
Quoted 26 lines · Yang Yingliang

When using single_open() for opening, single_release() should be called, otherwise the 'op' allocated in single_open() will be leaked.

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 -1
index b8c31b697797..66f32d965c72 100644
@@ -704,6 +704,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)
--

2.25.1