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 | 9 | ||||
-rw-r--r-- | net/core/netpoll.c | 10 | ||||
-rw-r--r-- | net/core/rtnetlink.c | 26 | ||||
-rw-r--r-- | net/core/sock.c | 12 |
7 files changed, 49 insertions, 26 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 464c22b6261a..323c04edd779 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -4723,6 +4723,8 @@ void napi_disable(struct napi_struct *n) | |||
4723 | 4723 | ||
4724 | while (test_and_set_bit(NAPI_STATE_SCHED, &n->state)) | 4724 | while (test_and_set_bit(NAPI_STATE_SCHED, &n->state)) |
4725 | msleep(1); | 4725 | msleep(1); |
4726 | while (test_and_set_bit(NAPI_STATE_NPSVC, &n->state)) | ||
4727 | msleep(1); | ||
4726 | 4728 | ||
4727 | hrtimer_cancel(&n->timer); | 4729 | hrtimer_cancel(&n->timer); |
4728 | 4730 | ||
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 96bd962c292d..60e3fe7c59c0 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 49b599062af1..b4c530065106 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c | |||
@@ -1478,6 +1478,15 @@ static int of_dev_node_match(struct device *dev, const void *data) | |||
1478 | return ret == 0 ? dev->of_node == data : ret; | 1478 | return ret == 0 ? dev->of_node == data : ret; |
1479 | } | 1479 | } |
1480 | 1480 | ||
1481 | /* | ||
1482 | * of_find_net_device_by_node - lookup the net device for the device node | ||
1483 | * @np: OF device node | ||
1484 | * | ||
1485 | * Looks up the net_device structure corresponding with the device node. | ||
1486 | * If successful, returns a pointer to the net_device with the embedded | ||
1487 | * struct device refcount incremented by one, or NULL on failure. The | ||
1488 | * refcount must be dropped when done with the net_device. | ||
1489 | */ | ||
1481 | struct net_device *of_find_net_device_by_node(struct device_node *np) | 1490 | struct net_device *of_find_net_device_by_node(struct device_node *np) |
1482 | { | 1491 | { |
1483 | struct device *dev; | 1492 | 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 e5452296ec2f..474a6da3b51a 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/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 | ||