All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] exfat: fix possible memory leak in exfat_find()
@ 2020-05-06 14:25   ` Wei Yongjun
  0 siblings, 0 replies; 4+ messages in thread
From: Wei Yongjun @ 2020-05-06 14:25 UTC (permalink / raw)
  To: Namjae Jeon, Sungjong Seo; +Cc: Wei Yongjun, linux-fsdevel, kernel-janitors

'es' is malloced from exfat_get_dentry_set() in exfat_find() and should
be freed before leaving from the error handling cases, otherwise it will
cause memory leak.

Fixes: 5f2aa075070c ("exfat: add inode operations")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 fs/exfat/namei.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c
index c241dd177f1a..48f4df883f3b 100644
--- a/fs/exfat/namei.c
+++ b/fs/exfat/namei.c
@@ -681,6 +681,7 @@ static int exfat_find(struct inode *dir, struct qstr *qname,
 			exfat_fs_error(sb,
 				"non-zero size file starts with zero cluster (size : %llu, p_dir : %u, entry : 0x%08x)",
 				i_size_read(dir), ei->dir.dir, ei->entry);
+			kfree(es);
 			return -EIO;
 		}




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH -next] exfat: fix possible memory leak in exfat_find()
@ 2020-05-06 14:25   ` Wei Yongjun
  0 siblings, 0 replies; 4+ messages in thread
From: Wei Yongjun @ 2020-05-06 14:25 UTC (permalink / raw)
  To: Namjae Jeon, Sungjong Seo; +Cc: Wei Yongjun, linux-fsdevel, kernel-janitors

'es' is malloced from exfat_get_dentry_set() in exfat_find() and should
be freed before leaving from the error handling cases, otherwise it will
cause memory leak.

Fixes: 5f2aa075070c ("exfat: add inode operations")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 fs/exfat/namei.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c
index c241dd177f1a..48f4df883f3b 100644
--- a/fs/exfat/namei.c
+++ b/fs/exfat/namei.c
@@ -681,6 +681,7 @@ static int exfat_find(struct inode *dir, struct qstr *qname,
 			exfat_fs_error(sb,
 				"non-zero size file starts with zero cluster (size : %llu, p_dir : %u, entry : 0x%08x)",
 				i_size_read(dir), ei->dir.dir, ei->entry);
+			kfree(es);
 			return -EIO;
 		}

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH -next] exfat: fix possible memory leak in exfat_find()
  2020-05-06 14:25   ` Wei Yongjun
@ 2020-05-07  2:50     ` Namjae Jeon
  -1 siblings, 0 replies; 4+ messages in thread
From: Namjae Jeon @ 2020-05-07  2:50 UTC (permalink / raw)
  To: 'Wei Yongjun'
  Cc: linux-fsdevel, kernel-janitors, 'Sungjong Seo'

> 'es' is malloced from exfat_get_dentry_set() in exfat_find() and should be freed before leaving from
> the error handling cases, otherwise it will cause memory leak.
> 
> Fixes: 5f2aa075070c ("exfat: add inode operations")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Applied.
Thanks!
> ---
>  fs/exfat/namei.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index c241dd177f1a..48f4df883f3b 100644
> --- a/fs/exfat/namei.c
> +++ b/fs/exfat/namei.c
> @@ -681,6 +681,7 @@ static int exfat_find(struct inode *dir, struct qstr *qname,
>  			exfat_fs_error(sb,
>  				"non-zero size file starts with zero cluster (size : %llu, p_dir : %u,
> entry : 0x%08x)",
>  				i_size_read(dir), ei->dir.dir, ei->entry);
> +			kfree(es);
>  			return -EIO;
>  		}
> 
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH -next] exfat: fix possible memory leak in exfat_find()
@ 2020-05-07  2:50     ` Namjae Jeon
  0 siblings, 0 replies; 4+ messages in thread
From: Namjae Jeon @ 2020-05-07  2:50 UTC (permalink / raw)
  To: 'Wei Yongjun'
  Cc: linux-fsdevel, kernel-janitors, 'Sungjong Seo'

> 'es' is malloced from exfat_get_dentry_set() in exfat_find() and should be freed before leaving from
> the error handling cases, otherwise it will cause memory leak.
> 
> Fixes: 5f2aa075070c ("exfat: add inode operations")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Applied.
Thanks!
> ---
>  fs/exfat/namei.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c index c241dd177f1a..48f4df883f3b 100644
> --- a/fs/exfat/namei.c
> +++ b/fs/exfat/namei.c
> @@ -681,6 +681,7 @@ static int exfat_find(struct inode *dir, struct qstr *qname,
>  			exfat_fs_error(sb,
>  				"non-zero size file starts with zero cluster (size : %llu, p_dir : %u,
> entry : 0x%08x)",
>  				i_size_read(dir), ei->dir.dir, ei->entry);
> +			kfree(es);
>  			return -EIO;
>  		}
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-07  2:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20200506142203epcas1p1f805af350b11786d9771fb5bd12bfdd6@epcas1p1.samsung.com>
2020-05-06 14:25 ` [PATCH -next] exfat: fix possible memory leak in exfat_find() Wei Yongjun
2020-05-06 14:25   ` Wei Yongjun
2020-05-07  2:50   ` Namjae Jeon
2020-05-07  2:50     ` Namjae Jeon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.