Revert "vhost/scsi: null-ptr-dereference in vhost_scsi_get_req()"
This reverts commit 11889a0690
.
This commit is contained in:
parent
a64018a67a
commit
f8bd4809aa
1 changed files with 11 additions and 14 deletions
|
@ -919,23 +919,20 @@ vhost_scsi_get_req(struct vhost_virtqueue *vq, struct vhost_scsi_ctx *vc,
|
|||
/* virtio-scsi spec requires byte 0 of the lun to be 1 */
|
||||
vq_err(vq, "Illegal virtio-scsi lun: %u\n", *vc->lunp);
|
||||
} else {
|
||||
struct vhost_scsi_tpg **vs_tpg, *tpg = NULL;
|
||||
struct vhost_scsi_tpg **vs_tpg, *tpg;
|
||||
|
||||
vs_tpg = vhost_vq_get_backend(vq); /* validated at handler entry */
|
||||
|
||||
if (vc->target) {
|
||||
/* validated at handler entry */
|
||||
vs_tpg = vhost_vq_get_backend(vq);
|
||||
tpg = READ_ONCE(vs_tpg[*vc->target]);
|
||||
if (unlikely(!tpg)) {
|
||||
vq_err(vq, "Target 0x%x does not exist\n", *vc->target);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if (tpgp)
|
||||
*tpgp = tpg;
|
||||
ret = 0;
|
||||
}
|
||||
out:
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue