diff options
author | Asias He <asias@redhat.com> | 2013-04-02 11:31:37 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-04-02 19:43:34 -0400 |
commit | af0d9187f66db2711f94dc20d5a06ec9ba5845b3 (patch) | |
tree | 6458ebd741af6112cdfda39030edba9a9637e587 /drivers/vhost | |
parent | f85eda8d75d37a3796cee7f5a906e50e3f13d9e1 (diff) |
tcm_vhost: Use ACCESS_ONCE for vs->vs_tpg[target] access
In vhost_scsi_handle_vq:
tv_tpg = vs->vs_tpg[target];
if (!tv_tpg) {
....
return
}
tv_cmd = vhost_scsi_allocate_cmd(tv_tpg, &v_req,
1) vs->vs_tpg[target] might change after the NULL check and 2) the above
line might access tv_tpg from vs->vs_tpg[target]. To prevent 2), use
ACCESS_ONCE. Thanks mst for catching this up!
Signed-off-by: Asias He <asias@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/vhost')
-rw-r--r-- | drivers/vhost/tcm_vhost.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c index 2968b4934659..dd9614eb2577 100644 --- a/drivers/vhost/tcm_vhost.c +++ b/drivers/vhost/tcm_vhost.c | |||
@@ -661,7 +661,7 @@ static void vhost_scsi_handle_vq(struct vhost_scsi *vs, | |||
661 | 661 | ||
662 | /* Extract the tpgt */ | 662 | /* Extract the tpgt */ |
663 | target = v_req.lun[1]; | 663 | target = v_req.lun[1]; |
664 | tv_tpg = vs->vs_tpg[target]; | 664 | tv_tpg = ACCESS_ONCE(vs->vs_tpg[target]); |
665 | 665 | ||
666 | /* Target does not exist, fail the request */ | 666 | /* Target does not exist, fail the request */ |
667 | if (unlikely(!tv_tpg)) { | 667 | if (unlikely(!tv_tpg)) { |