f2c6836685
scsipi_xfer structures. When scsipi_execute_xs() calls the driver's scsi_cmd function, it assumes that it can still dereference a pointer to the scsipi_xfer struct. Since scsipi_done() has already been called, which in turn has called scsipi_free_xs(), the struct has already been returned the structure to the pool! In other words, xs->flags has been compromised, but we are still testing it. These changes resolve the problem by doing the following: - In scsipi_execute_xs(), if the hardware driver's scsi_cmd function returns SUCCESSFULLY_QUEUED, set a new flag (SCSI_ASYNCREQ) in xs->flags. Since the request will be handled asynchronously, we will need the scsipi_xfer struct to be freed in scsipi_done(). If the hardware driver's scsi_cmd function returns COMPLETE, we now simply return any actual errors, or 0 if none occurred. (Previously, we may have returned EJUSTRETURN, of which the sole effect was to avoid freeing the scsipi_xfer struct in our caller.) - In scsipi_done(), only free the scsipi_xfer struct for async requests. The contents of the struct will otherwise remain valid until the function that initiated the transfer frees it. With this change, responsibility for freeing the struct now lies in two places, depending on the type of the request: - For synchronous requests, the routine calling scsipi_execute_xs() must clean up. - For asynchronous requests, scsipi_done() cleans up (as it always has). [Note: this change also corrects a problem with sddump(): scsipi_done() was attempting to return a static scsipi_xfer struct to the pool! Since dumps are performed synchronously, we now handle this correctly.] This solution was provided by Jason Thorpe, after I got him to look at some related (but insufficient) attempts of my own. |
||
---|---|---|
.. | ||
ata | ||
dec | ||
eisa | ||
i2c | ||
ic | ||
isa | ||
isapnp | ||
microcode | ||
mii | ||
ofisa | ||
ofw | ||
pci | ||
pckbc | ||
pcmcia | ||
rcons | ||
sbus | ||
scsipi | ||
sun | ||
tc | ||
usb | ||
vme | ||
wscons | ||
auconv.c | ||
auconv.h | ||
audio_if.h | ||
audio.c | ||
audiovar.h | ||
ccd.c | ||
ccdvar.h | ||
clock_subr.c | ||
clock_subr.h | ||
cninit.c | ||
cons.c | ||
cons.h | ||
Makefile | ||
md.c | ||
md.h | ||
midi_if.h | ||
midi.c | ||
midisyn.c | ||
midisynvar.h | ||
midivar.h | ||
mulaw.c | ||
mulaw.h | ||
rnd.c | ||
rndpool.c | ||
sequencer.c | ||
sequencervar.h | ||
vnd.c | ||
vndvar.h |