netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [REVISED] net/ipv4/multipath_wrandom.c: check kmalloc() return value.
@ 2007-03-09  7:22 Amit Choudhary
  2007-03-09  7:29 ` David Miller
  0 siblings, 1 reply; 9+ messages in thread
From: Amit Choudhary @ 2007-03-09  7:22 UTC (permalink / raw)
  To: Linux Kernel, akpm; +Cc: netdev

Description: Check the return value of kmalloc() in function wrandom_set_nhinfo(), in file net/ipv4/multipath_wrandom.c.

Signed-off-by: Amit Choudhary <amit2030@gmail.com>

diff --git a/net/ipv4/multipath_wrandom.c b/net/ipv4/multipath_wrandom.c
index 92b0482..bcdb1f1 100644
--- a/net/ipv4/multipath_wrandom.c
+++ b/net/ipv4/multipath_wrandom.c
@@ -242,6 +242,9 @@ static void wrandom_set_nhinfo(__be32 ne
 		target_route = (struct multipath_route *)
 			kmalloc(size_rt, GFP_ATOMIC);
 
+		if (!target_route)
+			goto error;
+
 		target_route->gw = nh->nh_gw;
 		target_route->oif = nh->nh_oif;
 		memset(&target_route->rcu, 0, sizeof(struct rcu_head));
@@ -263,6 +266,9 @@ static void wrandom_set_nhinfo(__be32 ne
 		target_dest = (struct multipath_dest*)
 			kmalloc(size_dst, GFP_ATOMIC);
 
+		if (!target_dest)
+			goto error;
+
 		target_dest->nh_info = nh;
 		target_dest->network = network;
 		target_dest->netmask = netmask;
@@ -275,6 +281,7 @@ static void wrandom_set_nhinfo(__be32 ne
 	 * we are finished
 	 */
 
+ error:
 	spin_unlock_bh(&state[state_idx].lock);
 }
 

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-03-13  7:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-09  7:22 [PATCH] [REVISED] net/ipv4/multipath_wrandom.c: check kmalloc() return value Amit Choudhary
2007-03-09  7:29 ` David Miller
2007-03-12 11:51   ` Jarek Poplawski
2007-03-12 12:36     ` Pekka Enberg
2007-03-12 13:42       ` Jarek Poplawski
2007-03-12 20:54       ` David Miller
2007-03-12 20:53     ` Removal of multipath cached (was Re: [PATCH] [REVISED] net/ipv4/multipath_wrandom.c: check kmalloc() return value.) David Miller
2007-03-13  6:22       ` Andrew Morton
2007-03-13  7:05         ` Jarek Poplawski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).