Commit 5eed69ff authored by Dwight Engen's avatar Dwight Engen Committed by David S. Miller

sunvdc: limit each sg segment to a page

ldc_map_sg() could fail its check that the number of pages referred to
by the sg scatterlist was <= the number of cookies.

This fixes the issue by doing a similar thing to the xen-blkfront driver,
ensuring that the scatterlist will only ever contain a segment count <=
port->ring_cookies, and each segment will be page aligned, and <= page
size. This ensures that the scatterlist is always mappable.

Orabug: 19347817
OraBZ: 15945
Signed-off-by: default avatarDwight Engen <dwight.engen@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent de5b73f0
...@@ -747,6 +747,10 @@ static int probe_disk(struct vdc_port *port) ...@@ -747,6 +747,10 @@ static int probe_disk(struct vdc_port *port)
port->disk = g; port->disk = g;
/* Each segment in a request is up to an aligned page in size. */
blk_queue_segment_boundary(q, PAGE_SIZE - 1);
blk_queue_max_segment_size(q, PAGE_SIZE);
blk_queue_max_segments(q, port->ring_cookies); blk_queue_max_segments(q, port->ring_cookies);
blk_queue_max_hw_sectors(q, port->max_xfer_size); blk_queue_max_hw_sectors(q, port->max_xfer_size);
g->major = vdc_major; g->major = vdc_major;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment