diff options
author | Roger Pau Monne <roger.pau@citrix.com> | 2013-06-22 03:59:17 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2013-06-25 10:00:58 -0400 |
commit | 1e0f7a21b2fffc70f27cc4a454c60321501045b1 (patch) | |
tree | 0a6eb8b048e694cc4ffb69af6f94f2bd5e8105cd | |
parent | 294caaf29c26cfed3b446fb46393b8b39ea1c0d3 (diff) |
xen-blkback: check the number of iovecs before allocating a bios
With the introduction of indirect segments we can receive requests
with a number of segments bigger than the maximum number of allowed
iovecs in a bios, so make sure that blkback doesn't try to allocate a
bios with more iovecs than BIO_MAX_PAGES
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
-rw-r--r-- | drivers/block/xen-blkback/blkback.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index 4662217c61be..bf4b9d282c04 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c | |||
@@ -1247,7 +1247,8 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif, | |||
1247 | seg[i].nsec << 9, | 1247 | seg[i].nsec << 9, |
1248 | seg[i].offset) == 0)) { | 1248 | seg[i].offset) == 0)) { |
1249 | 1249 | ||
1250 | bio = bio_alloc(GFP_KERNEL, nseg-i); | 1250 | int nr_iovecs = min_t(int, (nseg-i), BIO_MAX_PAGES); |
1251 | bio = bio_alloc(GFP_KERNEL, nr_iovecs); | ||
1251 | if (unlikely(bio == NULL)) | 1252 | if (unlikely(bio == NULL)) |
1252 | goto fail_put_bio; | 1253 | goto fail_put_bio; |
1253 | 1254 | ||