block: Fix parameter checking in bdrv_co_copy_range_internal
commitd4d3e5a0d53a57282955e8a3ed7acc1ca90552d9
authorFam Zheng <famz@redhat.com>
Tue, 3 Jul 2018 02:37:56 +0000 (3 10:37 +0800)
committerJeff Cody <jcody@redhat.com>
Tue, 3 Jul 2018 03:23:45 +0000 (2 23:23 -0400)
tree02d2967cc330109319d345ef27bdcc17459c2b39
parentab08440a4ee09032d1a9cb22fdcab23bc7e1c656
block: Fix parameter checking in bdrv_co_copy_range_internal

src may be NULL if BDRV_REQ_ZERO_WRITE flag is set, in this case only
check dst and dst->bs. This bug was introduced when moving in the
request tracking code from bdrv_co_copy_range, in 37aec7d75eb.

This especially fixes the possible segfault when initializing src_bs
with a NULL src.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-id: 20180703023758.14422-2-famz@redhat.com
Reviewed-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
block/io.c