]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: fix potential use-after-free for cloned bio
authorLiu Bo <bo.li.liu@oracle.com>
Mon, 10 Apr 2017 19:36:26 +0000 (12:36 -0700)
committerDavid Sterba <dsterba@suse.com>
Tue, 11 Apr 2017 16:49:56 +0000 (18:49 +0200)
commitc606562dc6762fcca060b35100937712342316ca
tree86b2f9e56b32934fc56b46148feb8509cf72c81b
parent32a3678ebff83f9577e5e0ba6e4119a92102326b
Btrfs: fix potential use-after-free for cloned bio

KASAN reports that there is a use-after-free case of bio in btrfs_map_bio.

If we need to submit IOs to several disks at a time, the original bio
would get cloned and mapped to the destination disk, but we really should
use the original bio instead of a cloned bio to do the sanity check
because cloned bios are likely to be freed by its endio.

Reported-by: Diego <diegocg@gmail.com>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c