diff options
author | 2013-09-18 01:06:26 +0000 | |
---|---|---|
committer | 2013-09-18 01:06:26 +0000 | |
commit | 9c548e355d031161f7c502389f57388ad76ffe62 (patch) | |
tree | 0f611efdddc7140b317c8eb21313b56692ee4a01 | |
parent | size_t could not be < 0. (diff) | |
download | wireguard-openbsd-9c548e355d031161f7c502389f57388ad76ffe62.tar.xz wireguard-openbsd-9c548e355d031161f7c502389f57388ad76ffe62.zip |
return after done in atascsi_disk_unmap.
-rw-r--r-- | sys/dev/ata/atascsi.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/sys/dev/ata/atascsi.c b/sys/dev/ata/atascsi.c index f7197e99200..82a60775e34 100644 --- a/sys/dev/ata/atascsi.c +++ b/sys/dev/ata/atascsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atascsi.c,v 1.116 2011/08/03 00:27:20 dlg Exp $ */ +/* $OpenBSD: atascsi.c,v 1.117 2013/09/18 01:06:26 dlg Exp $ */ /* * Copyright (c) 2007 David Gwynne <dlg@openbsd.org> @@ -1060,16 +1060,22 @@ atascsi_disk_unmap(struct scsi_xfer *xs) cdb = (struct scsi_unmap *)xs->cmd; len = _2btol(cdb->list_len); - if (xs->datalen != len || len < sizeof(*unmap)) + if (xs->datalen != len || len < sizeof(*unmap)) { atascsi_done(xs, XS_DRIVER_STUFFUP); + return; + } unmap = (struct scsi_unmap_data *)xs->data; - if (_2btol(unmap->data_length) != len) + if (_2btol(unmap->data_length) != len) { atascsi_done(xs, XS_DRIVER_STUFFUP); + return; + } len = _2btol(unmap->desc_length); - if (len != xs->datalen - sizeof(*unmap)) + if (len != xs->datalen - sizeof(*unmap)) { atascsi_done(xs, XS_DRIVER_STUFFUP); + return; + } if (len < sizeof(struct scsi_unmap_desc)) { /* no work, no error according to sbc3 */ @@ -1079,14 +1085,17 @@ atascsi_disk_unmap(struct scsi_xfer *xs) if (len > sizeof(struct scsi_unmap_desc) * 64) { /* more work than we advertised */ atascsi_done(xs, XS_DRIVER_STUFFUP); + return; } /* let's go */ if (!ISSET(xs->flags, SCSI_NOSLEEP)) atascsi_disk_unmap_task(xs, NULL); else if (workq_add_task(NULL, 0, atascsi_disk_unmap_task, - xs, NULL) != 0) + xs, NULL) != 0) { atascsi_done(xs, XS_DRIVER_STUFFUP); + return; + } } void |