aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_frontend.c
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2007-12-21 05:01:53 -0500
committerDavid S. Miller <davem@davemloft.net>2007-12-21 05:01:53 -0500
commitd883a0367149506e8b7a3f31891d1ea30b9377f3 (patch)
treed016dc1959372baa50e6d64f76ff14bbe3c8927b /net/ipv4/fib_frontend.c
parent1ac70e7ad24a88710cf9b6d7ababaefa2b575df0 (diff)
[IPV4]: OOPS with NETLINK_FIB_LOOKUP netlink socket
[ Regression added by changeset: cd40b7d3983c708aabe3d3008ec64ffce56d33b0 [NET]: make netlink user -> kernel interface synchronious -DaveM ] 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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_frontend.c')
-rw-r--r--net/ipv4/fib_frontend.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 732d8f088b13..97abf934d185 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -804,10 +804,13 @@ static void nl_fib_input(struct sk_buff *skb)
804 804
805 nlh = nlmsg_hdr(skb); 805 nlh = nlmsg_hdr(skb);
806 if (skb->len < NLMSG_SPACE(0) || skb->len < nlh->nlmsg_len || 806 if (skb->len < NLMSG_SPACE(0) || skb->len < nlh->nlmsg_len ||
807 nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*frn))) { 807 nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*frn)))
808 kfree_skb(skb);
809 return; 808 return;
810 } 809
810 skb = skb_clone(skb, GFP_KERNEL);
811 if (skb == NULL)
812 return;
813 nlh = nlmsg_hdr(skb);
811 814
812 frn = (struct fib_result_nl *) NLMSG_DATA(nlh); 815 frn = (struct fib_result_nl *) NLMSG_DATA(nlh);
813 tb = fib_get_table(frn->tb_id_in); 816 tb = fib_get_table(frn->tb_id_in);