linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: prevent memory leak in super.c
@ 2019-09-23 22:57 Navid Emamdoost
  2019-09-24  7:43 ` Nikolay Borisov
  0 siblings, 1 reply; 2+ messages in thread
From: Navid Emamdoost @ 2019-09-23 22:57 UTC (permalink / raw)
  Cc: emamd001, smccaman, kjlu, Navid Emamdoost, Chris Mason,
	Josef Bacik, David Sterba, linux-btrfs, linux-kernel

In btrfs_mount_root the last error checking was not going to the error
handling path. Fixed it.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
 fs/btrfs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 1b151af25772..9f3f62c000fa 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1565,7 +1565,7 @@ static struct dentry *btrfs_mount_root(struct file_system_type *fs_type,
 	security_free_mnt_opts(&new_sec_opts);
 	if (error) {
 		deactivate_locked_super(s);
-		return ERR_PTR(error);
+		goto error_close_devices;
 	}
 
 	return dget(s->s_root);
-- 
2.17.1


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

* Re: [PATCH] btrfs: prevent memory leak in super.c
  2019-09-23 22:57 [PATCH] btrfs: prevent memory leak in super.c Navid Emamdoost
@ 2019-09-24  7:43 ` Nikolay Borisov
  0 siblings, 0 replies; 2+ messages in thread
From: Nikolay Borisov @ 2019-09-24  7:43 UTC (permalink / raw)
  To: Navid Emamdoost
  Cc: Chris Mason, David Sterba, Josef Bacik, emamd001, kjlu, smccaman,
	linux-btrfs, linux-kernel



On 24.09.19 г. 1:57 ч., Navid Emamdoost wrote:
> In btrfs_mount_root the last error checking was not going to the error
> handling path. Fixed it.
> 
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>

NAK

deactivate_locked_super actually calls btrfs_kill_super which in turn
calls generic_shutdown_super which does the required shutdown sequence.

> ---
>  fs/btrfs/super.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> index 1b151af25772..9f3f62c000fa 100644
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -1565,7 +1565,7 @@ static struct dentry *btrfs_mount_root(struct file_system_type *fs_type,
>  	security_free_mnt_opts(&new_sec_opts);
>  	if (error) {
>  		deactivate_locked_super(s);
> -		return ERR_PTR(error);
> +		goto error_close_devices;
>  	}
>  
>  	return dget(s->s_root);
> 

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

end of thread, other threads:[~2019-09-24  7:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-23 22:57 [PATCH] btrfs: prevent memory leak in super.c Navid Emamdoost
2019-09-24  7:43 ` Nikolay Borisov

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).