netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 07/26] [NETLINK]: Fix processing of fib_lookup netlink messages
       [not found] ` <20051213082143.GA5823@kroah.com>
@ 2005-12-13  8:22   ` Greg KH
  0 siblings, 0 replies; only message in thread
From: Greg KH @ 2005-12-13  8:22 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Justin Forbes, Zwane Mwaikambo, Theodore Ts'o, Randy Dunlap,
	Dave Jones, Chuck Wolber, torvalds, akpm, alan, tgraf, davem,
	netdev

[-- Attachment #1: fix-processing-of-fib_lookup-netlink-messages.patch --]
[-- Type: text/plain, Size: 1179 bytes --]

-stable review patch.  If anyone has any objections, please let us know.

------------------
From: Thomas Graf <tgraf@suug.ch>

The receive path for fib_lookup netlink messages is lacking sanity
checks for header and payload and is thus vulnerable to malformed
netlink messages causing illegal memory references.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 net/ipv4/fib_frontend.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- linux-2.6.14.3.orig/net/ipv4/fib_frontend.c
+++ linux-2.6.14.3/net/ipv4/fib_frontend.c
@@ -545,12 +545,16 @@ static void nl_fib_input(struct sock *sk
 	struct sk_buff *skb = NULL;
         struct nlmsghdr *nlh = NULL;
 	struct fib_result_nl *frn;
-	int err;
 	u32 pid;     
 	struct fib_table *tb;
 	
-	skb = skb_recv_datagram(sk, 0, 0, &err);
+	skb = skb_dequeue(&sk->sk_receive_queue);
 	nlh = (struct nlmsghdr *)skb->data;
+	if (skb->len < NLMSG_SPACE(0) || skb->len < nlh->nlmsg_len ||
+	    nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*frn))) {
+		kfree_skb(skb);
+		return;
+	}
 	
 	frn = (struct fib_result_nl *) NLMSG_DATA(nlh);
 	tb = fib_get_table(frn->tb_id_in);

--

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-12-13  8:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20051213073430.558435000@press.kroah.org>
     [not found] ` <20051213082143.GA5823@kroah.com>
2005-12-13  8:22   ` [patch 07/26] [NETLINK]: Fix processing of fib_lookup netlink messages Greg KH

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).