Linux-ext4 Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] fs: ext4: mballoc: amend goto to cleanup groupinfo memory correctly
@ 2021-04-12  7:38 Phillip Potter
  2021-05-01  9:18 ` Phillip Potter
  0 siblings, 1 reply; 4+ messages in thread
From: Phillip Potter @ 2021-04-12  7:38 UTC (permalink / raw)
  To: tytso; +Cc: adilger.kernel, linux-ext4, linux-kernel

When flexible block groups are enabled on a filesystem, and there are
too many log groups per flexible block group, goto err_freebuddy rather
than err_freesgi within ext4_mb_init_backend. Cleanup code for new_inode
and successive executions of ext4_mb_add_groupinfo in the previous loop
is then correctly run. Fixes memory leak reported by syzbot at:
https://syzkaller.appspot.com/bug?extid=aa12d6106ea4ca1b6aae

Reported-by: syzbot+aa12d6106ea4ca1b6aae@syzkaller.appspotmail.com
Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
---
 fs/ext4/mballoc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index a02fadf4fc84..d24cb3dc79ff 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2715,7 +2715,7 @@ static int ext4_mb_init_backend(struct super_block *sb)
 		 */
 		if (sbi->s_es->s_log_groups_per_flex >= 32) {
 			ext4_msg(sb, KERN_ERR, "too many log groups per flexible block group");
-			goto err_freesgi;
+			goto err_freebuddy;
 		}
 		sbi->s_mb_prefetch = min_t(uint, 1 << sbi->s_es->s_log_groups_per_flex,
 			BLK_MAX_SEGMENT_SIZE >> (sb->s_blocksize_bits - 9));
-- 
2.30.2


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

* Re: [PATCH] fs: ext4: mballoc: amend goto to cleanup groupinfo memory correctly
  2021-04-12  7:38 [PATCH] fs: ext4: mballoc: amend goto to cleanup groupinfo memory correctly Phillip Potter
@ 2021-05-01  9:18 ` Phillip Potter
  2021-05-01 17:43   ` Andreas Dilger
  0 siblings, 1 reply; 4+ messages in thread
From: Phillip Potter @ 2021-05-01  9:18 UTC (permalink / raw)
  To: linux-ext4; +Cc: adilger.kernel, linux-kernel, tytso

Hi All,

Sorry to be pushy (I know everyone is busy) but I've had no feedback on
this patch yet:
https://lore.kernel.org/linux-ext4/20210412073837.1686-1-phil@philpotter.co.uk/T/#u

Could I please ask for it to be reviewed? Many thanks.

Regards,
Phil Potter

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

* Re: [PATCH] fs: ext4: mballoc: amend goto to cleanup groupinfo memory correctly
  2021-05-01  9:18 ` Phillip Potter
@ 2021-05-01 17:43   ` Andreas Dilger
  2021-05-02 10:49     ` Phillip Potter
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Dilger @ 2021-05-01 17:43 UTC (permalink / raw)
  To: Phillip Potter, tytso; +Cc: linux-ext4, linux-kernel

On May 1, 2021, at 02:18, Phillip Potter <phil@philpotter.co.uk> wrote:
> 
> Hi All,
> 
> Sorry to be pushy (I know everyone is busy) but I've had no feedback on
> this patch yet:
> https://lore.kernel.org/linux-ext4/20210412073837.1686-1-phil@philpotter.co.uk/T/#u
> 
> Could I please ask for it to be reviewed? Many thanks.

Hi Phil,
I've looked at the patch and it looks good. You can add my:

Reviewed-by: Andreas Dilger <adilger@dilger.ca>

Note in the future that it is a bit easier to review (IMHO) if you include the
original patch in your ping email, but not a big deal. 

Cheers, Andreas

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

* Re: [PATCH] fs: ext4: mballoc: amend goto to cleanup groupinfo memory correctly
  2021-05-01 17:43   ` Andreas Dilger
@ 2021-05-02 10:49     ` Phillip Potter
  0 siblings, 0 replies; 4+ messages in thread
From: Phillip Potter @ 2021-05-02 10:49 UTC (permalink / raw)
  To: Andreas Dilger; +Cc: linux-ext4, linux-kernel, tytso

On Sat, May 01, 2021 at 10:43:57AM -0700, Andreas Dilger wrote:
> On May 1, 2021, at 02:18, Phillip Potter <phil@philpotter.co.uk> wrote:
> > 
> > Hi All,
> > 
> > Sorry to be pushy (I know everyone is busy) but I've had no feedback on
> > this patch yet:
> > https://lore.kernel.org/linux-ext4/20210412073837.1686-1-phil@philpotter.co.uk/T/#u
> > 
> > Could I please ask for it to be reviewed? Many thanks.
> 
> Hi Phil,
> I've looked at the patch and it looks good. You can add my:
> 
> Reviewed-by: Andreas Dilger <adilger@dilger.ca>
> 
> Note in the future that it is a bit easier to review (IMHO) if you include the
> original patch in your ping email, but not a big deal. 
> 
> Cheers, Andreas

Dear Andreas,

Thank you for your review, really appreciate it :-) I will make sure I
include the original patch in future ping e-mails - wasn't sure as I
didn't want to annoy anyone. Have a great day.

Regards,
Phil

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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12  7:38 [PATCH] fs: ext4: mballoc: amend goto to cleanup groupinfo memory correctly Phillip Potter
2021-05-01  9:18 ` Phillip Potter
2021-05-01 17:43   ` Andreas Dilger
2021-05-02 10:49     ` Phillip Potter

Linux-ext4 Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-ext4/0 linux-ext4/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-ext4 linux-ext4/ https://lore.kernel.org/linux-ext4 \
		linux-ext4@vger.kernel.org
	public-inbox-index linux-ext4

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-ext4


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git