diff mbox series

statmount: fix security option retrieval

Message ID 20241120-verehren-rhabarber-83a11b297bcc@brauner (mailing list archive)
State New
Headers show
Series statmount: fix security option retrieval | expand

Commit Message

Christian Brauner Nov. 20, 2024, 8:17 a.m. UTC
Fix the inverted check for security_sb_show_options().

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/c8eaa647-5d67-49b6-9401-705afcb7e4d7@stanley.mountain
Fixes: aefff51e1c29 ("statmount: retrieve security mount options")
Cc: Cc: <stable@vger.kernel.org> # mainline only
Signed-off-by: Christian Brauner <brauner@kernel.org>
---
 fs/namespace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jeff Layton Nov. 20, 2024, 12:58 p.m. UTC | #1
On Wed, 2024-11-20 at 09:17 +0100, Christian Brauner wrote:
> Fix the inverted check for security_sb_show_options().
> 
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Link: https://lore.kernel.org/r/c8eaa647-5d67-49b6-9401-705afcb7e4d7@stanley.mountain
> Fixes: aefff51e1c29 ("statmount: retrieve security mount options")
> Cc: Cc: <stable@vger.kernel.org> # mainline only
> Signed-off-by: Christian Brauner <brauner@kernel.org>
> ---
>  fs/namespace.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/namespace.c b/fs/namespace.c
> index 6b0a17487d0f..eb34a5160f64 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -5116,7 +5116,7 @@ static int statmount_opt_sec_array(struct kstatmount *s, struct seq_file *seq)
>  	buf_start = seq->buf + start;
>  
>  	err = security_sb_show_options(seq, sb);
> -	if (!err)
> +	if (err)
>  		return err;
>  
>  	if (unlikely(seq_has_overflowed(seq)))

Doh!

Reviewed-by: Jeff Layton <jlayton@kernel.org>
diff mbox series

Patch

diff --git a/fs/namespace.c b/fs/namespace.c
index 6b0a17487d0f..eb34a5160f64 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -5116,7 +5116,7 @@  static int statmount_opt_sec_array(struct kstatmount *s, struct seq_file *seq)
 	buf_start = seq->buf + start;
 
 	err = security_sb_show_options(seq, sb);
-	if (!err)
+	if (err)
 		return err;
 
 	if (unlikely(seq_has_overflowed(seq)))