diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2013-09-18 01:06:27 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2013-09-18 01:06:27 +0000 |
commit | 794c74f7094ab16ad0f15bfbdca1d69114d162df (patch) | |
tree | 9ba45e65a93331d740343480afe6a685853904d2 | |
parent | 904cb61c0591a4e1072e961d05cfdf7c00b544c1 (diff) |
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 |