diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2022-04-02 13:57:40 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2022-04-02 13:57:40 +0000 |
commit | 72c8703886841839b88da33f010d814b50f75231 (patch) | |
tree | b106eb7eda9f59084031284afbe38eb7beae8d4f /sys | |
parent | 11beeebfc32a6efc3f5399e7bfb30a2bcd876a22 (diff) |
Bring back r1.247, using scsi_detach_link() to release
a partially configured struct scsi_link.
Problematic code path found by jungle Boogie was plugged
by r1.249.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/scsi/scsiconf.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c index 3514716e96d..78b2b4131c8 100644 --- a/sys/scsi/scsiconf.c +++ b/sys/scsi/scsiconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.c,v 1.249 2022/03/28 15:47:11 krw Exp $ */ +/* $OpenBSD: scsiconf.c,v 1.250 2022/04/02 13:57:39 krw Exp $ */ /* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */ /* @@ -519,7 +519,8 @@ scsi_probe_link(struct scsibus_softc *sb, int target, int lun, int dumbscan) SC_DEBUG(link, SDEV_DB2, ("dev_probe(link) failed.\n")); rslt = EINVAL; } - goto free; + free(link, M_DEVBUF, sizeof(*link)); + return rslt; } /* @@ -622,7 +623,7 @@ scsi_probe_link(struct scsibus_softc *sb, int target, int lun, int dumbscan) /* The device doesn't distinguish between LUNs. */ SC_DEBUG(link, SDEV_DB1, ("IDENTIFY not supported.\n")); rslt = EINVAL; - goto free_devid; + goto bad; } link->quirks = devquirks; /* Restore what the device wanted. */ @@ -679,7 +680,7 @@ scsi_probe_link(struct scsibus_softc *sb, int target, int lun, int dumbscan) if (cf == NULL) { scsibussubprint(&sa, sb->sc_dev.dv_xname); printf(" not configured\n"); - goto free_devid; + goto bad; } /* @@ -717,17 +718,8 @@ scsi_probe_link(struct scsibus_softc *sb, int target, int lun, int dumbscan) config_attach((struct device *)sb, cf, &sa, scsibussubprint); return 0; -free_devid: - if (link->id) - devid_free(link->id); bad: - if (ISSET(link->flags, SDEV_OWN_IOPL)) - free(link->pool, M_DEVBUF, sizeof(*link->pool)); - - if (sb->sb_adapter->dev_free != NULL) - sb->sb_adapter->dev_free(link); -free: - free(link, M_DEVBUF, sizeof(*link)); + scsi_detach_link(link, DETACH_FORCE); return rslt; } |