2020-07-21 15:16:20

by Wei Yongjun

[permalink] [raw]
Subject: [PATCH -next] 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")
Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Wei Yongjun <[email protected]>
---
drivers/gpu/drm/nouveau/dispnv50/crc.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/crc.c b/drivers/gpu/drm/nouveau/dispnv50/crc.c
index f17fb6d56757..4971a1042415 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/crc.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/crc.c
@@ -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)




2020-07-21 15:54:04

by Lyude Paul

[permalink] [raw]
Subject: Re: [PATCH -next] drm/nouveau/kms/nvd9-: Fix file release memory leak

Reviewed-by: Lyude Paul <[email protected]>

Thanks!

On Tue, 2020-07-21 at 15:17 +0000, Wei Yongjun wrote:
> 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")
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Wei Yongjun <[email protected]>
> ---
> drivers/gpu/drm/nouveau/dispnv50/crc.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/nouveau/dispnv50/crc.c
> b/drivers/gpu/drm/nouveau/dispnv50/crc.c
> index f17fb6d56757..4971a1042415 100644
> --- a/drivers/gpu/drm/nouveau/dispnv50/crc.c
> +++ b/drivers/gpu/drm/nouveau/dispnv50/crc.c
> @@ -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)
>
>
>
--
Cheers,
Lyude Paul (she/her)
Software Engineer at Red Hat