linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] ext4: memory leak on error in ext4_symlink()
@ 2015-07-24 11:05 Dan Carpenter
  2015-07-27 12:32 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-07-24 11:05 UTC (permalink / raw)
  To: Theodore Ts'o, Jan Kara; +Cc: Andreas Dilger, linux-ext4, kernel-janitors

We should release "sd" before returning.

Fixes: 0fa12ad1b285 ('ext4: Handle error from dquot_initialize()')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index d3ff837..9f61e76 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -3084,7 +3084,7 @@ static int ext4_symlink(struct inode *dir,
 
 	err = dquot_initialize(dir);
 	if (err)
-		return err;
+		goto err_free_sd;
 
 	if ((disk_link.len > EXT4_N_BLOCKS * 4)) {
 		/*

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

* Re: [patch] ext4: memory leak on error in ext4_symlink()
  2015-07-24 11:05 [patch] ext4: memory leak on error in ext4_symlink() Dan Carpenter
@ 2015-07-27 12:32 ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2015-07-27 12:32 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Theodore Ts'o, Jan Kara, Andreas Dilger, linux-ext4,
	kernel-janitors

On Fri 24-07-15 14:05:33, Dan Carpenter wrote:
> We should release "sd" before returning.
> 
> Fixes: 0fa12ad1b285 ('ext4: Handle error from dquot_initialize()')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks! I've added the fix to my tree.

								Honza
 
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index d3ff837..9f61e76 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -3084,7 +3084,7 @@ static int ext4_symlink(struct inode *dir,
>  
>  	err = dquot_initialize(dir);
>  	if (err)
> -		return err;
> +		goto err_free_sd;
>  
>  	if ((disk_link.len > EXT4_N_BLOCKS * 4)) {
>  		/*
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

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

end of thread, other threads:[~2015-07-27 12:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-24 11:05 [patch] ext4: memory leak on error in ext4_symlink() Dan Carpenter
2015-07-27 12:32 ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).