diff options
author | Patrick McHardy <kaber@trash.net> | 2007-02-01 02:16:40 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-02-08 15:38:41 -0500 |
commit | 26932566a42d46aee7e5d526cb34fba9380cad10 (patch) | |
tree | 3991d9209ddf2454ba4c71daccdc33951811dcf1 /net/ipv4/route.c | |
parent | 2cf6c36cb46d69057db2ebae0d8ec352e065f48b (diff) |
[NETLINK]: Don't BUG on undersized allocations
Currently netlink users BUG when the allocated skb for an event
notification is undersized. While this is certainly a kernel bug,
its not critical and crashing the kernel is too drastic, especially
when considering that these errors have appeared multiple times in
the past and it BUGs even if no listeners are present.
This patch replaces BUG by WARN_ON and changes the notification
functions to inform potential listeners of undersized allocations
using a unique error code (EMSGSIZE).
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r-- | net/ipv4/route.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 2daa0dc19d33..baee304a3cb7 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -2635,7 +2635,7 @@ static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
2635 | 2635 | ||
2636 | nlh = nlmsg_put(skb, pid, seq, event, sizeof(*r), flags); | 2636 | nlh = nlmsg_put(skb, pid, seq, event, sizeof(*r), flags); |
2637 | if (nlh == NULL) | 2637 | if (nlh == NULL) |
2638 | return -ENOBUFS; | 2638 | return -EMSGSIZE; |
2639 | 2639 | ||
2640 | r = nlmsg_data(nlh); | 2640 | r = nlmsg_data(nlh); |
2641 | r->rtm_family = AF_INET; | 2641 | r->rtm_family = AF_INET; |
@@ -2718,7 +2718,8 @@ static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event, | |||
2718 | return nlmsg_end(skb, nlh); | 2718 | return nlmsg_end(skb, nlh); |
2719 | 2719 | ||
2720 | nla_put_failure: | 2720 | nla_put_failure: |
2721 | return nlmsg_cancel(skb, nlh); | 2721 | nlmsg_cancel(skb, nlh); |
2722 | return -EMSGSIZE; | ||
2722 | } | 2723 | } |
2723 | 2724 | ||
2724 | int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg) | 2725 | int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg) |