]> git.ipfire.org Git - thirdparty/qemu.git/commit
mirror: Do not dereference invalid pointers
authorMax Reitz <mreitz@redhat.com>
Mon, 14 Oct 2019 15:39:28 +0000 (17:39 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 4 Nov 2019 14:18:06 +0000 (08:18 -0600)
commitc0e2fbf1240f022efc267cef4216e9c023651bee
treed3687714b326033d4a6bd16d6e19cab27aba14b8
parentb077ac637db468ad169385d9b702b002654d3a7a
mirror: Do not dereference invalid pointers

mirror_exit_common() may be called twice (if it is called from
mirror_prepare() and fails, it will be called from mirror_abort()
again).

In such a case, many of the pointers in the MirrorBlockJob object will
already be freed.  This can be seen most reliably for s->target, which
is set to NULL (and then dereferenced by blk_bs()).

Cc: qemu-stable@nongnu.org
Fixes: 737efc1eda23b904fbe0e66b37715fb0e5c3e58b
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-id: 20191014153931.20699-2-mreitz@redhat.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
(cherry picked from commit f93c3add3a773e0e3f6277e5517583c4ad3a43c2)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
block/mirror.c