]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
vds_blk_rw() should check bio_alloc() NULL return value
authorBijan Mottahedeh <bijan.mottahedeh@oracle.com>
Tue, 15 Mar 2016 09:21:51 +0000 (02:21 -0700)
committerAllen Pais <allen.pais@oracle.com>
Thu, 15 Sep 2016 06:35:07 +0000 (12:05 +0530)
Orabug: 22934031

Signed-off-by: Bijan Mottahedeh <bijan.mottahedeh@oracle.com>
(cherry picked from commit fec4ca1085a268c38a4a12c6119322aaf2f87698)
(cherry picked from commit d590a3711158228194ea31da0f1fea612bd13c05)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
drivers/block/vds/vds_blk.c

index d71f545f449a02c5425069ddda2428f1a70a3d18..38c762c5a1c419f9fe72fd2d39e7ba0222eda898 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * vds_blk.c: LDOM Virtual Disk Server.
  *
- * Copyright (C) 2014, 2015 Oracle. All rights reserved.
+ * Copyright (C) 2014, 2016 Oracle. All rights reserved.
  */
 
 #include "vds.h"
@@ -116,6 +116,11 @@ static int vds_blk_rw(struct vds_io *io)
         */
        while (resid) {
                bio = bio_alloc(GFP_NOIO, npages);
+               if (!bio) {
+                       vdsmsg(err, "bio_alloc failed: npages=%d\n", npages);
+                       err = -EIO;
+                       break;
+               }
                bio->bi_iter.bi_sector = offset + (size - resid);
                bio->bi_bdev = bdev;
                bio->bi_end_io = vds_blk_end_io;