mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/3] ubifs: gc: fix authentication node leak
@ 2026-11-02 11:50 shao.mingyin
  2026-11-02 13:30 ` Zhihao Cheng
  0 siblings, 1 reply; 3+ messages in thread
From: shao.mingyin @ 2026-11-02 11:50 UTC (permalink / raw)
  To: richard, linux-mtd, chengzhihao1, linux-kernel, stable

move_nodes() allocates the authentication node, writes it to the GC
write-buffer and only frees it on the error paths.  Every GC pass that
moves nodes on an authenticated file system therefore leaks
ubifs_auth_node_sz() bytes.

Free the buffer after it has been written to the write-buffer.

Fixes: 6f06d96fdf62 ("ubifs: Add auth nodes to garbage collector journal head")
Cc: stable@vger.kernel.org
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
---
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c
index 933c79b5cd6b..2b0f29423f48 100644
--- a/fs/ubifs/gc.c
+++ b/fs/ubifs/gc.c
@@ -427,6 +427,7 @@ static int move_nodes(struct ubifs_info *c, struct ubifs_scan_leb *sleb)
 				kfree(auth);
 				goto out;
 			}
+			kfree(auth);
 
 			ubifs_add_dirt(c, wbuf->lnum, ubifs_auth_node_sz(c));
 		}

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

* Re: [PATCH 1/3] ubifs: gc: fix authentication node leak
  2026-11-02 11:50 [PATCH 1/3] ubifs: gc: fix authentication node leak shao.mingyin
@ 2026-11-02 13:30 ` Zhihao Cheng
  0 siblings, 0 replies; 3+ messages in thread
From: Zhihao Cheng @ 2026-11-02 13:30 UTC (permalink / raw)
  To: shao.mingyin, richard, linux-mtd, linux-kernel, stable

在 2026/11/2 19:50, shao.mingyin@zte.com.cn 写道:
> move_nodes() allocates the authentication node, writes it to the GC
> write-buffer and only frees it on the error paths.  Every GC pass that
> moves nodes on an authenticated file system therefore leaks
> ubifs_auth_node_sz() bytes.
> 
> Free the buffer after it has been written to the write-buffer.
> 
> Fixes: 6f06d96fdf62 ("ubifs: Add auth nodes to garbage collector journal head")
> Cc: stable@vger.kernel.org
> Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
> ---
> diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c
> index 933c79b5cd6b..2b0f29423f48 100644
> --- a/fs/ubifs/gc.c
> +++ b/fs/ubifs/gc.c
> @@ -427,6 +427,7 @@ static int move_nodes(struct ubifs_info *c, struct ubifs_scan_leb *sleb)
>   				kfree(auth);
>   				goto out;
>   			}
> +			kfree(auth);
>   
>   			ubifs_add_dirt(c, wbuf->lnum, ubifs_auth_node_sz(c));
>   		}
> .
> 


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

* [PATCH 1/3] ubifs: gc: fix authentication node leak
  2026-11-02 11:50 [PATCH 0/3] ubifs: fix an auth node leak and two error-handling bugs shao.mingyin
@ 2026-11-02 12:12 ` shao.mingyin
  0 siblings, 0 replies; 3+ messages in thread
From: shao.mingyin @ 2026-11-02 12:12 UTC (permalink / raw)
  To: richard, linux-mtd; +Cc: chengzhihao1, linux-kernel, stable

move_nodes() allocates the authentication node, writes it to the GC
write-buffer and only frees it on the error paths.  Every GC pass that
moves nodes on an authenticated file system therefore leaks
ubifs_auth_node_sz() bytes.

Free the buffer after it has been written to the write-buffer.

Fixes: 6f06d96fdf62 ("ubifs: Add auth nodes to garbage collector journal head")
Cc: stable@vger.kernel.org
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
---
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c
index 933c79b5cd6b..2b0f29423f48 100644
--- a/fs/ubifs/gc.c
+++ b/fs/ubifs/gc.c
@@ -427,6 +427,7 @@ static int move_nodes(struct ubifs_info *c, struct ubifs_scan_leb *sleb)
 				kfree(auth);
 				goto out;
 			}
+			kfree(auth);

 			ubifs_add_dirt(c, wbuf->lnum, ubifs_auth_node_sz(c));
 		}

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

end of thread, other threads:[~2026-11-02 13:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-02 11:50 [PATCH 1/3] ubifs: gc: fix authentication node leak shao.mingyin
2026-11-02 13:30 ` Zhihao Cheng
  -- strict thread matches above, loose matches on Subject: below --
2026-11-02 11:50 [PATCH 0/3] ubifs: fix an auth node leak and two error-handling bugs shao.mingyin
2026-11-02 12:12 ` [PATCH 1/3] ubifs: gc: fix authentication node leak shao.mingyin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®