diff options
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/dev.c | 2 | ||||
-rw-r--r-- | net/core/fib_rules.c | 14 | ||||
-rw-r--r-- | net/core/filter.c | 2 | ||||
-rw-r--r-- | net/core/net-sysfs.c | 12 | ||||
-rw-r--r-- | net/core/netpoll.c | 10 | ||||
-rw-r--r-- | net/core/rtnetlink.c | 26 | ||||
-rw-r--r-- | net/core/skbuff.c | 9 | ||||
-rw-r--r-- | net/core/sock.c | 12 |
8 files changed, 55 insertions, 32 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 877c84834d81..6bb6470f5b7b 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -4713,6 +4713,8 @@ void napi_disable(struct napi_struct *n) | |||
4713 | 4713 | ||
4714 | while (test_and_set_bit(NAPI_STATE_SCHED, &n->state)) | 4714 | while (test_and_set_bit(NAPI_STATE_SCHED, &n->state)) |
4715 | msleep(1); | 4715 | msleep(1); |
4716 | while (test_and_set_bit(NAPI_STATE_NPSVC, &n->state)) | ||
4717 | msleep(1); | ||
4716 | 4718 | ||
4717 | hrtimer_cancel(&n->timer); | 4719 | hrtimer_cancel(&n->timer); |
4718 | 4720 | ||
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index bf77e3639ce0..365de66436ac 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c | |||
@@ -631,15 +631,17 @@ static int dump_rules(struct sk_buff *skb, struct netlink_callback *cb, | |||
631 | { | 631 | { |
632 | int idx = 0; | 632 | int idx = 0; |
633 | struct fib_rule *rule; | 633 | struct fib_rule *rule; |
634 | int err = 0; | ||
634 | 635 | ||
635 | rcu_read_lock(); | 636 | rcu_read_lock(); |
636 | list_for_each_entry_rcu(rule, &ops->rules_list, list) { | 637 | list_for_each_entry_rcu(rule, &ops->rules_list, list) { |
637 | if (idx < cb->args[1]) | 638 | if (idx < cb->args[1]) |
638 | goto skip; | 639 | goto skip; |
639 | 640 | ||
640 | if (fib_nl_fill_rule(skb, rule, NETLINK_CB(cb->skb).portid, | 641 | err = fib_nl_fill_rule(skb, rule, NETLINK_CB(cb->skb).portid, |
641 | cb->nlh->nlmsg_seq, RTM_NEWRULE, | 642 | cb->nlh->nlmsg_seq, RTM_NEWRULE, |
642 | NLM_F_MULTI, ops) < 0) | 643 | NLM_F_MULTI, ops); |
644 | if (err) | ||
643 | break; | 645 | break; |
644 | skip: | 646 | skip: |
645 | idx++; | 647 | idx++; |
@@ -648,7 +650,7 @@ skip: | |||
648 | cb->args[1] = idx; | 650 | cb->args[1] = idx; |
649 | rules_ops_put(ops); | 651 | rules_ops_put(ops); |
650 | 652 | ||
651 | return skb->len; | 653 | return err; |
652 | } | 654 | } |
653 | 655 | ||
654 | static int fib_nl_dumprule(struct sk_buff *skb, struct netlink_callback *cb) | 656 | static int fib_nl_dumprule(struct sk_buff *skb, struct netlink_callback *cb) |
@@ -664,7 +666,9 @@ static int fib_nl_dumprule(struct sk_buff *skb, struct netlink_callback *cb) | |||
664 | if (ops == NULL) | 666 | if (ops == NULL) |
665 | return -EAFNOSUPPORT; | 667 | return -EAFNOSUPPORT; |
666 | 668 | ||
667 | return dump_rules(skb, cb, ops); | 669 | dump_rules(skb, cb, ops); |
670 | |||
671 | return skb->len; | ||
668 | } | 672 | } |
669 | 673 | ||
670 | rcu_read_lock(); | 674 | rcu_read_lock(); |
diff --git a/net/core/filter.c b/net/core/filter.c index 13079f03902e..05a04ea87172 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -478,9 +478,9 @@ do_pass: | |||
478 | bpf_src = BPF_X; | 478 | bpf_src = BPF_X; |
479 | } else { | 479 | } else { |
480 | insn->dst_reg = BPF_REG_A; | 480 | insn->dst_reg = BPF_REG_A; |
481 | insn->src_reg = BPF_REG_X; | ||
482 | insn->imm = fp->k; | 481 | insn->imm = fp->k; |
483 | bpf_src = BPF_SRC(fp->code); | 482 | bpf_src = BPF_SRC(fp->code); |
483 | insn->src_reg = bpf_src == BPF_X ? BPF_REG_X : 0; | ||
484 | } | 484 | } |
485 | 485 | ||
486 | /* Common case where 'jump_false' is next insn. */ | 486 | /* Common case where 'jump_false' is next insn. */ |
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index b279077c3089..830f8a7c1cb1 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c | |||
@@ -31,7 +31,6 @@ | |||
31 | static const char fmt_hex[] = "%#x\n"; | 31 | static const char fmt_hex[] = "%#x\n"; |
32 | static const char fmt_long_hex[] = "%#lx\n"; | 32 | static const char fmt_long_hex[] = "%#lx\n"; |
33 | static const char fmt_dec[] = "%d\n"; | 33 | static const char fmt_dec[] = "%d\n"; |
34 | static const char fmt_udec[] = "%u\n"; | ||
35 | static const char fmt_ulong[] = "%lu\n"; | 34 | static const char fmt_ulong[] = "%lu\n"; |
36 | static const char fmt_u64[] = "%llu\n"; | 35 | static const char fmt_u64[] = "%llu\n"; |
37 | 36 | ||
@@ -202,7 +201,7 @@ static ssize_t speed_show(struct device *dev, | |||
202 | if (netif_running(netdev)) { | 201 | if (netif_running(netdev)) { |
203 | struct ethtool_cmd cmd; | 202 | struct ethtool_cmd cmd; |
204 | if (!__ethtool_get_settings(netdev, &cmd)) | 203 | if (!__ethtool_get_settings(netdev, &cmd)) |
205 | ret = sprintf(buf, fmt_udec, ethtool_cmd_speed(&cmd)); | 204 | ret = sprintf(buf, fmt_dec, ethtool_cmd_speed(&cmd)); |
206 | } | 205 | } |
207 | rtnl_unlock(); | 206 | rtnl_unlock(); |
208 | return ret; | 207 | return ret; |
@@ -1481,6 +1480,15 @@ static int of_dev_node_match(struct device *dev, const void *data) | |||
1481 | return ret == 0 ? dev->of_node == data : ret; | 1480 | return ret == 0 ? dev->of_node == data : ret; |
1482 | } | 1481 | } |
1483 | 1482 | ||
1483 | /* | ||
1484 | * of_find_net_device_by_node - lookup the net device for the device node | ||
1485 | * @np: OF device node | ||
1486 | * | ||
1487 | * Looks up the net_device structure corresponding with the device node. | ||
1488 | * If successful, returns a pointer to the net_device with the embedded | ||
1489 | * struct device refcount incremented by one, or NULL on failure. The | ||
1490 | * refcount must be dropped when done with the net_device. | ||
1491 | */ | ||
1484 | struct net_device *of_find_net_device_by_node(struct device_node *np) | 1492 | struct net_device *of_find_net_device_by_node(struct device_node *np) |
1485 | { | 1493 | { |
1486 | struct device *dev; | 1494 | struct device *dev; |
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 6aa3db8dfc3b..8bdada242a7d 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -142,7 +142,7 @@ static void queue_process(struct work_struct *work) | |||
142 | */ | 142 | */ |
143 | static int poll_one_napi(struct napi_struct *napi, int budget) | 143 | static int poll_one_napi(struct napi_struct *napi, int budget) |
144 | { | 144 | { |
145 | int work; | 145 | int work = 0; |
146 | 146 | ||
147 | /* net_rx_action's ->poll() invocations and our's are | 147 | /* net_rx_action's ->poll() invocations and our's are |
148 | * synchronized by this test which is only made while | 148 | * synchronized by this test which is only made while |
@@ -151,7 +151,12 @@ static int poll_one_napi(struct napi_struct *napi, int budget) | |||
151 | if (!test_bit(NAPI_STATE_SCHED, &napi->state)) | 151 | if (!test_bit(NAPI_STATE_SCHED, &napi->state)) |
152 | return budget; | 152 | return budget; |
153 | 153 | ||
154 | set_bit(NAPI_STATE_NPSVC, &napi->state); | 154 | /* If we set this bit but see that it has already been set, |
155 | * that indicates that napi has been disabled and we need | ||
156 | * to abort this operation | ||
157 | */ | ||
158 | if (test_and_set_bit(NAPI_STATE_NPSVC, &napi->state)) | ||
159 | goto out; | ||
155 | 160 | ||
156 | work = napi->poll(napi, budget); | 161 | work = napi->poll(napi, budget); |
157 | WARN_ONCE(work > budget, "%pF exceeded budget in poll\n", napi->poll); | 162 | WARN_ONCE(work > budget, "%pF exceeded budget in poll\n", napi->poll); |
@@ -159,6 +164,7 @@ static int poll_one_napi(struct napi_struct *napi, int budget) | |||
159 | 164 | ||
160 | clear_bit(NAPI_STATE_NPSVC, &napi->state); | 165 | clear_bit(NAPI_STATE_NPSVC, &napi->state); |
161 | 166 | ||
167 | out: | ||
162 | return budget - work; | 168 | return budget - work; |
163 | } | 169 | } |
164 | 170 | ||
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index a466821d1441..0ec48403ed68 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -3047,6 +3047,7 @@ static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb) | |||
3047 | u32 portid = NETLINK_CB(cb->skb).portid; | 3047 | u32 portid = NETLINK_CB(cb->skb).portid; |
3048 | u32 seq = cb->nlh->nlmsg_seq; | 3048 | u32 seq = cb->nlh->nlmsg_seq; |
3049 | u32 filter_mask = 0; | 3049 | u32 filter_mask = 0; |
3050 | int err; | ||
3050 | 3051 | ||
3051 | if (nlmsg_len(cb->nlh) > sizeof(struct ifinfomsg)) { | 3052 | if (nlmsg_len(cb->nlh) > sizeof(struct ifinfomsg)) { |
3052 | struct nlattr *extfilt; | 3053 | struct nlattr *extfilt; |
@@ -3067,20 +3068,25 @@ static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb) | |||
3067 | struct net_device *br_dev = netdev_master_upper_dev_get(dev); | 3068 | struct net_device *br_dev = netdev_master_upper_dev_get(dev); |
3068 | 3069 | ||
3069 | if (br_dev && br_dev->netdev_ops->ndo_bridge_getlink) { | 3070 | if (br_dev && br_dev->netdev_ops->ndo_bridge_getlink) { |
3070 | if (idx >= cb->args[0] && | 3071 | if (idx >= cb->args[0]) { |
3071 | br_dev->netdev_ops->ndo_bridge_getlink( | 3072 | err = br_dev->netdev_ops->ndo_bridge_getlink( |
3072 | skb, portid, seq, dev, filter_mask, | 3073 | skb, portid, seq, dev, |
3073 | NLM_F_MULTI) < 0) | 3074 | filter_mask, NLM_F_MULTI); |
3074 | break; | 3075 | if (err < 0 && err != -EOPNOTSUPP) |
3076 | break; | ||
3077 | } | ||
3075 | idx++; | 3078 | idx++; |
3076 | } | 3079 | } |
3077 | 3080 | ||
3078 | if (ops->ndo_bridge_getlink) { | 3081 | if (ops->ndo_bridge_getlink) { |
3079 | if (idx >= cb->args[0] && | 3082 | if (idx >= cb->args[0]) { |
3080 | ops->ndo_bridge_getlink(skb, portid, seq, dev, | 3083 | err = ops->ndo_bridge_getlink(skb, portid, |
3081 | filter_mask, | 3084 | seq, dev, |
3082 | NLM_F_MULTI) < 0) | 3085 | filter_mask, |
3083 | break; | 3086 | NLM_F_MULTI); |
3087 | if (err < 0 && err != -EOPNOTSUPP) | ||
3088 | break; | ||
3089 | } | ||
3084 | idx++; | 3090 | idx++; |
3085 | } | 3091 | } |
3086 | } | 3092 | } |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index dad4dd37e2aa..fab4599ba8b2 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -2958,11 +2958,12 @@ EXPORT_SYMBOL_GPL(skb_append_pagefrags); | |||
2958 | */ | 2958 | */ |
2959 | unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len) | 2959 | unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len) |
2960 | { | 2960 | { |
2961 | unsigned char *data = skb->data; | ||
2962 | |||
2961 | BUG_ON(len > skb->len); | 2963 | BUG_ON(len > skb->len); |
2962 | skb->len -= len; | 2964 | __skb_pull(skb, len); |
2963 | BUG_ON(skb->len < skb->data_len); | 2965 | skb_postpull_rcsum(skb, data, len); |
2964 | skb_postpull_rcsum(skb, skb->data, len); | 2966 | return skb->data; |
2965 | return skb->data += len; | ||
2966 | } | 2967 | } |
2967 | EXPORT_SYMBOL_GPL(skb_pull_rcsum); | 2968 | EXPORT_SYMBOL_GPL(skb_pull_rcsum); |
2968 | 2969 | ||
diff --git a/net/core/sock.c b/net/core/sock.c index ca2984afe16e..3307c02244d3 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -2740,10 +2740,8 @@ static void req_prot_cleanup(struct request_sock_ops *rsk_prot) | |||
2740 | return; | 2740 | return; |
2741 | kfree(rsk_prot->slab_name); | 2741 | kfree(rsk_prot->slab_name); |
2742 | rsk_prot->slab_name = NULL; | 2742 | rsk_prot->slab_name = NULL; |
2743 | if (rsk_prot->slab) { | 2743 | kmem_cache_destroy(rsk_prot->slab); |
2744 | kmem_cache_destroy(rsk_prot->slab); | 2744 | rsk_prot->slab = NULL; |
2745 | rsk_prot->slab = NULL; | ||
2746 | } | ||
2747 | } | 2745 | } |
2748 | 2746 | ||
2749 | static int req_prot_init(const struct proto *prot) | 2747 | static int req_prot_init(const struct proto *prot) |
@@ -2828,10 +2826,8 @@ void proto_unregister(struct proto *prot) | |||
2828 | list_del(&prot->node); | 2826 | list_del(&prot->node); |
2829 | mutex_unlock(&proto_list_mutex); | 2827 | mutex_unlock(&proto_list_mutex); |
2830 | 2828 | ||
2831 | if (prot->slab != NULL) { | 2829 | kmem_cache_destroy(prot->slab); |
2832 | kmem_cache_destroy(prot->slab); | 2830 | prot->slab = NULL; |
2833 | prot->slab = NULL; | ||
2834 | } | ||
2835 | 2831 | ||
2836 | req_prot_cleanup(prot->rsk_prot); | 2832 | req_prot_cleanup(prot->rsk_prot); |
2837 | 2833 | ||