kopia lustrzana https://gitlab.com/sane-project/backends
Wait for the completion of all SCSI commands in sanei_scsi_flush_all_extended
(Linux). Without this fix, especially long running commands and command queuing would cause memory corruption if the buffer was invalid after the flush command.merge-requests/1/head
rodzic
8d9c13ed82
commit
646fbd05bc
|
@ -1,3 +1,10 @@
|
|||
2003-03-09 Henning Meier-Geinitz <henning@meier-geinitz.de>
|
||||
|
||||
* sanei/sanei_scsi.c: Wait for the completion of all SCSI commands in
|
||||
sanei_scsi_flush_all_extended (Linux). Without this fix, especially
|
||||
long running commands and command queuing would cause memory
|
||||
corruption if the buffer was invalid after the flush command.
|
||||
|
||||
2003-03-07 Henning Meier-Geinitz <henning@meier-geinitz.de>
|
||||
|
||||
* backend/mustek.c doc/descriptions/mustek.desc
|
||||
|
|
|
@ -1824,20 +1824,30 @@ sanei_scsi_req_flush_all_extended (int fd)
|
|||
{
|
||||
fdparms *fdp;
|
||||
struct req *req, *next_req;
|
||||
int len, count;
|
||||
|
||||
fdp = (fdparms*) fd_info[fd].pdata;
|
||||
for (req = fdp->sane_qhead; req; req = next_req)
|
||||
{
|
||||
if (req->running && !req->done)
|
||||
{
|
||||
count = sane_scsicmd_timeout * 10;
|
||||
while (count)
|
||||
{
|
||||
errno = 0;
|
||||
#ifdef SG_IO
|
||||
if (sg_version < 30000)
|
||||
if (sg_version < 30000)
|
||||
#endif
|
||||
read (fd, &req->sgdata.cdb, req->sgdata.cdb.hdr.reply_len);
|
||||
len = read (fd, &req->sgdata.cdb, req->sgdata.cdb.hdr.reply_len);
|
||||
#ifdef SG_IO
|
||||
else
|
||||
read (fd, &req->sgdata.sg3.hdr, sizeof(Sg_io_hdr));
|
||||
else
|
||||
len = read (fd, &req->sgdata.sg3.hdr, sizeof(Sg_io_hdr));
|
||||
#endif
|
||||
if (len >= 0 || (len < 0 && errno != EAGAIN))
|
||||
break;
|
||||
usleep (100000);
|
||||
count--;
|
||||
}
|
||||
((fdparms*) fd_info[req->fd].pdata)->sg_queue_used--;
|
||||
}
|
||||
next_req = req->next;
|
||||
|
|
Ładowanie…
Reference in New Issue