[PATCH Next] copy_mnt_ns(): Remove unnecessary unlock

Edward Adam Davis posted 1 patch 1 week ago
fs/namespace.c | 1 -
1 file changed, 1 deletion(-)
[PATCH Next] copy_mnt_ns(): Remove unnecessary unlock
Posted by Edward Adam Davis 1 week ago
This code segment is already protected by guards, namespace_unlock()
should not appear here.

Reported-by: syzbot+0d671007a95cd2835e05@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=0d671007a95cd2835e05
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
 fs/namespace.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index ac1aedafe05e..c22febeda1ac 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -4134,7 +4134,6 @@ struct mnt_namespace *copy_mnt_ns(u64 flags, struct mnt_namespace *ns,
 	new = copy_tree(old, old->mnt.mnt_root, copy_flags);
 	if (IS_ERR(new)) {
 		emptied_ns = new_ns;
-		namespace_unlock();
 		return ERR_CAST(new);
 	}
 	if (user_ns != ns->user_ns) {
-- 
2.43.0
Re: [PATCH Next] copy_mnt_ns(): Remove unnecessary unlock
Posted by Jan Kara 1 week ago
On Wed 24-09-25 18:29:04, Edward Adam Davis wrote:
> This code segment is already protected by guards, namespace_unlock()
> should not appear here.
> 
> Reported-by: syzbot+0d671007a95cd2835e05@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=0d671007a95cd2835e05
> Signed-off-by: Edward Adam Davis <eadavis@qq.com>

Indeed. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/namespace.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/fs/namespace.c b/fs/namespace.c
> index ac1aedafe05e..c22febeda1ac 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -4134,7 +4134,6 @@ struct mnt_namespace *copy_mnt_ns(u64 flags, struct mnt_namespace *ns,
>  	new = copy_tree(old, old->mnt.mnt_root, copy_flags);
>  	if (IS_ERR(new)) {
>  		emptied_ns = new_ns;
> -		namespace_unlock();
>  		return ERR_CAST(new);
>  	}
>  	if (user_ns != ns->user_ns) {
> -- 
> 2.43.0
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR