lkml.org 
[lkml]   [2002]   [Dec]   [27]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
FromKevin Corry <>
Subject[PATCH] dm.c : Check memory allocations
DateFri, 27 Dec 2002 16:55:31 -0500 (EST)
Check memory allocations when cloning bio's.

--- linux-2.5.53a/drivers/md/dm.c	Mon Dec 23 23:21:04 2002
+++ linux-2.5.53b/drivers/md/dm.c	Fri Dec 27 14:50:29 2002
@@ -394,6 +393,10 @@
 		 */
 		clone = clone_bio(bio, ci->sector, ci->idx,
 				  bio->bi_vcnt - ci->idx, ci->sector_count);
+		if (!clone) {
+			dec_pending(ci->io, -ENOMEM);
+			return;
+		}
 		__map_bio(ti, clone, ci->io);
 		ci->sector_count = 0;
 
@@ -417,6 +420,10 @@
 		}
 
 		clone = clone_bio(bio, ci->sector, ci->idx, i - ci->idx, len);
+		if (!clone) {
+			dec_pending(ci->io, -ENOMEM);
+			return;
+		}
 		__map_bio(ti, clone, ci->io);
 
 		ci->sector += len;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 12:31    [from the cache]
©2003-2008