]> www.infradead.org Git - users/dwmw2/qemu.git/commit
nvme: Fix nvme_init error handling
authorFam Zheng <famz@redhat.com>
Thu, 12 Jul 2018 02:54:20 +0000 (10:54 +0800)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 19 Mar 2019 02:40:15 +0000 (21:40 -0500)
commitac141891ee1e734024a877767b4fd938d1874cd1
tree05db7e0a92a0024f4a20bb92e19a74e1412117d4
parent4b4201206c21e0608eb749e07eeae60dbcc068ff
nvme: Fix nvme_init error handling

It is wrong to leave this field as 1, as nvme_close() called in the
error handling code in nvme_file_open() will use it and try to free
s->queues again.

Another problem is the cleaning ups are duplicated between the fail*
labels of nvme_init() and nvme_file_open(), which calls nvme_close().

A third problem is nvme_close() misses g_free() and
event_notifier_cleanup().

Fix all of them.

Cc: qemu-stable@nongnu.org
Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20180712025420.4932-1-famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
(cherry picked from commit 9582f357bb6f6573c9a452743d8f3ab41ba2e3fa)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
block/nvme.c