[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 10/10] iscsi: Don't use error_is_set() to suppress ad
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 10/10] iscsi: Don't use error_is_set() to suppress additional errors |
Date: |
Fri, 25 Apr 2014 18:07:26 +0200 |
From: Markus Armbruster <address@hidden>
Using error_is_set(errp) that way can sweep programming errors under
the carpet when we get called incorrectly with an error set.
Commit 24d3bd6 added a broken error path to iscsi_do_inquiry(): it
first calls error_setg(), then jumps to the preexisting error label,
where error_setg() gets called again, triggering an assertion failure.
Commit cbee81f fixed this by guarding the second error_setg() with an
error_is_set().
Replace this fix by a simpler and safer one: jump right behind the
second error_setg().
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
block/iscsi.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/block/iscsi.c b/block/iscsi.c
index a636ea4..a30202b 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -1095,16 +1095,15 @@ static struct scsi_task *iscsi_do_inquiry(struct
iscsi_context *iscsi, int lun,
*inq = scsi_datain_unmarshall(task);
if (*inq == NULL) {
error_setg(errp, "iSCSI: failed to unmarshall inquiry datain blob");
- goto fail;
+ goto fail_with_err;
}
return task;
fail:
- if (!error_is_set(errp)) {
- error_setg(errp, "iSCSI: Inquiry command failed : %s",
- iscsi_get_error(iscsi));
- }
+ error_setg(errp, "iSCSI: Inquiry command failed : %s",
+ iscsi_get_error(iscsi));
+fail_with_err:
if (task != NULL) {
scsi_free_scsi_task(task);
}
--
1.9.0
- [Qemu-devel] [PULL 00/10] Block patches, Stefan Hajnoczi, 2014/04/25
- [Qemu-devel] [PULL 01/10] block: Prevent coroutine stack overflow when recursing in bdrv_open_backing_file., Stefan Hajnoczi, 2014/04/25
- [Qemu-devel] [PULL 02/10] doc: add -drive rerror=, werror= to qemu --help output, Stefan Hajnoczi, 2014/04/25
- [Qemu-devel] [PULL 03/10] qemu-iotests: Improve and make use of QMPTestCase.wait_until_completed(), Stefan Hajnoczi, 2014/04/25
- [Qemu-devel] [PULL 04/10] MAINTAINERS: Add qemu-img/io to block subsystem, Stefan Hajnoczi, 2014/04/25
- [Qemu-devel] [PULL 05/10] block: Expose host_* drivers in blockdev-add, Stefan Hajnoczi, 2014/04/25
- [Qemu-devel] [PULL 06/10] Use error_is_set() only when necessary (again), Stefan Hajnoczi, 2014/04/25
- [Qemu-devel] [PULL 07/10] qemu-img: Consistently name Error * objects err, and not errp, Stefan Hajnoczi, 2014/04/25
- [Qemu-devel] [PULL 08/10] nbd: Use return values instead of error_is_set(errp), Stefan Hajnoczi, 2014/04/25
- [Qemu-devel] [PULL 10/10] iscsi: Don't use error_is_set() to suppress additional errors,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 09/10] blockdev: Clean up fragile use of error_is_set(), Stefan Hajnoczi, 2014/04/25
- Re: [Qemu-devel] [PULL 00/10] Block patches, Peter Maydell, 2014/04/28