Commit 450a5333 authored by Thomas Graf's avatar Thomas Graf Committed by Greg Kroah-Hartman

[PATCH] NETLINK: Fix processing of fib_lookup netlink messages

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: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 6ca4c553
...@@ -545,12 +545,16 @@ static void nl_fib_input(struct sock *sk, int len) ...@@ -545,12 +545,16 @@ static void nl_fib_input(struct sock *sk, int len)
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
struct nlmsghdr *nlh = NULL; struct nlmsghdr *nlh = NULL;
struct fib_result_nl *frn; struct fib_result_nl *frn;
int err;
u32 pid; u32 pid;
struct fib_table *tb; struct fib_table *tb;
skb = skb_recv_datagram(sk, 0, 0, &err); skb = skb_dequeue(&sk->sk_receive_queue);
nlh = (struct nlmsghdr *)skb->data; 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); frn = (struct fib_result_nl *) NLMSG_DATA(nlh);
tb = fib_get_table(frn->tb_id_in); tb = fib_get_table(frn->tb_id_in);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment