ext4: fix memory leak in ext4_fill_super
authorPavel Skripkin <paskripkin@gmail.com>
Fri, 30 Apr 2021 18:50:46 +0000 (21:50 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Jul 2021 07:45:03 +0000 (09:45 +0200)
commit5e4f5138bd8522ebe231a137682d3857209a2c07
treefe6d2e22d50a5f89fe808daab7f856f28d6c80d6
parent3780348c1a0e14ffefcaf1fc521f815bcaac94b0
ext4: fix memory leak in ext4_fill_super

commit 618f003199c6188e01472b03cdbba227f1dc5f24 upstream.

static int kthread(void *_create) will return -ENOMEM
or -EINTR in case of internal failure or
kthread_stop() call happens before threadfn call.

To prevent fancy error checking and make code
more straightforward we moved all cleanup code out
of kmmpd threadfn.

Also, dropped struct mmpd_data at all. Now struct super_block
is a threadfn data and struct buffer_head embedded into
struct ext4_sb_info.

Reported-by: syzbot+d9e482e303930fa4f6ff@syzkaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Link: https://lore.kernel.org/r/20210430185046.15742-1-paskripkin@gmail.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/ext4.h
fs/ext4/mmp.c
fs/ext4/super.c