Commit 40d40c6b authored by Diogo Jahchan Koike's avatar Diogo Jahchan Koike Committed by Kent Overstreet
Browse files

bcachefs: assign return error when iterating through layout

syzbot reported a null ptr deref in __copy_user [0]

In __bch2_read_super, when a corrupt backup superblock matches the
default opts offset, no error is assigned to ret and the freed superblock
gets through, possibly being assigned as the best sb in bch2_fs_open and
being later dereferenced, causing a fault. Assign EINVALID to ret when
iterating through layout.

[0]: https://syzkaller.appspot.com/bug?extid=18a5c5e8a9c856944876



Reported-by: default avatar <syzbot+18a5c5e8a9c856944876@syzkaller.appspotmail.com>
Closes: https://syzkaller.appspot.com/bug?extid=18a5c5e8a9c856944876


Signed-off-by: default avatarDiogo Jahchan Koike <djahchankoike@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent c6040447
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment