aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/neighbour.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/core/neighbour.c')
-rw-r--r--net/core/neighbour.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index e7300b6b4079..054d46493d2b 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -696,7 +696,10 @@ next_elt:
696 if (!expire) 696 if (!expire)
697 expire = 1; 697 expire = 1;
698 698
699 mod_timer(&tbl->gc_timer, now + expire); 699 if (expire>HZ)
700 mod_timer(&tbl->gc_timer, round_jiffies(now + expire));
701 else
702 mod_timer(&tbl->gc_timer, now + expire);
700 703
701 write_unlock(&tbl->lock); 704 write_unlock(&tbl->lock);
702} 705}
@@ -1637,7 +1640,7 @@ static int neightbl_fill_info(struct sk_buff *skb, struct neigh_table *tbl,
1637 1640
1638 nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ndtmsg), flags); 1641 nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ndtmsg), flags);
1639 if (nlh == NULL) 1642 if (nlh == NULL)
1640 return -ENOBUFS; 1643 return -EMSGSIZE;
1641 1644
1642 ndtmsg = nlmsg_data(nlh); 1645 ndtmsg = nlmsg_data(nlh);
1643 1646
@@ -1706,7 +1709,8 @@ static int neightbl_fill_info(struct sk_buff *skb, struct neigh_table *tbl,
1706 1709
1707nla_put_failure: 1710nla_put_failure:
1708 read_unlock_bh(&tbl->lock); 1711 read_unlock_bh(&tbl->lock);
1709 return nlmsg_cancel(skb, nlh); 1712 nlmsg_cancel(skb, nlh);
1713 return -EMSGSIZE;
1710} 1714}
1711 1715
1712static int neightbl_fill_param_info(struct sk_buff *skb, 1716static int neightbl_fill_param_info(struct sk_buff *skb,
@@ -1720,7 +1724,7 @@ static int neightbl_fill_param_info(struct sk_buff *skb,
1720 1724
1721 nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ndtmsg), flags); 1725 nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ndtmsg), flags);
1722 if (nlh == NULL) 1726 if (nlh == NULL)
1723 return -ENOBUFS; 1727 return -EMSGSIZE;
1724 1728
1725 ndtmsg = nlmsg_data(nlh); 1729 ndtmsg = nlmsg_data(nlh);
1726 1730
@@ -1737,7 +1741,8 @@ static int neightbl_fill_param_info(struct sk_buff *skb,
1737 return nlmsg_end(skb, nlh); 1741 return nlmsg_end(skb, nlh);
1738errout: 1742errout:
1739 read_unlock_bh(&tbl->lock); 1743 read_unlock_bh(&tbl->lock);
1740 return nlmsg_cancel(skb, nlh); 1744 nlmsg_cancel(skb, nlh);
1745 return -EMSGSIZE;
1741} 1746}
1742 1747
1743static inline struct neigh_parms *lookup_neigh_params(struct neigh_table *tbl, 1748static inline struct neigh_parms *lookup_neigh_params(struct neigh_table *tbl,
@@ -1955,7 +1960,7 @@ static int neigh_fill_info(struct sk_buff *skb, struct neighbour *neigh,
1955 1960
1956 nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ndm), flags); 1961 nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ndm), flags);
1957 if (nlh == NULL) 1962 if (nlh == NULL)
1958 return -ENOBUFS; 1963 return -EMSGSIZE;
1959 1964
1960 ndm = nlmsg_data(nlh); 1965 ndm = nlmsg_data(nlh);
1961 ndm->ndm_family = neigh->ops->family; 1966 ndm->ndm_family = neigh->ops->family;
@@ -1987,7 +1992,8 @@ static int neigh_fill_info(struct sk_buff *skb, struct neighbour *neigh,
1987 return nlmsg_end(skb, nlh); 1992 return nlmsg_end(skb, nlh);
1988 1993
1989nla_put_failure: 1994nla_put_failure:
1990 return nlmsg_cancel(skb, nlh); 1995 nlmsg_cancel(skb, nlh);
1996 return -EMSGSIZE;
1991} 1997}
1992 1998
1993 1999
@@ -2429,9 +2435,12 @@ static void __neigh_notify(struct neighbour *n, int type, int flags)
2429 goto errout; 2435 goto errout;
2430 2436
2431 err = neigh_fill_info(skb, n, 0, 0, type, flags); 2437 err = neigh_fill_info(skb, n, 0, 0, type, flags);
2432 /* failure implies BUG in neigh_nlmsg_size() */ 2438 if (err < 0) {
2433 BUG_ON(err < 0); 2439 /* -EMSGSIZE implies BUG in neigh_nlmsg_size() */
2434 2440 WARN_ON(err == -EMSGSIZE);
2441 kfree_skb(skb);
2442 goto errout;
2443 }
2435 err = rtnl_notify(skb, 0, RTNLGRP_NEIGH, NULL, GFP_ATOMIC); 2444 err = rtnl_notify(skb, 0, RTNLGRP_NEIGH, NULL, GFP_ATOMIC);
2436errout: 2445errout:
2437 if (err < 0) 2446 if (err < 0)