Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F140657165
D20703.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D20703.diff
View Options
Index: head/sys/dev/virtio/scsi/virtio_scsi.c
===================================================================
--- head/sys/dev/virtio/scsi/virtio_scsi.c
+++ head/sys/dev/virtio/scsi/virtio_scsi.c
@@ -81,6 +81,7 @@
struct virtio_scsi_config *);
static int vtscsi_maximum_segments(struct vtscsi_softc *, int);
static int vtscsi_alloc_virtqueues(struct vtscsi_softc *);
+static void vtscsi_check_sizes(struct vtscsi_softc *);
static void vtscsi_write_device_config(struct vtscsi_softc *);
static int vtscsi_reinit(struct vtscsi_softc *);
@@ -311,6 +312,8 @@
goto fail;
}
+ vtscsi_check_sizes(sc);
+
error = vtscsi_init_event_vq(sc);
if (error) {
device_printf(dev, "cannot populate the eventvq\n");
@@ -475,6 +478,26 @@
"%s request", device_get_nameunit(dev));
return (virtio_alloc_virtqueues(dev, 0, nvqs, vq_info));
+}
+
+static void
+vtscsi_check_sizes(struct vtscsi_softc *sc)
+{
+ int rqsize;
+
+ if ((sc->vtscsi_flags & VTSCSI_FLAG_INDIRECT) == 0) {
+ /*
+ * Ensure the assertions in virtqueue_enqueue(),
+ * even if the hypervisor reports a bad seg_max.
+ */
+ rqsize = virtqueue_size(sc->vtscsi_request_vq);
+ if (sc->vtscsi_max_nsegs > rqsize) {
+ device_printf(sc->vtscsi_dev,
+ "clamping seg_max (%d %d)\n", sc->vtscsi_max_nsegs,
+ rqsize);
+ sc->vtscsi_max_nsegs = rqsize;
+ }
+ }
}
static void
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 27, 12:34 PM (7 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27305059
Default Alt Text
D20703.diff (1 KB)
Attached To
Mode
D20703: VirtIO SCSI: validate seg_max from hypervisor
Attached
Detach File
Event Timeline
Log In to Comment