btrfs: Exit gracefully when chunk map cannot be inserted to the tree
authorQu Wenruo <wqu@suse.com>
Wed, 1 Aug 2018 02:37:20 +0000 (10:37 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 15 Sep 2018 07:45:32 +0000 (09:45 +0200)
commit145b1f56b99238ec37dfa2b0e9dec039d4d1d2cd
tree34da39aaa00904cec191a3c74ccb0e1eed6092a2
parent80f97c79f3e1ce183ed5cc1cf08e01cb85999219
btrfs: Exit gracefully when chunk map cannot be inserted to the tree

[ Upstream commit 64f64f43c89aca1782aa672e0586f6903c5d8979 ]

It's entirely possible that a crafted btrfs image contains overlapping
chunks.

Although we can't detect such problem by tree-checker, it's not a
catastrophic problem, current extent map can already detect such problem
and return -EEXIST.

We just only need to exit gracefully and fail the mount.

Reported-by: Xu Wen <wen.xu@gatech.edu>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=200409
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/volumes.c