From: Amit Choudhary <amit2030@gmail.com>
To: Linux Kernel <linux-kernel@vger.kernel.org>, akpm@osdl.org
Cc: netdev@vger.kernel.org
Subject: [PATCH 2.6.19-rc2] [REVISED] net/ipv4/multipath_wrandom.c: check kmalloc() return value.
Date: Sun, 22 Oct 2006 23:59:58 -0700 [thread overview]
Message-ID: <20061022235958.b31d7529.amit2030@gmail.com> (raw)
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);
}
next reply other threads:[~2006-10-23 7:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-23 6:59 Amit Choudhary [this message]
2006-10-23 7:46 ` [PATCH 2.6.19-rc2] [REVISED] net/ipv4/multipath_wrandom.c: check kmalloc() return value James Morris
2006-10-23 11:17 ` Patrick McHardy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061022235958.b31d7529.amit2030@gmail.com \
--to=amit2030@gmail.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).