diff mbox series

fs: ext4: mballoc: amend goto to cleanup groupinfo memory correctly

Message ID 20210412073837.1686-1-phil@philpotter.co.uk
State Awaiting Upstream
Headers show
Series fs: ext4: mballoc: amend goto to cleanup groupinfo memory correctly | expand

Commit Message

Phillip Potter April 12, 2021, 7:38 a.m. UTC
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(-)

Comments

Phillip Potter May 1, 2021, 9:18 a.m. UTC | #1
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
Andreas Dilger May 1, 2021, 5:43 p.m. UTC | #2
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
Phillip Potter May 2, 2021, 10:49 a.m. UTC | #3
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
Theodore Ts'o May 21, 2021, 3:52 a.m. UTC | #4
Thanks, applied, with a cleaned up commit description.

Cheers,

					- Ted
Phillip Potter May 21, 2021, 7:31 a.m. UTC | #5
On Thu, May 20, 2021 at 11:52:31PM -0400, Theodore Y. Ts'o wrote:
> Thanks, applied, with a cleaned up commit description.
> 
> Cheers,
> 
> 					- Ted

Dear Ted,

Thank you for applying the patch, appreciate it.

Regards,
Phil
diff mbox series

Patch

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