OpenVZ Forum


Home » Mailing lists » Devel » [PATCH] OOPS with NETLINK_FIB_LOOKUP netlink socket
[PATCH] OOPS with NETLINK_FIB_LOOKUP netlink socket [message #25362] Fri, 21 December 2007 08:58 Go to previous message
den is currently offline  den
Messages: 494
Registered: December 2005
Senior Member
nl_fib_input re-reuses incoming skb to send the reply. This means that this
packet will be freed twice, namely in:
- netlink_unicast_kernel
- on receive path
Use clone to send as a cure, the caller is responsible for kfree_skb on error.

Thanks to Alexey Dobryan, who originally found the problem.

Signed-off-by: Denis V. Lunev <den@openvz.org>
---
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index b03c4c6..ac6238a 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -832,10 +832,13 @@ static void nl_fib_input(struct sk_buff *skb)
 
 	nlh = nlmsg_hdr(skb);
 	if (skb->len < NLMSG_SPACE(0) || skb->len < nlh->nlmsg_len ||
-	    nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*frn))) {
-		kfree_skb(skb);
+	    nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*frn)))
 		return;
-	}
+
+	skb = skb_clone(skb, GFP_KERNEL);
+	if (skb == NULL)
+		return;
+	nlh = nlmsg_hdr(skb);
 
 	frn = (struct fib_result_nl *) NLMSG_DATA(nlh);
 	tb = fib_get_table(frn->tb_id_in);
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: [patch 1/2] [RFC] Simple tamper-proof device filesystem.
Next Topic: [PATCH 0/10] sysfs network namespace support
Goto Forum:
  


Current Time: Sun Jul 27 10:39:56 GMT 2025

Total time taken to generate the page: 0.42580 seconds