diff options
author | Tony Battersby <tonyb@cybernetics.com> | 2009-01-20 17:00:09 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-03-12 12:58:05 -0500 |
commit | a2dd3b4cea335713b58996bb07b3abcde1175f47 (patch) | |
tree | 3097816f8abd5fb57dda669d3e776c35f1455f43 /Documentation | |
parent | c6517b7942fad663cc1cf3235cbe4207cf769332 (diff) | |
download | lwn-a2dd3b4cea335713b58996bb07b3abcde1175f47.tar.gz lwn-a2dd3b4cea335713b58996bb07b3abcde1175f47.zip |
[SCSI] sg: fix races with ioctl(SG_IO)
sg_io_owned needs to be set before the command is sent to the midlevel;
otherwise, a quickly-completing command may cause a different CPU
to see "srp->done == 1 && !srp->sg_io_owned", which would lead to
incorrect behavior.
Check srp->done and set srp->orphan while holding rq_list_lock to
prevent races with sg_rq_end_io().
There is no need to check sfp->closed from read/write/ioctl/poll/etc.
since the kernel guarantees that this won't happen.
The usefulness of sg_srp_done() was questionable before; now it is
definitely not needed.
Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'Documentation')
0 files changed, 0 insertions, 0 deletions