fat: fix uninit-memory access for partial initialized inode
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Fri, 6 Mar 2020 06:28:36 +0000 (22:28 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 11 Mar 2020 13:15:01 +0000 (14:15 +0100)
commita867bbb23a1c9e346d62e13f2f715d53850e3dd0
tree79a94be6a3abab9cdf3eb21dc3e3aa98e0620c6b
parentc5451843ac66f3aaa02a6f1d48790e4b8dc49d24
fat: fix uninit-memory access for partial initialized inode

commit bc87302a093f0eab45cd4e250c2021299f712ec6 upstream.

When get an error in the middle of reading an inode, some fields in the
inode might be still not initialized.  And then the evict_inode path may
access those fields via iput().

To fix, this makes sure that inode fields are initialized.

Reported-by: syzbot+9d82b8de2992579da5d0@syzkaller.appspotmail.com
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: <stable@vger.kernel.org>
Link: http://lkml.kernel.org/r/871rqnreqx.fsf@mail.parknet.co.jp
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/fat/inode.c