From de404f0e3e17f35e95aae652c47d0c3fe4547feb Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 29 Oct 2010 11:46:56 -0600 Subject: [PATCH] --- yaml --- r: 221823 b: refs/heads/master c: f3f63c1c28bc861a931fac283b5bc3585efb8967 h: refs/heads/master i: 221821: ab3f689f2fc46f9f008fd0f52948cb5c23ac30ea 221819: 9664ab4c26d8291c3c2eeb5fdf23e70ea3a8520f 221815: 4ef765bc45e53fb88df444af3b48e68d22a25d7e 221807: 46e2819dfc8e2b8fb6b8a7eef58534fb125a5be8 221791: 1a9b7a599596f7bc67bf35893a966a6dcd6c2a16 221759: 61fd92e6189722fa440cddec09654c6847edbed0 221695: b5656fafc1b8fd2a08b51f138033a12144491414 v: v3 --- [refs] | 2 +- trunk/fs/bio.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index ff0827aedb82..83dd7183eb63 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 9f864c80913467312c7b8690e41fb5ebd1b50e92 +refs/heads/master: f3f63c1c28bc861a931fac283b5bc3585efb8967 diff --git a/trunk/fs/bio.c b/trunk/fs/bio.c index 8abb2dfb2e7c..8317a2c106bc 100644 --- a/trunk/fs/bio.c +++ b/trunk/fs/bio.c @@ -370,6 +370,9 @@ struct bio *bio_kmalloc(gfp_t gfp_mask, int nr_iovecs) { struct bio *bio; + if (nr_iovecs > UIO_MAXIOV) + return NULL; + bio = kmalloc(sizeof(struct bio) + nr_iovecs * sizeof(struct bio_vec), gfp_mask); if (unlikely(!bio)) @@ -697,8 +700,12 @@ static void bio_free_map_data(struct bio_map_data *bmd) static struct bio_map_data *bio_alloc_map_data(int nr_segs, int iov_count, gfp_t gfp_mask) { - struct bio_map_data *bmd = kmalloc(sizeof(*bmd), gfp_mask); + struct bio_map_data *bmd; + + if (iov_count > UIO_MAXIOV) + return NULL; + bmd = kmalloc(sizeof(*bmd), gfp_mask); if (!bmd) return NULL;