diff options
author | David S. Miller <davem@davemloft.net> | 2013-08-04 00:36:46 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-08-04 00:36:46 -0400 |
commit | 0e76a3a587fc7abda2badf249053b427baad255e (patch) | |
tree | 646a1da67dc25654552028225ca4b7a0a8043cc9 /net | |
parent | fba3679d34511c42bf452e89dda457a1219eb43a (diff) | |
parent | 72a67a94bcba71a5fddd6b3596a20604d2b5dcd6 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Merge net into net-next to setup some infrastructure Eric
Dumazet needs for usbnet changes.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
52 files changed, 424 insertions, 292 deletions
diff --git a/net/Kconfig b/net/Kconfig index 37162eb88f07..ee0213667272 100644 --- a/net/Kconfig +++ b/net/Kconfig | |||
@@ -244,7 +244,7 @@ config NETPRIO_CGROUP | |||
244 | Cgroup subsystem for use in assigning processes to network priorities on | 244 | Cgroup subsystem for use in assigning processes to network priorities on |
245 | a per-interface basis | 245 | a per-interface basis |
246 | 246 | ||
247 | config NET_LL_RX_POLL | 247 | config NET_RX_BUSY_POLL |
248 | boolean | 248 | boolean |
249 | default y | 249 | default y |
250 | 250 | ||
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index e3a349977595..cc27297da5a9 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -513,7 +513,10 @@ static void hci_init2_req(struct hci_request *req, unsigned long opt) | |||
513 | 513 | ||
514 | hci_setup_event_mask(req); | 514 | hci_setup_event_mask(req); |
515 | 515 | ||
516 | if (hdev->hci_ver > BLUETOOTH_VER_1_1) | 516 | /* AVM Berlin (31), aka "BlueFRITZ!", doesn't support the read |
517 | * local supported commands HCI command. | ||
518 | */ | ||
519 | if (hdev->manufacturer != 31 && hdev->hci_ver > BLUETOOTH_VER_1_1) | ||
517 | hci_req_add(req, HCI_OP_READ_LOCAL_COMMANDS, 0, NULL); | 520 | hci_req_add(req, HCI_OP_READ_LOCAL_COMMANDS, 0, NULL); |
518 | 521 | ||
519 | if (lmp_ssp_capable(hdev)) { | 522 | if (lmp_ssp_capable(hdev)) { |
@@ -2165,10 +2168,6 @@ int hci_register_dev(struct hci_dev *hdev) | |||
2165 | 2168 | ||
2166 | BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); | 2169 | BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); |
2167 | 2170 | ||
2168 | write_lock(&hci_dev_list_lock); | ||
2169 | list_add(&hdev->list, &hci_dev_list); | ||
2170 | write_unlock(&hci_dev_list_lock); | ||
2171 | |||
2172 | hdev->workqueue = alloc_workqueue("%s", WQ_HIGHPRI | WQ_UNBOUND | | 2171 | hdev->workqueue = alloc_workqueue("%s", WQ_HIGHPRI | WQ_UNBOUND | |
2173 | WQ_MEM_RECLAIM, 1, hdev->name); | 2172 | WQ_MEM_RECLAIM, 1, hdev->name); |
2174 | if (!hdev->workqueue) { | 2173 | if (!hdev->workqueue) { |
@@ -2203,6 +2202,10 @@ int hci_register_dev(struct hci_dev *hdev) | |||
2203 | if (hdev->dev_type != HCI_AMP) | 2202 | if (hdev->dev_type != HCI_AMP) |
2204 | set_bit(HCI_AUTO_OFF, &hdev->dev_flags); | 2203 | set_bit(HCI_AUTO_OFF, &hdev->dev_flags); |
2205 | 2204 | ||
2205 | write_lock(&hci_dev_list_lock); | ||
2206 | list_add(&hdev->list, &hci_dev_list); | ||
2207 | write_unlock(&hci_dev_list_lock); | ||
2208 | |||
2206 | hci_notify(hdev, HCI_DEV_REG); | 2209 | hci_notify(hdev, HCI_DEV_REG); |
2207 | hci_dev_hold(hdev); | 2210 | hci_dev_hold(hdev); |
2208 | 2211 | ||
@@ -2215,9 +2218,6 @@ err_wqueue: | |||
2215 | destroy_workqueue(hdev->req_workqueue); | 2218 | destroy_workqueue(hdev->req_workqueue); |
2216 | err: | 2219 | err: |
2217 | ida_simple_remove(&hci_index_ida, hdev->id); | 2220 | ida_simple_remove(&hci_index_ida, hdev->id); |
2218 | write_lock(&hci_dev_list_lock); | ||
2219 | list_del(&hdev->list); | ||
2220 | write_unlock(&hci_dev_list_lock); | ||
2221 | 2221 | ||
2222 | return error; | 2222 | return error; |
2223 | } | 2223 | } |
@@ -3399,8 +3399,16 @@ void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status) | |||
3399 | */ | 3399 | */ |
3400 | if (hdev->sent_cmd) { | 3400 | if (hdev->sent_cmd) { |
3401 | req_complete = bt_cb(hdev->sent_cmd)->req.complete; | 3401 | req_complete = bt_cb(hdev->sent_cmd)->req.complete; |
3402 | if (req_complete) | 3402 | |
3403 | if (req_complete) { | ||
3404 | /* We must set the complete callback to NULL to | ||
3405 | * avoid calling the callback more than once if | ||
3406 | * this function gets called again. | ||
3407 | */ | ||
3408 | bt_cb(hdev->sent_cmd)->req.complete = NULL; | ||
3409 | |||
3403 | goto call_complete; | 3410 | goto call_complete; |
3411 | } | ||
3404 | } | 3412 | } |
3405 | 3413 | ||
3406 | /* Remove all pending commands belonging to this request */ | 3414 | /* Remove all pending commands belonging to this request */ |
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index 50d86b3e3941..0feaaa0d37d1 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c | |||
@@ -70,7 +70,8 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev) | |||
70 | } | 70 | } |
71 | 71 | ||
72 | mdst = br_mdb_get(br, skb, vid); | 72 | mdst = br_mdb_get(br, skb, vid); |
73 | if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) | 73 | if ((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) && |
74 | br_multicast_querier_exists(br)) | ||
74 | br_multicast_deliver(mdst, skb); | 75 | br_multicast_deliver(mdst, skb); |
75 | else | 76 | else |
76 | br_flood_deliver(br, skb, false); | 77 | br_flood_deliver(br, skb, false); |
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c index 1b8b8b824cd7..8c561c0aa636 100644 --- a/net/bridge/br_input.c +++ b/net/bridge/br_input.c | |||
@@ -101,7 +101,8 @@ int br_handle_frame_finish(struct sk_buff *skb) | |||
101 | unicast = false; | 101 | unicast = false; |
102 | } else if (is_multicast_ether_addr(dest)) { | 102 | } else if (is_multicast_ether_addr(dest)) { |
103 | mdst = br_mdb_get(br, skb, vid); | 103 | mdst = br_mdb_get(br, skb, vid); |
104 | if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) { | 104 | if ((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) && |
105 | br_multicast_querier_exists(br)) { | ||
105 | if ((mdst && mdst->mglist) || | 106 | if ((mdst && mdst->mglist) || |
106 | br_multicast_is_router(br)) | 107 | br_multicast_is_router(br)) |
107 | skb2 = skb; | 108 | skb2 = skb; |
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 69af490cce44..61c5e819380e 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -619,6 +619,9 @@ rehash: | |||
619 | mp->br = br; | 619 | mp->br = br; |
620 | mp->addr = *group; | 620 | mp->addr = *group; |
621 | 621 | ||
622 | setup_timer(&mp->timer, br_multicast_group_expired, | ||
623 | (unsigned long)mp); | ||
624 | |||
622 | hlist_add_head_rcu(&mp->hlist[mdb->ver], &mdb->mhash[hash]); | 625 | hlist_add_head_rcu(&mp->hlist[mdb->ver], &mdb->mhash[hash]); |
623 | mdb->size++; | 626 | mdb->size++; |
624 | 627 | ||
@@ -1011,6 +1014,16 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br, | |||
1011 | } | 1014 | } |
1012 | #endif | 1015 | #endif |
1013 | 1016 | ||
1017 | static void br_multicast_update_querier_timer(struct net_bridge *br, | ||
1018 | unsigned long max_delay) | ||
1019 | { | ||
1020 | if (!timer_pending(&br->multicast_querier_timer)) | ||
1021 | br->multicast_querier_delay_time = jiffies + max_delay; | ||
1022 | |||
1023 | mod_timer(&br->multicast_querier_timer, | ||
1024 | jiffies + br->multicast_querier_interval); | ||
1025 | } | ||
1026 | |||
1014 | /* | 1027 | /* |
1015 | * Add port to router_list | 1028 | * Add port to router_list |
1016 | * list is maintained ordered by pointer value | 1029 | * list is maintained ordered by pointer value |
@@ -1061,11 +1074,11 @@ timer: | |||
1061 | 1074 | ||
1062 | static void br_multicast_query_received(struct net_bridge *br, | 1075 | static void br_multicast_query_received(struct net_bridge *br, |
1063 | struct net_bridge_port *port, | 1076 | struct net_bridge_port *port, |
1064 | int saddr) | 1077 | int saddr, |
1078 | unsigned long max_delay) | ||
1065 | { | 1079 | { |
1066 | if (saddr) | 1080 | if (saddr) |
1067 | mod_timer(&br->multicast_querier_timer, | 1081 | br_multicast_update_querier_timer(br, max_delay); |
1068 | jiffies + br->multicast_querier_interval); | ||
1069 | else if (timer_pending(&br->multicast_querier_timer)) | 1082 | else if (timer_pending(&br->multicast_querier_timer)) |
1070 | return; | 1083 | return; |
1071 | 1084 | ||
@@ -1093,8 +1106,6 @@ static int br_ip4_multicast_query(struct net_bridge *br, | |||
1093 | (port && port->state == BR_STATE_DISABLED)) | 1106 | (port && port->state == BR_STATE_DISABLED)) |
1094 | goto out; | 1107 | goto out; |
1095 | 1108 | ||
1096 | br_multicast_query_received(br, port, !!iph->saddr); | ||
1097 | |||
1098 | group = ih->group; | 1109 | group = ih->group; |
1099 | 1110 | ||
1100 | if (skb->len == sizeof(*ih)) { | 1111 | if (skb->len == sizeof(*ih)) { |
@@ -1118,6 +1129,8 @@ static int br_ip4_multicast_query(struct net_bridge *br, | |||
1118 | IGMPV3_MRC(ih3->code) * (HZ / IGMP_TIMER_SCALE) : 1; | 1129 | IGMPV3_MRC(ih3->code) * (HZ / IGMP_TIMER_SCALE) : 1; |
1119 | } | 1130 | } |
1120 | 1131 | ||
1132 | br_multicast_query_received(br, port, !!iph->saddr, max_delay); | ||
1133 | |||
1121 | if (!group) | 1134 | if (!group) |
1122 | goto out; | 1135 | goto out; |
1123 | 1136 | ||
@@ -1126,7 +1139,6 @@ static int br_ip4_multicast_query(struct net_bridge *br, | |||
1126 | if (!mp) | 1139 | if (!mp) |
1127 | goto out; | 1140 | goto out; |
1128 | 1141 | ||
1129 | setup_timer(&mp->timer, br_multicast_group_expired, (unsigned long)mp); | ||
1130 | mod_timer(&mp->timer, now + br->multicast_membership_interval); | 1142 | mod_timer(&mp->timer, now + br->multicast_membership_interval); |
1131 | mp->timer_armed = true; | 1143 | mp->timer_armed = true; |
1132 | 1144 | ||
@@ -1174,8 +1186,6 @@ static int br_ip6_multicast_query(struct net_bridge *br, | |||
1174 | (port && port->state == BR_STATE_DISABLED)) | 1186 | (port && port->state == BR_STATE_DISABLED)) |
1175 | goto out; | 1187 | goto out; |
1176 | 1188 | ||
1177 | br_multicast_query_received(br, port, !ipv6_addr_any(&ip6h->saddr)); | ||
1178 | |||
1179 | if (skb->len == sizeof(*mld)) { | 1189 | if (skb->len == sizeof(*mld)) { |
1180 | if (!pskb_may_pull(skb, sizeof(*mld))) { | 1190 | if (!pskb_may_pull(skb, sizeof(*mld))) { |
1181 | err = -EINVAL; | 1191 | err = -EINVAL; |
@@ -1196,6 +1206,9 @@ static int br_ip6_multicast_query(struct net_bridge *br, | |||
1196 | max_delay = mld2q->mld2q_mrc ? MLDV2_MRC(ntohs(mld2q->mld2q_mrc)) : 1; | 1206 | max_delay = mld2q->mld2q_mrc ? MLDV2_MRC(ntohs(mld2q->mld2q_mrc)) : 1; |
1197 | } | 1207 | } |
1198 | 1208 | ||
1209 | br_multicast_query_received(br, port, !ipv6_addr_any(&ip6h->saddr), | ||
1210 | max_delay); | ||
1211 | |||
1199 | if (!group) | 1212 | if (!group) |
1200 | goto out; | 1213 | goto out; |
1201 | 1214 | ||
@@ -1204,7 +1217,6 @@ static int br_ip6_multicast_query(struct net_bridge *br, | |||
1204 | if (!mp) | 1217 | if (!mp) |
1205 | goto out; | 1218 | goto out; |
1206 | 1219 | ||
1207 | setup_timer(&mp->timer, br_multicast_group_expired, (unsigned long)mp); | ||
1208 | mod_timer(&mp->timer, now + br->multicast_membership_interval); | 1220 | mod_timer(&mp->timer, now + br->multicast_membership_interval); |
1209 | mp->timer_armed = true; | 1221 | mp->timer_armed = true; |
1210 | 1222 | ||
@@ -1642,6 +1654,8 @@ void br_multicast_init(struct net_bridge *br) | |||
1642 | br->multicast_querier_interval = 255 * HZ; | 1654 | br->multicast_querier_interval = 255 * HZ; |
1643 | br->multicast_membership_interval = 260 * HZ; | 1655 | br->multicast_membership_interval = 260 * HZ; |
1644 | 1656 | ||
1657 | br->multicast_querier_delay_time = 0; | ||
1658 | |||
1645 | spin_lock_init(&br->multicast_lock); | 1659 | spin_lock_init(&br->multicast_lock); |
1646 | setup_timer(&br->multicast_router_timer, | 1660 | setup_timer(&br->multicast_router_timer, |
1647 | br_multicast_local_router_expired, 0); | 1661 | br_multicast_local_router_expired, 0); |
@@ -1830,6 +1844,8 @@ unlock: | |||
1830 | 1844 | ||
1831 | int br_multicast_set_querier(struct net_bridge *br, unsigned long val) | 1845 | int br_multicast_set_querier(struct net_bridge *br, unsigned long val) |
1832 | { | 1846 | { |
1847 | unsigned long max_delay; | ||
1848 | |||
1833 | val = !!val; | 1849 | val = !!val; |
1834 | 1850 | ||
1835 | spin_lock_bh(&br->multicast_lock); | 1851 | spin_lock_bh(&br->multicast_lock); |
@@ -1837,8 +1853,14 @@ int br_multicast_set_querier(struct net_bridge *br, unsigned long val) | |||
1837 | goto unlock; | 1853 | goto unlock; |
1838 | 1854 | ||
1839 | br->multicast_querier = val; | 1855 | br->multicast_querier = val; |
1840 | if (val) | 1856 | if (!val) |
1841 | br_multicast_start_querier(br); | 1857 | goto unlock; |
1858 | |||
1859 | max_delay = br->multicast_query_response_interval; | ||
1860 | if (!timer_pending(&br->multicast_querier_timer)) | ||
1861 | br->multicast_querier_delay_time = jiffies + max_delay; | ||
1862 | |||
1863 | br_multicast_start_querier(br); | ||
1842 | 1864 | ||
1843 | unlock: | 1865 | unlock: |
1844 | spin_unlock_bh(&br->multicast_lock); | 1866 | spin_unlock_bh(&br->multicast_lock); |
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 43347f129943..1514c9f4f102 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h | |||
@@ -267,6 +267,7 @@ struct net_bridge | |||
267 | unsigned long multicast_query_interval; | 267 | unsigned long multicast_query_interval; |
268 | unsigned long multicast_query_response_interval; | 268 | unsigned long multicast_query_response_interval; |
269 | unsigned long multicast_startup_query_interval; | 269 | unsigned long multicast_startup_query_interval; |
270 | unsigned long multicast_querier_delay_time; | ||
270 | 271 | ||
271 | spinlock_t multicast_lock; | 272 | spinlock_t multicast_lock; |
272 | struct net_bridge_mdb_htable __rcu *mdb; | 273 | struct net_bridge_mdb_htable __rcu *mdb; |
@@ -491,6 +492,13 @@ static inline bool br_multicast_is_router(struct net_bridge *br) | |||
491 | (br->multicast_router == 1 && | 492 | (br->multicast_router == 1 && |
492 | timer_pending(&br->multicast_router_timer)); | 493 | timer_pending(&br->multicast_router_timer)); |
493 | } | 494 | } |
495 | |||
496 | static inline bool br_multicast_querier_exists(struct net_bridge *br) | ||
497 | { | ||
498 | return time_is_before_jiffies(br->multicast_querier_delay_time) && | ||
499 | (br->multicast_querier || | ||
500 | timer_pending(&br->multicast_querier_timer)); | ||
501 | } | ||
494 | #else | 502 | #else |
495 | static inline int br_multicast_rcv(struct net_bridge *br, | 503 | static inline int br_multicast_rcv(struct net_bridge *br, |
496 | struct net_bridge_port *port, | 504 | struct net_bridge_port *port, |
@@ -547,6 +555,10 @@ static inline bool br_multicast_is_router(struct net_bridge *br) | |||
547 | { | 555 | { |
548 | return 0; | 556 | return 0; |
549 | } | 557 | } |
558 | static inline bool br_multicast_querier_exists(struct net_bridge *br) | ||
559 | { | ||
560 | return false; | ||
561 | } | ||
550 | static inline void br_mdb_init(void) | 562 | static inline void br_mdb_init(void) |
551 | { | 563 | { |
552 | } | 564 | } |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 576d46f4a69e..60533db8b72d 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -2769,6 +2769,7 @@ EXPORT_SYMBOL(neigh_app_ns); | |||
2769 | 2769 | ||
2770 | #ifdef CONFIG_SYSCTL | 2770 | #ifdef CONFIG_SYSCTL |
2771 | static int zero; | 2771 | static int zero; |
2772 | static int int_max = INT_MAX; | ||
2772 | static int unres_qlen_max = INT_MAX / SKB_TRUESIZE(ETH_FRAME_LEN); | 2773 | static int unres_qlen_max = INT_MAX / SKB_TRUESIZE(ETH_FRAME_LEN); |
2773 | 2774 | ||
2774 | static int proc_unres_qlen(struct ctl_table *ctl, int write, | 2775 | static int proc_unres_qlen(struct ctl_table *ctl, int write, |
@@ -2821,19 +2822,25 @@ static struct neigh_sysctl_table { | |||
2821 | .procname = "mcast_solicit", | 2822 | .procname = "mcast_solicit", |
2822 | .maxlen = sizeof(int), | 2823 | .maxlen = sizeof(int), |
2823 | .mode = 0644, | 2824 | .mode = 0644, |
2824 | .proc_handler = proc_dointvec, | 2825 | .extra1 = &zero, |
2826 | .extra2 = &int_max, | ||
2827 | .proc_handler = proc_dointvec_minmax, | ||
2825 | }, | 2828 | }, |
2826 | [NEIGH_VAR_UCAST_PROBE] = { | 2829 | [NEIGH_VAR_UCAST_PROBE] = { |
2827 | .procname = "ucast_solicit", | 2830 | .procname = "ucast_solicit", |
2828 | .maxlen = sizeof(int), | 2831 | .maxlen = sizeof(int), |
2829 | .mode = 0644, | 2832 | .mode = 0644, |
2830 | .proc_handler = proc_dointvec, | 2833 | .extra1 = &zero, |
2834 | .extra2 = &int_max, | ||
2835 | .proc_handler = proc_dointvec_minmax, | ||
2831 | }, | 2836 | }, |
2832 | [NEIGH_VAR_APP_PROBE] = { | 2837 | [NEIGH_VAR_APP_PROBE] = { |
2833 | .procname = "app_solicit", | 2838 | .procname = "app_solicit", |
2834 | .maxlen = sizeof(int), | 2839 | .maxlen = sizeof(int), |
2835 | .mode = 0644, | 2840 | .mode = 0644, |
2836 | .proc_handler = proc_dointvec, | 2841 | .extra1 = &zero, |
2842 | .extra2 = &int_max, | ||
2843 | .proc_handler = proc_dointvec_minmax, | ||
2837 | }, | 2844 | }, |
2838 | [NEIGH_VAR_RETRANS_TIME] = { | 2845 | [NEIGH_VAR_RETRANS_TIME] = { |
2839 | .procname = "retrans_time", | 2846 | .procname = "retrans_time", |
@@ -2876,7 +2883,9 @@ static struct neigh_sysctl_table { | |||
2876 | .procname = "proxy_qlen", | 2883 | .procname = "proxy_qlen", |
2877 | .maxlen = sizeof(int), | 2884 | .maxlen = sizeof(int), |
2878 | .mode = 0644, | 2885 | .mode = 0644, |
2879 | .proc_handler = proc_dointvec, | 2886 | .extra1 = &zero, |
2887 | .extra2 = &int_max, | ||
2888 | .proc_handler = proc_dointvec_minmax, | ||
2880 | }, | 2889 | }, |
2881 | [NEIGH_VAR_ANYCAST_DELAY] = { | 2890 | [NEIGH_VAR_ANYCAST_DELAY] = { |
2882 | .procname = "anycast_delay", | 2891 | .procname = "anycast_delay", |
@@ -2918,19 +2927,25 @@ static struct neigh_sysctl_table { | |||
2918 | .procname = "gc_thresh1", | 2927 | .procname = "gc_thresh1", |
2919 | .maxlen = sizeof(int), | 2928 | .maxlen = sizeof(int), |
2920 | .mode = 0644, | 2929 | .mode = 0644, |
2921 | .proc_handler = proc_dointvec, | 2930 | .extra1 = &zero, |
2931 | .extra2 = &int_max, | ||
2932 | .proc_handler = proc_dointvec_minmax, | ||
2922 | }, | 2933 | }, |
2923 | [NEIGH_VAR_GC_THRESH2] = { | 2934 | [NEIGH_VAR_GC_THRESH2] = { |
2924 | .procname = "gc_thresh2", | 2935 | .procname = "gc_thresh2", |
2925 | .maxlen = sizeof(int), | 2936 | .maxlen = sizeof(int), |
2926 | .mode = 0644, | 2937 | .mode = 0644, |
2927 | .proc_handler = proc_dointvec, | 2938 | .extra1 = &zero, |
2939 | .extra2 = &int_max, | ||
2940 | .proc_handler = proc_dointvec_minmax, | ||
2928 | }, | 2941 | }, |
2929 | [NEIGH_VAR_GC_THRESH3] = { | 2942 | [NEIGH_VAR_GC_THRESH3] = { |
2930 | .procname = "gc_thresh3", | 2943 | .procname = "gc_thresh3", |
2931 | .maxlen = sizeof(int), | 2944 | .maxlen = sizeof(int), |
2932 | .mode = 0644, | 2945 | .mode = 0644, |
2933 | .proc_handler = proc_dointvec, | 2946 | .extra1 = &zero, |
2947 | .extra2 = &int_max, | ||
2948 | .proc_handler = proc_dointvec_minmax, | ||
2934 | }, | 2949 | }, |
2935 | {}, | 2950 | {}, |
2936 | }, | 2951 | }, |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 20e02d2605ec..2c3d0f53d198 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -309,7 +309,8 @@ EXPORT_SYMBOL(__alloc_skb); | |||
309 | * @frag_size: size of fragment, or 0 if head was kmalloced | 309 | * @frag_size: size of fragment, or 0 if head was kmalloced |
310 | * | 310 | * |
311 | * Allocate a new &sk_buff. Caller provides space holding head and | 311 | * Allocate a new &sk_buff. Caller provides space holding head and |
312 | * skb_shared_info. @data must have been allocated by kmalloc() | 312 | * skb_shared_info. @data must have been allocated by kmalloc() only if |
313 | * @frag_size is 0, otherwise data should come from the page allocator. | ||
313 | * The return is the new skb buffer. | 314 | * The return is the new skb buffer. |
314 | * On a failure the return is %NULL, and @data is not freed. | 315 | * On a failure the return is %NULL, and @data is not freed. |
315 | * Notes : | 316 | * Notes : |
@@ -739,7 +740,7 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old) | |||
739 | 740 | ||
740 | skb_copy_secmark(new, old); | 741 | skb_copy_secmark(new, old); |
741 | 742 | ||
742 | #ifdef CONFIG_NET_LL_RX_POLL | 743 | #ifdef CONFIG_NET_RX_BUSY_POLL |
743 | new->napi_id = old->napi_id; | 744 | new->napi_id = old->napi_id; |
744 | #endif | 745 | #endif |
745 | } | 746 | } |
diff --git a/net/core/sock.c b/net/core/sock.c index a753d97434dc..83667de45ec9 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -901,7 +901,7 @@ set_rcvbuf: | |||
901 | sock_valbool_flag(sk, SOCK_SELECT_ERR_QUEUE, valbool); | 901 | sock_valbool_flag(sk, SOCK_SELECT_ERR_QUEUE, valbool); |
902 | break; | 902 | break; |
903 | 903 | ||
904 | #ifdef CONFIG_NET_LL_RX_POLL | 904 | #ifdef CONFIG_NET_RX_BUSY_POLL |
905 | case SO_BUSY_POLL: | 905 | case SO_BUSY_POLL: |
906 | /* allow unprivileged users to decrease the value */ | 906 | /* allow unprivileged users to decrease the value */ |
907 | if ((val > sk->sk_ll_usec) && !capable(CAP_NET_ADMIN)) | 907 | if ((val > sk->sk_ll_usec) && !capable(CAP_NET_ADMIN)) |
@@ -1171,7 +1171,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, | |||
1171 | v.val = sock_flag(sk, SOCK_SELECT_ERR_QUEUE); | 1171 | v.val = sock_flag(sk, SOCK_SELECT_ERR_QUEUE); |
1172 | break; | 1172 | break; |
1173 | 1173 | ||
1174 | #ifdef CONFIG_NET_LL_RX_POLL | 1174 | #ifdef CONFIG_NET_RX_BUSY_POLL |
1175 | case SO_BUSY_POLL: | 1175 | case SO_BUSY_POLL: |
1176 | v.val = sk->sk_ll_usec; | 1176 | v.val = sk->sk_ll_usec; |
1177 | break; | 1177 | break; |
@@ -2312,7 +2312,7 @@ void sock_init_data(struct socket *sock, struct sock *sk) | |||
2312 | 2312 | ||
2313 | sk->sk_stamp = ktime_set(-1L, 0); | 2313 | sk->sk_stamp = ktime_set(-1L, 0); |
2314 | 2314 | ||
2315 | #ifdef CONFIG_NET_LL_RX_POLL | 2315 | #ifdef CONFIG_NET_RX_BUSY_POLL |
2316 | sk->sk_napi_id = 0; | 2316 | sk->sk_napi_id = 0; |
2317 | sk->sk_ll_usec = sysctl_net_busy_read; | 2317 | sk->sk_ll_usec = sysctl_net_busy_read; |
2318 | #endif | 2318 | #endif |
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c index 660968616637..31107abd2783 100644 --- a/net/core/sysctl_net_core.c +++ b/net/core/sysctl_net_core.c | |||
@@ -21,7 +21,9 @@ | |||
21 | #include <net/net_ratelimit.h> | 21 | #include <net/net_ratelimit.h> |
22 | #include <net/busy_poll.h> | 22 | #include <net/busy_poll.h> |
23 | 23 | ||
24 | static int zero = 0; | ||
24 | static int one = 1; | 25 | static int one = 1; |
26 | static int ushort_max = USHRT_MAX; | ||
25 | 27 | ||
26 | #ifdef CONFIG_RPS | 28 | #ifdef CONFIG_RPS |
27 | static int rps_sock_flow_sysctl(struct ctl_table *table, int write, | 29 | static int rps_sock_flow_sysctl(struct ctl_table *table, int write, |
@@ -298,7 +300,7 @@ static struct ctl_table net_core_table[] = { | |||
298 | .proc_handler = flow_limit_table_len_sysctl | 300 | .proc_handler = flow_limit_table_len_sysctl |
299 | }, | 301 | }, |
300 | #endif /* CONFIG_NET_FLOW_LIMIT */ | 302 | #endif /* CONFIG_NET_FLOW_LIMIT */ |
301 | #ifdef CONFIG_NET_LL_RX_POLL | 303 | #ifdef CONFIG_NET_RX_BUSY_POLL |
302 | { | 304 | { |
303 | .procname = "busy_poll", | 305 | .procname = "busy_poll", |
304 | .data = &sysctl_net_busy_poll, | 306 | .data = &sysctl_net_busy_poll, |
@@ -339,7 +341,9 @@ static struct ctl_table netns_core_table[] = { | |||
339 | .data = &init_net.core.sysctl_somaxconn, | 341 | .data = &init_net.core.sysctl_somaxconn, |
340 | .maxlen = sizeof(int), | 342 | .maxlen = sizeof(int), |
341 | .mode = 0644, | 343 | .mode = 0644, |
342 | .proc_handler = proc_dointvec | 344 | .extra1 = &zero, |
345 | .extra2 = &ushort_max, | ||
346 | .proc_handler = proc_dointvec_minmax | ||
343 | }, | 347 | }, |
344 | { } | 348 | { } |
345 | }; | 349 | }; |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 1b7f7ae8514a..43923dc77440 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -772,7 +772,7 @@ static struct in_ifaddr *rtm_to_ifaddr(struct net *net, struct nlmsghdr *nlh, | |||
772 | ci = nla_data(tb[IFA_CACHEINFO]); | 772 | ci = nla_data(tb[IFA_CACHEINFO]); |
773 | if (!ci->ifa_valid || ci->ifa_prefered > ci->ifa_valid) { | 773 | if (!ci->ifa_valid || ci->ifa_prefered > ci->ifa_valid) { |
774 | err = -EINVAL; | 774 | err = -EINVAL; |
775 | goto errout; | 775 | goto errout_free; |
776 | } | 776 | } |
777 | *pvalid_lft = ci->ifa_valid; | 777 | *pvalid_lft = ci->ifa_valid; |
778 | *pprefered_lft = ci->ifa_prefered; | 778 | *pprefered_lft = ci->ifa_prefered; |
@@ -780,6 +780,8 @@ static struct in_ifaddr *rtm_to_ifaddr(struct net *net, struct nlmsghdr *nlh, | |||
780 | 780 | ||
781 | return ifa; | 781 | return ifa; |
782 | 782 | ||
783 | errout_free: | ||
784 | inet_free_ifa(ifa); | ||
783 | errout: | 785 | errout: |
784 | return ERR_PTR(err); | 786 | return ERR_PTR(err); |
785 | } | 787 | } |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 49616fed9340..108a1e9c9eac 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -2133,7 +2133,7 @@ static void trie_show_stats(struct seq_file *seq, struct trie_stat *stat) | |||
2133 | max--; | 2133 | max--; |
2134 | 2134 | ||
2135 | pointers = 0; | 2135 | pointers = 0; |
2136 | for (i = 1; i <= max; i++) | 2136 | for (i = 1; i < max; i++) |
2137 | if (stat->nodesizes[i] != 0) { | 2137 | if (stat->nodesizes[i] != 0) { |
2138 | seq_printf(seq, " %u: %u", i, stat->nodesizes[i]); | 2138 | seq_printf(seq, " %u: %u", i, stat->nodesizes[i]); |
2139 | pointers += (1<<i) * stat->nodesizes[i]; | 2139 | pointers += (1<<i) * stat->nodesizes[i]; |
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 69ed203802da..8ed7c32ae28e 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c | |||
@@ -36,6 +36,8 @@ static int tcp_adv_win_scale_min = -31; | |||
36 | static int tcp_adv_win_scale_max = 31; | 36 | static int tcp_adv_win_scale_max = 31; |
37 | static int ip_ttl_min = 1; | 37 | static int ip_ttl_min = 1; |
38 | static int ip_ttl_max = 255; | 38 | static int ip_ttl_max = 255; |
39 | static int tcp_syn_retries_min = 1; | ||
40 | static int tcp_syn_retries_max = MAX_TCP_SYNCNT; | ||
39 | static int ip_ping_group_range_min[] = { 0, 0 }; | 41 | static int ip_ping_group_range_min[] = { 0, 0 }; |
40 | static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX }; | 42 | static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX }; |
41 | 43 | ||
@@ -332,7 +334,9 @@ static struct ctl_table ipv4_table[] = { | |||
332 | .data = &sysctl_tcp_syn_retries, | 334 | .data = &sysctl_tcp_syn_retries, |
333 | .maxlen = sizeof(int), | 335 | .maxlen = sizeof(int), |
334 | .mode = 0644, | 336 | .mode = 0644, |
335 | .proc_handler = proc_dointvec | 337 | .proc_handler = proc_dointvec_minmax, |
338 | .extra1 = &tcp_syn_retries_min, | ||
339 | .extra2 = &tcp_syn_retries_max | ||
336 | }, | 340 | }, |
337 | { | 341 | { |
338 | .procname = "tcp_synack_retries", | 342 | .procname = "tcp_synack_retries", |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index e7780d72067c..7fd8572bac80 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -813,8 +813,9 @@ static u32 inet6_addr_hash(const struct in6_addr *addr) | |||
813 | /* On success it returns ifp with increased reference count */ | 813 | /* On success it returns ifp with increased reference count */ |
814 | 814 | ||
815 | static struct inet6_ifaddr * | 815 | static struct inet6_ifaddr * |
816 | ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen, | 816 | ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, |
817 | int scope, u32 flags) | 817 | const struct in6_addr *peer_addr, int pfxlen, |
818 | int scope, u32 flags, u32 valid_lft, u32 prefered_lft) | ||
818 | { | 819 | { |
819 | struct inet6_ifaddr *ifa = NULL; | 820 | struct inet6_ifaddr *ifa = NULL; |
820 | struct rt6_info *rt; | 821 | struct rt6_info *rt; |
@@ -863,6 +864,8 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen, | |||
863 | } | 864 | } |
864 | 865 | ||
865 | ifa->addr = *addr; | 866 | ifa->addr = *addr; |
867 | if (peer_addr) | ||
868 | ifa->peer_addr = *peer_addr; | ||
866 | 869 | ||
867 | spin_lock_init(&ifa->lock); | 870 | spin_lock_init(&ifa->lock); |
868 | spin_lock_init(&ifa->state_lock); | 871 | spin_lock_init(&ifa->state_lock); |
@@ -872,6 +875,8 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen, | |||
872 | ifa->scope = scope; | 875 | ifa->scope = scope; |
873 | ifa->prefix_len = pfxlen; | 876 | ifa->prefix_len = pfxlen; |
874 | ifa->flags = flags | IFA_F_TENTATIVE; | 877 | ifa->flags = flags | IFA_F_TENTATIVE; |
878 | ifa->valid_lft = valid_lft; | ||
879 | ifa->prefered_lft = prefered_lft; | ||
875 | ifa->cstamp = ifa->tstamp = jiffies; | 880 | ifa->cstamp = ifa->tstamp = jiffies; |
876 | ifa->tokenized = false; | 881 | ifa->tokenized = false; |
877 | 882 | ||
@@ -1123,8 +1128,9 @@ retry: | |||
1123 | 1128 | ||
1124 | ift = !max_addresses || | 1129 | ift = !max_addresses || |
1125 | ipv6_count_addresses(idev) < max_addresses ? | 1130 | ipv6_count_addresses(idev) < max_addresses ? |
1126 | ipv6_add_addr(idev, &addr, tmp_plen, ipv6_addr_scope(&addr), | 1131 | ipv6_add_addr(idev, &addr, NULL, tmp_plen, |
1127 | addr_flags) : NULL; | 1132 | ipv6_addr_scope(&addr), addr_flags, |
1133 | tmp_valid_lft, tmp_prefered_lft) : NULL; | ||
1128 | if (IS_ERR_OR_NULL(ift)) { | 1134 | if (IS_ERR_OR_NULL(ift)) { |
1129 | in6_ifa_put(ifp); | 1135 | in6_ifa_put(ifp); |
1130 | in6_dev_put(idev); | 1136 | in6_dev_put(idev); |
@@ -1136,8 +1142,6 @@ retry: | |||
1136 | 1142 | ||
1137 | spin_lock_bh(&ift->lock); | 1143 | spin_lock_bh(&ift->lock); |
1138 | ift->ifpub = ifp; | 1144 | ift->ifpub = ifp; |
1139 | ift->valid_lft = tmp_valid_lft; | ||
1140 | ift->prefered_lft = tmp_prefered_lft; | ||
1141 | ift->cstamp = now; | 1145 | ift->cstamp = now; |
1142 | ift->tstamp = tmp_tstamp; | 1146 | ift->tstamp = tmp_tstamp; |
1143 | spin_unlock_bh(&ift->lock); | 1147 | spin_unlock_bh(&ift->lock); |
@@ -2179,16 +2183,19 @@ ok: | |||
2179 | */ | 2183 | */ |
2180 | if (!max_addresses || | 2184 | if (!max_addresses || |
2181 | ipv6_count_addresses(in6_dev) < max_addresses) | 2185 | ipv6_count_addresses(in6_dev) < max_addresses) |
2182 | ifp = ipv6_add_addr(in6_dev, &addr, pinfo->prefix_len, | 2186 | ifp = ipv6_add_addr(in6_dev, &addr, NULL, |
2187 | pinfo->prefix_len, | ||
2183 | addr_type&IPV6_ADDR_SCOPE_MASK, | 2188 | addr_type&IPV6_ADDR_SCOPE_MASK, |
2184 | addr_flags); | 2189 | addr_flags, valid_lft, |
2190 | prefered_lft); | ||
2185 | 2191 | ||
2186 | if (IS_ERR_OR_NULL(ifp)) { | 2192 | if (IS_ERR_OR_NULL(ifp)) { |
2187 | in6_dev_put(in6_dev); | 2193 | in6_dev_put(in6_dev); |
2188 | return; | 2194 | return; |
2189 | } | 2195 | } |
2190 | 2196 | ||
2191 | update_lft = create = 1; | 2197 | update_lft = 0; |
2198 | create = 1; | ||
2192 | ifp->cstamp = jiffies; | 2199 | ifp->cstamp = jiffies; |
2193 | ifp->tokenized = tokenized; | 2200 | ifp->tokenized = tokenized; |
2194 | addrconf_dad_start(ifp); | 2201 | addrconf_dad_start(ifp); |
@@ -2209,7 +2216,7 @@ ok: | |||
2209 | stored_lft = ifp->valid_lft - (now - ifp->tstamp) / HZ; | 2216 | stored_lft = ifp->valid_lft - (now - ifp->tstamp) / HZ; |
2210 | else | 2217 | else |
2211 | stored_lft = 0; | 2218 | stored_lft = 0; |
2212 | if (!update_lft && stored_lft) { | 2219 | if (!update_lft && !create && stored_lft) { |
2213 | if (valid_lft > MIN_VALID_LIFETIME || | 2220 | if (valid_lft > MIN_VALID_LIFETIME || |
2214 | valid_lft > stored_lft) | 2221 | valid_lft > stored_lft) |
2215 | update_lft = 1; | 2222 | update_lft = 1; |
@@ -2455,17 +2462,10 @@ static int inet6_addr_add(struct net *net, int ifindex, const struct in6_addr *p | |||
2455 | prefered_lft = timeout; | 2462 | prefered_lft = timeout; |
2456 | } | 2463 | } |
2457 | 2464 | ||
2458 | ifp = ipv6_add_addr(idev, pfx, plen, scope, ifa_flags); | 2465 | ifp = ipv6_add_addr(idev, pfx, peer_pfx, plen, scope, ifa_flags, |
2466 | valid_lft, prefered_lft); | ||
2459 | 2467 | ||
2460 | if (!IS_ERR(ifp)) { | 2468 | if (!IS_ERR(ifp)) { |
2461 | spin_lock_bh(&ifp->lock); | ||
2462 | ifp->valid_lft = valid_lft; | ||
2463 | ifp->prefered_lft = prefered_lft; | ||
2464 | ifp->tstamp = jiffies; | ||
2465 | if (peer_pfx) | ||
2466 | ifp->peer_addr = *peer_pfx; | ||
2467 | spin_unlock_bh(&ifp->lock); | ||
2468 | |||
2469 | addrconf_prefix_route(&ifp->addr, ifp->prefix_len, dev, | 2469 | addrconf_prefix_route(&ifp->addr, ifp->prefix_len, dev, |
2470 | expires, flags); | 2470 | expires, flags); |
2471 | /* | 2471 | /* |
@@ -2557,7 +2557,8 @@ static void add_addr(struct inet6_dev *idev, const struct in6_addr *addr, | |||
2557 | { | 2557 | { |
2558 | struct inet6_ifaddr *ifp; | 2558 | struct inet6_ifaddr *ifp; |
2559 | 2559 | ||
2560 | ifp = ipv6_add_addr(idev, addr, plen, scope, IFA_F_PERMANENT); | 2560 | ifp = ipv6_add_addr(idev, addr, NULL, plen, |
2561 | scope, IFA_F_PERMANENT, 0, 0); | ||
2561 | if (!IS_ERR(ifp)) { | 2562 | if (!IS_ERR(ifp)) { |
2562 | spin_lock_bh(&ifp->lock); | 2563 | spin_lock_bh(&ifp->lock); |
2563 | ifp->flags &= ~IFA_F_TENTATIVE; | 2564 | ifp->flags &= ~IFA_F_TENTATIVE; |
@@ -2683,7 +2684,7 @@ static void addrconf_add_linklocal(struct inet6_dev *idev, const struct in6_addr | |||
2683 | #endif | 2684 | #endif |
2684 | 2685 | ||
2685 | 2686 | ||
2686 | ifp = ipv6_add_addr(idev, addr, 64, IFA_LINK, addr_flags); | 2687 | ifp = ipv6_add_addr(idev, addr, NULL, 64, IFA_LINK, addr_flags, 0, 0); |
2687 | if (!IS_ERR(ifp)) { | 2688 | if (!IS_ERR(ifp)) { |
2688 | addrconf_prefix_route(&ifp->addr, ifp->prefix_len, idev->dev, 0, 0); | 2689 | addrconf_prefix_route(&ifp->addr, ifp->prefix_len, idev->dev, 0, 0); |
2689 | addrconf_dad_start(ifp); | 2690 | addrconf_dad_start(ifp); |
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 8b6c77389a04..ed828d6f37b2 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -1632,27 +1632,28 @@ static int fib6_age(struct rt6_info *rt, void *arg) | |||
1632 | 1632 | ||
1633 | static DEFINE_SPINLOCK(fib6_gc_lock); | 1633 | static DEFINE_SPINLOCK(fib6_gc_lock); |
1634 | 1634 | ||
1635 | void fib6_run_gc(unsigned long expires, struct net *net) | 1635 | void fib6_run_gc(unsigned long expires, struct net *net, bool force) |
1636 | { | 1636 | { |
1637 | if (expires != ~0UL) { | 1637 | unsigned long now; |
1638 | |||
1639 | if (force) { | ||
1638 | spin_lock_bh(&fib6_gc_lock); | 1640 | spin_lock_bh(&fib6_gc_lock); |
1639 | gc_args.timeout = expires ? (int)expires : | 1641 | } else if (!spin_trylock_bh(&fib6_gc_lock)) { |
1640 | net->ipv6.sysctl.ip6_rt_gc_interval; | 1642 | mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ); |
1641 | } else { | 1643 | return; |
1642 | if (!spin_trylock_bh(&fib6_gc_lock)) { | ||
1643 | mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ); | ||
1644 | return; | ||
1645 | } | ||
1646 | gc_args.timeout = net->ipv6.sysctl.ip6_rt_gc_interval; | ||
1647 | } | 1644 | } |
1645 | gc_args.timeout = expires ? (int)expires : | ||
1646 | net->ipv6.sysctl.ip6_rt_gc_interval; | ||
1648 | 1647 | ||
1649 | gc_args.more = icmp6_dst_gc(); | 1648 | gc_args.more = icmp6_dst_gc(); |
1650 | 1649 | ||
1651 | fib6_clean_all(net, fib6_age, 0, NULL); | 1650 | fib6_clean_all(net, fib6_age, 0, NULL); |
1651 | now = jiffies; | ||
1652 | net->ipv6.ip6_rt_last_gc = now; | ||
1652 | 1653 | ||
1653 | if (gc_args.more) | 1654 | if (gc_args.more) |
1654 | mod_timer(&net->ipv6.ip6_fib_timer, | 1655 | mod_timer(&net->ipv6.ip6_fib_timer, |
1655 | round_jiffies(jiffies | 1656 | round_jiffies(now |
1656 | + net->ipv6.sysctl.ip6_rt_gc_interval)); | 1657 | + net->ipv6.sysctl.ip6_rt_gc_interval)); |
1657 | else | 1658 | else |
1658 | del_timer(&net->ipv6.ip6_fib_timer); | 1659 | del_timer(&net->ipv6.ip6_fib_timer); |
@@ -1661,7 +1662,7 @@ void fib6_run_gc(unsigned long expires, struct net *net) | |||
1661 | 1662 | ||
1662 | static void fib6_gc_timer_cb(unsigned long arg) | 1663 | static void fib6_gc_timer_cb(unsigned long arg) |
1663 | { | 1664 | { |
1664 | fib6_run_gc(0, (struct net *)arg); | 1665 | fib6_run_gc(0, (struct net *)arg, true); |
1665 | } | 1666 | } |
1666 | 1667 | ||
1667 | static int __net_init fib6_net_init(struct net *net) | 1668 | static int __net_init fib6_net_init(struct net *net) |
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 6d78615f6726..a60a84ef04f7 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -259,10 +259,12 @@ static void __net_exit ip6mr_rules_exit(struct net *net) | |||
259 | { | 259 | { |
260 | struct mr6_table *mrt, *next; | 260 | struct mr6_table *mrt, *next; |
261 | 261 | ||
262 | rtnl_lock(); | ||
262 | list_for_each_entry_safe(mrt, next, &net->ipv6.mr6_tables, list) { | 263 | list_for_each_entry_safe(mrt, next, &net->ipv6.mr6_tables, list) { |
263 | list_del(&mrt->list); | 264 | list_del(&mrt->list); |
264 | ip6mr_free_table(mrt); | 265 | ip6mr_free_table(mrt); |
265 | } | 266 | } |
267 | rtnl_unlock(); | ||
266 | fib_rules_unregister(net->ipv6.mr6_rules_ops); | 268 | fib_rules_unregister(net->ipv6.mr6_rules_ops); |
267 | } | 269 | } |
268 | #else | 270 | #else |
@@ -289,7 +291,10 @@ static int __net_init ip6mr_rules_init(struct net *net) | |||
289 | 291 | ||
290 | static void __net_exit ip6mr_rules_exit(struct net *net) | 292 | static void __net_exit ip6mr_rules_exit(struct net *net) |
291 | { | 293 | { |
294 | rtnl_lock(); | ||
292 | ip6mr_free_table(net->ipv6.mrt6); | 295 | ip6mr_free_table(net->ipv6.mrt6); |
296 | net->ipv6.mrt6 = NULL; | ||
297 | rtnl_unlock(); | ||
293 | } | 298 | } |
294 | #endif | 299 | #endif |
295 | 300 | ||
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 24c03396e008..79aa9652ed86 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -1576,7 +1576,7 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event, | |||
1576 | switch (event) { | 1576 | switch (event) { |
1577 | case NETDEV_CHANGEADDR: | 1577 | case NETDEV_CHANGEADDR: |
1578 | neigh_changeaddr(&nd_tbl, dev); | 1578 | neigh_changeaddr(&nd_tbl, dev); |
1579 | fib6_run_gc(~0UL, net); | 1579 | fib6_run_gc(0, net, false); |
1580 | idev = in6_dev_get(dev); | 1580 | idev = in6_dev_get(dev); |
1581 | if (!idev) | 1581 | if (!idev) |
1582 | break; | 1582 | break; |
@@ -1586,7 +1586,7 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event, | |||
1586 | break; | 1586 | break; |
1587 | case NETDEV_DOWN: | 1587 | case NETDEV_DOWN: |
1588 | neigh_ifdown(&nd_tbl, dev); | 1588 | neigh_ifdown(&nd_tbl, dev); |
1589 | fib6_run_gc(~0UL, net); | 1589 | fib6_run_gc(0, net, false); |
1590 | break; | 1590 | break; |
1591 | case NETDEV_NOTIFY_PEERS: | 1591 | case NETDEV_NOTIFY_PEERS: |
1592 | ndisc_send_unsol_na(dev); | 1592 | ndisc_send_unsol_na(dev); |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index ce9616304521..e22c4db8d07a 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -1310,7 +1310,6 @@ static void icmp6_clean_all(int (*func)(struct rt6_info *rt, void *arg), | |||
1310 | 1310 | ||
1311 | static int ip6_dst_gc(struct dst_ops *ops) | 1311 | static int ip6_dst_gc(struct dst_ops *ops) |
1312 | { | 1312 | { |
1313 | unsigned long now = jiffies; | ||
1314 | struct net *net = container_of(ops, struct net, ipv6.ip6_dst_ops); | 1313 | struct net *net = container_of(ops, struct net, ipv6.ip6_dst_ops); |
1315 | int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval; | 1314 | int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval; |
1316 | int rt_max_size = net->ipv6.sysctl.ip6_rt_max_size; | 1315 | int rt_max_size = net->ipv6.sysctl.ip6_rt_max_size; |
@@ -1320,13 +1319,12 @@ static int ip6_dst_gc(struct dst_ops *ops) | |||
1320 | int entries; | 1319 | int entries; |
1321 | 1320 | ||
1322 | entries = dst_entries_get_fast(ops); | 1321 | entries = dst_entries_get_fast(ops); |
1323 | if (time_after(rt_last_gc + rt_min_interval, now) && | 1322 | if (time_after(rt_last_gc + rt_min_interval, jiffies) && |
1324 | entries <= rt_max_size) | 1323 | entries <= rt_max_size) |
1325 | goto out; | 1324 | goto out; |
1326 | 1325 | ||
1327 | net->ipv6.ip6_rt_gc_expire++; | 1326 | net->ipv6.ip6_rt_gc_expire++; |
1328 | fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net); | 1327 | fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net, entries > rt_max_size); |
1329 | net->ipv6.ip6_rt_last_gc = now; | ||
1330 | entries = dst_entries_get_slow(ops); | 1328 | entries = dst_entries_get_slow(ops); |
1331 | if (entries < ops->gc_thresh) | 1329 | if (entries < ops->gc_thresh) |
1332 | net->ipv6.ip6_rt_gc_expire = rt_gc_timeout>>1; | 1330 | net->ipv6.ip6_rt_gc_expire = rt_gc_timeout>>1; |
@@ -2826,7 +2824,7 @@ int ipv6_sysctl_rtcache_flush(struct ctl_table *ctl, int write, | |||
2826 | net = (struct net *)ctl->extra1; | 2824 | net = (struct net *)ctl->extra1; |
2827 | delay = net->ipv6.sysctl.flush_delay; | 2825 | delay = net->ipv6.sysctl.flush_delay; |
2828 | proc_dointvec(ctl, write, buffer, lenp, ppos); | 2826 | proc_dointvec(ctl, write, buffer, lenp, ppos); |
2829 | fib6_run_gc(delay <= 0 ? ~0UL : (unsigned long)delay, net); | 2827 | fib6_run_gc(delay <= 0 ? 0 : (unsigned long)delay, net, delay > 0); |
2830 | return 0; | 2828 | return 0; |
2831 | } | 2829 | } |
2832 | 2830 | ||
diff --git a/net/key/af_key.c b/net/key/af_key.c index 9da862070dd8..ab8bd2cabfa0 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
@@ -2081,6 +2081,7 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, const struct xfrm_policy * | |||
2081 | pol->sadb_x_policy_type = IPSEC_POLICY_NONE; | 2081 | pol->sadb_x_policy_type = IPSEC_POLICY_NONE; |
2082 | } | 2082 | } |
2083 | pol->sadb_x_policy_dir = dir+1; | 2083 | pol->sadb_x_policy_dir = dir+1; |
2084 | pol->sadb_x_policy_reserved = 0; | ||
2084 | pol->sadb_x_policy_id = xp->index; | 2085 | pol->sadb_x_policy_id = xp->index; |
2085 | pol->sadb_x_policy_priority = xp->priority; | 2086 | pol->sadb_x_policy_priority = xp->priority; |
2086 | 2087 | ||
@@ -3137,7 +3138,9 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct | |||
3137 | pol->sadb_x_policy_exttype = SADB_X_EXT_POLICY; | 3138 | pol->sadb_x_policy_exttype = SADB_X_EXT_POLICY; |
3138 | pol->sadb_x_policy_type = IPSEC_POLICY_IPSEC; | 3139 | pol->sadb_x_policy_type = IPSEC_POLICY_IPSEC; |
3139 | pol->sadb_x_policy_dir = XFRM_POLICY_OUT + 1; | 3140 | pol->sadb_x_policy_dir = XFRM_POLICY_OUT + 1; |
3141 | pol->sadb_x_policy_reserved = 0; | ||
3140 | pol->sadb_x_policy_id = xp->index; | 3142 | pol->sadb_x_policy_id = xp->index; |
3143 | pol->sadb_x_policy_priority = xp->priority; | ||
3141 | 3144 | ||
3142 | /* Set sadb_comb's. */ | 3145 | /* Set sadb_comb's. */ |
3143 | if (x->id.proto == IPPROTO_AH) | 3146 | if (x->id.proto == IPPROTO_AH) |
@@ -3525,6 +3528,7 @@ static int pfkey_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, | |||
3525 | pol->sadb_x_policy_exttype = SADB_X_EXT_POLICY; | 3528 | pol->sadb_x_policy_exttype = SADB_X_EXT_POLICY; |
3526 | pol->sadb_x_policy_type = IPSEC_POLICY_IPSEC; | 3529 | pol->sadb_x_policy_type = IPSEC_POLICY_IPSEC; |
3527 | pol->sadb_x_policy_dir = dir + 1; | 3530 | pol->sadb_x_policy_dir = dir + 1; |
3531 | pol->sadb_x_policy_reserved = 0; | ||
3528 | pol->sadb_x_policy_id = 0; | 3532 | pol->sadb_x_policy_id = 0; |
3529 | pol->sadb_x_policy_priority = 0; | 3533 | pol->sadb_x_policy_priority = 0; |
3530 | 3534 | ||
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 8184d121ff09..43dd7525bfcb 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -666,6 +666,8 @@ static void ieee80211_get_et_stats(struct wiphy *wiphy, | |||
666 | if (sta->sdata->dev != dev) | 666 | if (sta->sdata->dev != dev) |
667 | continue; | 667 | continue; |
668 | 668 | ||
669 | sinfo.filled = 0; | ||
670 | sta_set_sinfo(sta, &sinfo); | ||
669 | i = 0; | 671 | i = 0; |
670 | ADD_STA_STATS(sta); | 672 | ADD_STA_STATS(sta); |
671 | } | 673 | } |
diff --git a/net/mac80211/mesh_ps.c b/net/mac80211/mesh_ps.c index 3b7bfc01ee36..22290a929b94 100644 --- a/net/mac80211/mesh_ps.c +++ b/net/mac80211/mesh_ps.c | |||
@@ -229,6 +229,10 @@ void ieee80211_mps_sta_status_update(struct sta_info *sta) | |||
229 | enum nl80211_mesh_power_mode pm; | 229 | enum nl80211_mesh_power_mode pm; |
230 | bool do_buffer; | 230 | bool do_buffer; |
231 | 231 | ||
232 | /* For non-assoc STA, prevent buffering or frame transmission */ | ||
233 | if (sta->sta_state < IEEE80211_STA_ASSOC) | ||
234 | return; | ||
235 | |||
232 | /* | 236 | /* |
233 | * use peer-specific power mode if peering is established and the | 237 | * use peer-specific power mode if peering is established and the |
234 | * peer's power mode is known | 238 | * peer's power mode is known |
diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c index 7fc5d0d8149a..340126204343 100644 --- a/net/mac80211/pm.c +++ b/net/mac80211/pm.c | |||
@@ -99,10 +99,13 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) | |||
99 | } | 99 | } |
100 | mutex_unlock(&local->sta_mtx); | 100 | mutex_unlock(&local->sta_mtx); |
101 | 101 | ||
102 | /* remove all interfaces */ | 102 | /* remove all interfaces that were created in the driver */ |
103 | list_for_each_entry(sdata, &local->interfaces, list) { | 103 | list_for_each_entry(sdata, &local->interfaces, list) { |
104 | if (!ieee80211_sdata_running(sdata)) | 104 | if (!ieee80211_sdata_running(sdata) || |
105 | sdata->vif.type == NL80211_IFTYPE_AP_VLAN || | ||
106 | sdata->vif.type == NL80211_IFTYPE_MONITOR) | ||
105 | continue; | 107 | continue; |
108 | |||
106 | drv_remove_interface(local, sdata); | 109 | drv_remove_interface(local, sdata); |
107 | } | 110 | } |
108 | 111 | ||
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c index ac7ef5414bde..e6512e2ffd20 100644 --- a/net/mac80211/rc80211_minstrel.c +++ b/net/mac80211/rc80211_minstrel.c | |||
@@ -290,7 +290,7 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta, | |||
290 | struct minstrel_rate *msr, *mr; | 290 | struct minstrel_rate *msr, *mr; |
291 | unsigned int ndx; | 291 | unsigned int ndx; |
292 | bool mrr_capable; | 292 | bool mrr_capable; |
293 | bool prev_sample = mi->prev_sample; | 293 | bool prev_sample; |
294 | int delta; | 294 | int delta; |
295 | int sampling_ratio; | 295 | int sampling_ratio; |
296 | 296 | ||
@@ -314,6 +314,7 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta, | |||
314 | (mi->sample_count + mi->sample_deferred / 2); | 314 | (mi->sample_count + mi->sample_deferred / 2); |
315 | 315 | ||
316 | /* delta < 0: no sampling required */ | 316 | /* delta < 0: no sampling required */ |
317 | prev_sample = mi->prev_sample; | ||
317 | mi->prev_sample = false; | 318 | mi->prev_sample = false; |
318 | if (delta < 0 || (!mrr_capable && prev_sample)) | 319 | if (delta < 0 || (!mrr_capable && prev_sample)) |
319 | return; | 320 | return; |
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index 5b2d3012b983..f5aed963b22e 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c | |||
@@ -804,10 +804,18 @@ minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, | |||
804 | 804 | ||
805 | sample_group = &minstrel_mcs_groups[sample_idx / MCS_GROUP_RATES]; | 805 | sample_group = &minstrel_mcs_groups[sample_idx / MCS_GROUP_RATES]; |
806 | info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; | 806 | info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; |
807 | rate->count = 1; | ||
808 | |||
809 | if (sample_idx / MCS_GROUP_RATES == MINSTREL_CCK_GROUP) { | ||
810 | int idx = sample_idx % ARRAY_SIZE(mp->cck_rates); | ||
811 | rate->idx = mp->cck_rates[idx]; | ||
812 | rate->flags = 0; | ||
813 | return; | ||
814 | } | ||
815 | |||
807 | rate->idx = sample_idx % MCS_GROUP_RATES + | 816 | rate->idx = sample_idx % MCS_GROUP_RATES + |
808 | (sample_group->streams - 1) * MCS_GROUP_RATES; | 817 | (sample_group->streams - 1) * MCS_GROUP_RATES; |
809 | rate->flags = IEEE80211_TX_RC_MCS | sample_group->flags; | 818 | rate->flags = IEEE80211_TX_RC_MCS | sample_group->flags; |
810 | rate->count = 1; | ||
811 | } | 819 | } |
812 | 820 | ||
813 | static void | 821 | static void |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 23dbcfc69b3b..2c5a79bd3777 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -936,8 +936,14 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx) | |||
936 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; | 936 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; |
937 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); | 937 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); |
938 | 938 | ||
939 | /* Drop duplicate 802.11 retransmissions (IEEE 802.11 Chap. 9.2.9) */ | 939 | /* |
940 | if (rx->sta && !is_multicast_ether_addr(hdr->addr1)) { | 940 | * Drop duplicate 802.11 retransmissions |
941 | * (IEEE 802.11-2012: 9.3.2.10 "Duplicate detection and recovery") | ||
942 | */ | ||
943 | if (rx->skb->len >= 24 && rx->sta && | ||
944 | !ieee80211_is_ctl(hdr->frame_control) && | ||
945 | !ieee80211_is_qos_nullfunc(hdr->frame_control) && | ||
946 | !is_multicast_ether_addr(hdr->addr1)) { | ||
941 | if (unlikely(ieee80211_has_retry(hdr->frame_control) && | 947 | if (unlikely(ieee80211_has_retry(hdr->frame_control) && |
942 | rx->sta->last_seq_ctrl[rx->seqno_idx] == | 948 | rx->sta->last_seq_ctrl[rx->seqno_idx] == |
943 | hdr->seq_ctrl)) { | 949 | hdr->seq_ctrl)) { |
diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c index c63b618cd619..4fd1ca94fd4a 100644 --- a/net/netfilter/nf_conntrack_expect.c +++ b/net/netfilter/nf_conntrack_expect.c | |||
@@ -293,6 +293,11 @@ void nf_ct_expect_init(struct nf_conntrack_expect *exp, unsigned int class, | |||
293 | sizeof(exp->tuple.dst.u3) - len); | 293 | sizeof(exp->tuple.dst.u3) - len); |
294 | 294 | ||
295 | exp->tuple.dst.u.all = *dst; | 295 | exp->tuple.dst.u.all = *dst; |
296 | |||
297 | #ifdef CONFIG_NF_NAT_NEEDED | ||
298 | memset(&exp->saved_addr, 0, sizeof(exp->saved_addr)); | ||
299 | memset(&exp->saved_proto, 0, sizeof(exp->saved_proto)); | ||
300 | #endif | ||
296 | } | 301 | } |
297 | EXPORT_SYMBOL_GPL(nf_ct_expect_init); | 302 | EXPORT_SYMBOL_GPL(nf_ct_expect_init); |
298 | 303 | ||
diff --git a/net/netfilter/xt_socket.c b/net/netfilter/xt_socket.c index f8b71911037a..20b15916f403 100644 --- a/net/netfilter/xt_socket.c +++ b/net/netfilter/xt_socket.c | |||
@@ -172,7 +172,7 @@ socket_match(const struct sk_buff *skb, struct xt_action_param *par, | |||
172 | 172 | ||
173 | /* Ignore non-transparent sockets, | 173 | /* Ignore non-transparent sockets, |
174 | if XT_SOCKET_TRANSPARENT is used */ | 174 | if XT_SOCKET_TRANSPARENT is used */ |
175 | if (info && info->flags & XT_SOCKET_TRANSPARENT) | 175 | if (info->flags & XT_SOCKET_TRANSPARENT) |
176 | transparent = ((sk->sk_state != TCP_TIME_WAIT && | 176 | transparent = ((sk->sk_state != TCP_TIME_WAIT && |
177 | inet_sk(sk)->transparent) || | 177 | inet_sk(sk)->transparent) || |
178 | (sk->sk_state == TCP_TIME_WAIT && | 178 | (sk->sk_state == TCP_TIME_WAIT && |
@@ -196,7 +196,11 @@ socket_match(const struct sk_buff *skb, struct xt_action_param *par, | |||
196 | static bool | 196 | static bool |
197 | socket_mt4_v0(const struct sk_buff *skb, struct xt_action_param *par) | 197 | socket_mt4_v0(const struct sk_buff *skb, struct xt_action_param *par) |
198 | { | 198 | { |
199 | return socket_match(skb, par, NULL); | 199 | static struct xt_socket_mtinfo1 xt_info_v0 = { |
200 | .flags = 0, | ||
201 | }; | ||
202 | |||
203 | return socket_match(skb, par, &xt_info_v0); | ||
200 | } | 204 | } |
201 | 205 | ||
202 | static bool | 206 | static bool |
@@ -314,7 +318,7 @@ socket_mt6_v1_v2(const struct sk_buff *skb, struct xt_action_param *par) | |||
314 | 318 | ||
315 | /* Ignore non-transparent sockets, | 319 | /* Ignore non-transparent sockets, |
316 | if XT_SOCKET_TRANSPARENT is used */ | 320 | if XT_SOCKET_TRANSPARENT is used */ |
317 | if (info && info->flags & XT_SOCKET_TRANSPARENT) | 321 | if (info->flags & XT_SOCKET_TRANSPARENT) |
318 | transparent = ((sk->sk_state != TCP_TIME_WAIT && | 322 | transparent = ((sk->sk_state != TCP_TIME_WAIT && |
319 | inet_sk(sk)->transparent) || | 323 | inet_sk(sk)->transparent) || |
320 | (sk->sk_state == TCP_TIME_WAIT && | 324 | (sk->sk_state == TCP_TIME_WAIT && |
diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c index c15042f987bd..a1100640495d 100644 --- a/net/netlabel/netlabel_cipso_v4.c +++ b/net/netlabel/netlabel_cipso_v4.c | |||
@@ -691,8 +691,8 @@ static int netlbl_cipsov4_remove_cb(struct netlbl_dom_map *entry, void *arg) | |||
691 | { | 691 | { |
692 | struct netlbl_domhsh_walk_arg *cb_arg = arg; | 692 | struct netlbl_domhsh_walk_arg *cb_arg = arg; |
693 | 693 | ||
694 | if (entry->type == NETLBL_NLTYPE_CIPSOV4 && | 694 | if (entry->def.type == NETLBL_NLTYPE_CIPSOV4 && |
695 | entry->type_def.cipsov4->doi == cb_arg->doi) | 695 | entry->def.cipso->doi == cb_arg->doi) |
696 | return netlbl_domhsh_remove_entry(entry, cb_arg->audit_info); | 696 | return netlbl_domhsh_remove_entry(entry, cb_arg->audit_info); |
697 | 697 | ||
698 | return 0; | 698 | return 0; |
diff --git a/net/netlabel/netlabel_domainhash.c b/net/netlabel/netlabel_domainhash.c index 6bb1d42f0fac..85d842e6e431 100644 --- a/net/netlabel/netlabel_domainhash.c +++ b/net/netlabel/netlabel_domainhash.c | |||
@@ -84,15 +84,15 @@ static void netlbl_domhsh_free_entry(struct rcu_head *entry) | |||
84 | #endif /* IPv6 */ | 84 | #endif /* IPv6 */ |
85 | 85 | ||
86 | ptr = container_of(entry, struct netlbl_dom_map, rcu); | 86 | ptr = container_of(entry, struct netlbl_dom_map, rcu); |
87 | if (ptr->type == NETLBL_NLTYPE_ADDRSELECT) { | 87 | if (ptr->def.type == NETLBL_NLTYPE_ADDRSELECT) { |
88 | netlbl_af4list_foreach_safe(iter4, tmp4, | 88 | netlbl_af4list_foreach_safe(iter4, tmp4, |
89 | &ptr->type_def.addrsel->list4) { | 89 | &ptr->def.addrsel->list4) { |
90 | netlbl_af4list_remove_entry(iter4); | 90 | netlbl_af4list_remove_entry(iter4); |
91 | kfree(netlbl_domhsh_addr4_entry(iter4)); | 91 | kfree(netlbl_domhsh_addr4_entry(iter4)); |
92 | } | 92 | } |
93 | #if IS_ENABLED(CONFIG_IPV6) | 93 | #if IS_ENABLED(CONFIG_IPV6) |
94 | netlbl_af6list_foreach_safe(iter6, tmp6, | 94 | netlbl_af6list_foreach_safe(iter6, tmp6, |
95 | &ptr->type_def.addrsel->list6) { | 95 | &ptr->def.addrsel->list6) { |
96 | netlbl_af6list_remove_entry(iter6); | 96 | netlbl_af6list_remove_entry(iter6); |
97 | kfree(netlbl_domhsh_addr6_entry(iter6)); | 97 | kfree(netlbl_domhsh_addr6_entry(iter6)); |
98 | } | 98 | } |
@@ -213,21 +213,21 @@ static void netlbl_domhsh_audit_add(struct netlbl_dom_map *entry, | |||
213 | if (addr4 != NULL) { | 213 | if (addr4 != NULL) { |
214 | struct netlbl_domaddr4_map *map4; | 214 | struct netlbl_domaddr4_map *map4; |
215 | map4 = netlbl_domhsh_addr4_entry(addr4); | 215 | map4 = netlbl_domhsh_addr4_entry(addr4); |
216 | type = map4->type; | 216 | type = map4->def.type; |
217 | cipsov4 = map4->type_def.cipsov4; | 217 | cipsov4 = map4->def.cipso; |
218 | netlbl_af4list_audit_addr(audit_buf, 0, NULL, | 218 | netlbl_af4list_audit_addr(audit_buf, 0, NULL, |
219 | addr4->addr, addr4->mask); | 219 | addr4->addr, addr4->mask); |
220 | #if IS_ENABLED(CONFIG_IPV6) | 220 | #if IS_ENABLED(CONFIG_IPV6) |
221 | } else if (addr6 != NULL) { | 221 | } else if (addr6 != NULL) { |
222 | struct netlbl_domaddr6_map *map6; | 222 | struct netlbl_domaddr6_map *map6; |
223 | map6 = netlbl_domhsh_addr6_entry(addr6); | 223 | map6 = netlbl_domhsh_addr6_entry(addr6); |
224 | type = map6->type; | 224 | type = map6->def.type; |
225 | netlbl_af6list_audit_addr(audit_buf, 0, NULL, | 225 | netlbl_af6list_audit_addr(audit_buf, 0, NULL, |
226 | &addr6->addr, &addr6->mask); | 226 | &addr6->addr, &addr6->mask); |
227 | #endif /* IPv6 */ | 227 | #endif /* IPv6 */ |
228 | } else { | 228 | } else { |
229 | type = entry->type; | 229 | type = entry->def.type; |
230 | cipsov4 = entry->type_def.cipsov4; | 230 | cipsov4 = entry->def.cipso; |
231 | } | 231 | } |
232 | switch (type) { | 232 | switch (type) { |
233 | case NETLBL_NLTYPE_UNLABELED: | 233 | case NETLBL_NLTYPE_UNLABELED: |
@@ -265,26 +265,25 @@ static int netlbl_domhsh_validate(const struct netlbl_dom_map *entry) | |||
265 | if (entry == NULL) | 265 | if (entry == NULL) |
266 | return -EINVAL; | 266 | return -EINVAL; |
267 | 267 | ||
268 | switch (entry->type) { | 268 | switch (entry->def.type) { |
269 | case NETLBL_NLTYPE_UNLABELED: | 269 | case NETLBL_NLTYPE_UNLABELED: |
270 | if (entry->type_def.cipsov4 != NULL || | 270 | if (entry->def.cipso != NULL || entry->def.addrsel != NULL) |
271 | entry->type_def.addrsel != NULL) | ||
272 | return -EINVAL; | 271 | return -EINVAL; |
273 | break; | 272 | break; |
274 | case NETLBL_NLTYPE_CIPSOV4: | 273 | case NETLBL_NLTYPE_CIPSOV4: |
275 | if (entry->type_def.cipsov4 == NULL) | 274 | if (entry->def.cipso == NULL) |
276 | return -EINVAL; | 275 | return -EINVAL; |
277 | break; | 276 | break; |
278 | case NETLBL_NLTYPE_ADDRSELECT: | 277 | case NETLBL_NLTYPE_ADDRSELECT: |
279 | netlbl_af4list_foreach(iter4, &entry->type_def.addrsel->list4) { | 278 | netlbl_af4list_foreach(iter4, &entry->def.addrsel->list4) { |
280 | map4 = netlbl_domhsh_addr4_entry(iter4); | 279 | map4 = netlbl_domhsh_addr4_entry(iter4); |
281 | switch (map4->type) { | 280 | switch (map4->def.type) { |
282 | case NETLBL_NLTYPE_UNLABELED: | 281 | case NETLBL_NLTYPE_UNLABELED: |
283 | if (map4->type_def.cipsov4 != NULL) | 282 | if (map4->def.cipso != NULL) |
284 | return -EINVAL; | 283 | return -EINVAL; |
285 | break; | 284 | break; |
286 | case NETLBL_NLTYPE_CIPSOV4: | 285 | case NETLBL_NLTYPE_CIPSOV4: |
287 | if (map4->type_def.cipsov4 == NULL) | 286 | if (map4->def.cipso == NULL) |
288 | return -EINVAL; | 287 | return -EINVAL; |
289 | break; | 288 | break; |
290 | default: | 289 | default: |
@@ -292,9 +291,9 @@ static int netlbl_domhsh_validate(const struct netlbl_dom_map *entry) | |||
292 | } | 291 | } |
293 | } | 292 | } |
294 | #if IS_ENABLED(CONFIG_IPV6) | 293 | #if IS_ENABLED(CONFIG_IPV6) |
295 | netlbl_af6list_foreach(iter6, &entry->type_def.addrsel->list6) { | 294 | netlbl_af6list_foreach(iter6, &entry->def.addrsel->list6) { |
296 | map6 = netlbl_domhsh_addr6_entry(iter6); | 295 | map6 = netlbl_domhsh_addr6_entry(iter6); |
297 | switch (map6->type) { | 296 | switch (map6->def.type) { |
298 | case NETLBL_NLTYPE_UNLABELED: | 297 | case NETLBL_NLTYPE_UNLABELED: |
299 | break; | 298 | break; |
300 | default: | 299 | default: |
@@ -402,32 +401,31 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry, | |||
402 | rcu_assign_pointer(netlbl_domhsh_def, entry); | 401 | rcu_assign_pointer(netlbl_domhsh_def, entry); |
403 | } | 402 | } |
404 | 403 | ||
405 | if (entry->type == NETLBL_NLTYPE_ADDRSELECT) { | 404 | if (entry->def.type == NETLBL_NLTYPE_ADDRSELECT) { |
406 | netlbl_af4list_foreach_rcu(iter4, | 405 | netlbl_af4list_foreach_rcu(iter4, |
407 | &entry->type_def.addrsel->list4) | 406 | &entry->def.addrsel->list4) |
408 | netlbl_domhsh_audit_add(entry, iter4, NULL, | 407 | netlbl_domhsh_audit_add(entry, iter4, NULL, |
409 | ret_val, audit_info); | 408 | ret_val, audit_info); |
410 | #if IS_ENABLED(CONFIG_IPV6) | 409 | #if IS_ENABLED(CONFIG_IPV6) |
411 | netlbl_af6list_foreach_rcu(iter6, | 410 | netlbl_af6list_foreach_rcu(iter6, |
412 | &entry->type_def.addrsel->list6) | 411 | &entry->def.addrsel->list6) |
413 | netlbl_domhsh_audit_add(entry, NULL, iter6, | 412 | netlbl_domhsh_audit_add(entry, NULL, iter6, |
414 | ret_val, audit_info); | 413 | ret_val, audit_info); |
415 | #endif /* IPv6 */ | 414 | #endif /* IPv6 */ |
416 | } else | 415 | } else |
417 | netlbl_domhsh_audit_add(entry, NULL, NULL, | 416 | netlbl_domhsh_audit_add(entry, NULL, NULL, |
418 | ret_val, audit_info); | 417 | ret_val, audit_info); |
419 | } else if (entry_old->type == NETLBL_NLTYPE_ADDRSELECT && | 418 | } else if (entry_old->def.type == NETLBL_NLTYPE_ADDRSELECT && |
420 | entry->type == NETLBL_NLTYPE_ADDRSELECT) { | 419 | entry->def.type == NETLBL_NLTYPE_ADDRSELECT) { |
421 | struct list_head *old_list4; | 420 | struct list_head *old_list4; |
422 | struct list_head *old_list6; | 421 | struct list_head *old_list6; |
423 | 422 | ||
424 | old_list4 = &entry_old->type_def.addrsel->list4; | 423 | old_list4 = &entry_old->def.addrsel->list4; |
425 | old_list6 = &entry_old->type_def.addrsel->list6; | 424 | old_list6 = &entry_old->def.addrsel->list6; |
426 | 425 | ||
427 | /* we only allow the addition of address selectors if all of | 426 | /* we only allow the addition of address selectors if all of |
428 | * the selectors do not exist in the existing domain map */ | 427 | * the selectors do not exist in the existing domain map */ |
429 | netlbl_af4list_foreach_rcu(iter4, | 428 | netlbl_af4list_foreach_rcu(iter4, &entry->def.addrsel->list4) |
430 | &entry->type_def.addrsel->list4) | ||
431 | if (netlbl_af4list_search_exact(iter4->addr, | 429 | if (netlbl_af4list_search_exact(iter4->addr, |
432 | iter4->mask, | 430 | iter4->mask, |
433 | old_list4)) { | 431 | old_list4)) { |
@@ -435,8 +433,7 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry, | |||
435 | goto add_return; | 433 | goto add_return; |
436 | } | 434 | } |
437 | #if IS_ENABLED(CONFIG_IPV6) | 435 | #if IS_ENABLED(CONFIG_IPV6) |
438 | netlbl_af6list_foreach_rcu(iter6, | 436 | netlbl_af6list_foreach_rcu(iter6, &entry->def.addrsel->list6) |
439 | &entry->type_def.addrsel->list6) | ||
440 | if (netlbl_af6list_search_exact(&iter6->addr, | 437 | if (netlbl_af6list_search_exact(&iter6->addr, |
441 | &iter6->mask, | 438 | &iter6->mask, |
442 | old_list6)) { | 439 | old_list6)) { |
@@ -446,7 +443,7 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry, | |||
446 | #endif /* IPv6 */ | 443 | #endif /* IPv6 */ |
447 | 444 | ||
448 | netlbl_af4list_foreach_safe(iter4, tmp4, | 445 | netlbl_af4list_foreach_safe(iter4, tmp4, |
449 | &entry->type_def.addrsel->list4) { | 446 | &entry->def.addrsel->list4) { |
450 | netlbl_af4list_remove_entry(iter4); | 447 | netlbl_af4list_remove_entry(iter4); |
451 | iter4->valid = 1; | 448 | iter4->valid = 1; |
452 | ret_val = netlbl_af4list_add(iter4, old_list4); | 449 | ret_val = netlbl_af4list_add(iter4, old_list4); |
@@ -457,7 +454,7 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry, | |||
457 | } | 454 | } |
458 | #if IS_ENABLED(CONFIG_IPV6) | 455 | #if IS_ENABLED(CONFIG_IPV6) |
459 | netlbl_af6list_foreach_safe(iter6, tmp6, | 456 | netlbl_af6list_foreach_safe(iter6, tmp6, |
460 | &entry->type_def.addrsel->list6) { | 457 | &entry->def.addrsel->list6) { |
461 | netlbl_af6list_remove_entry(iter6); | 458 | netlbl_af6list_remove_entry(iter6); |
462 | iter6->valid = 1; | 459 | iter6->valid = 1; |
463 | ret_val = netlbl_af6list_add(iter6, old_list6); | 460 | ret_val = netlbl_af6list_add(iter6, old_list6); |
@@ -538,18 +535,18 @@ int netlbl_domhsh_remove_entry(struct netlbl_dom_map *entry, | |||
538 | struct netlbl_af4list *iter4; | 535 | struct netlbl_af4list *iter4; |
539 | struct netlbl_domaddr4_map *map4; | 536 | struct netlbl_domaddr4_map *map4; |
540 | 537 | ||
541 | switch (entry->type) { | 538 | switch (entry->def.type) { |
542 | case NETLBL_NLTYPE_ADDRSELECT: | 539 | case NETLBL_NLTYPE_ADDRSELECT: |
543 | netlbl_af4list_foreach_rcu(iter4, | 540 | netlbl_af4list_foreach_rcu(iter4, |
544 | &entry->type_def.addrsel->list4) { | 541 | &entry->def.addrsel->list4) { |
545 | map4 = netlbl_domhsh_addr4_entry(iter4); | 542 | map4 = netlbl_domhsh_addr4_entry(iter4); |
546 | cipso_v4_doi_putdef(map4->type_def.cipsov4); | 543 | cipso_v4_doi_putdef(map4->def.cipso); |
547 | } | 544 | } |
548 | /* no need to check the IPv6 list since we currently | 545 | /* no need to check the IPv6 list since we currently |
549 | * support only unlabeled protocols for IPv6 */ | 546 | * support only unlabeled protocols for IPv6 */ |
550 | break; | 547 | break; |
551 | case NETLBL_NLTYPE_CIPSOV4: | 548 | case NETLBL_NLTYPE_CIPSOV4: |
552 | cipso_v4_doi_putdef(entry->type_def.cipsov4); | 549 | cipso_v4_doi_putdef(entry->def.cipso); |
553 | break; | 550 | break; |
554 | } | 551 | } |
555 | call_rcu(&entry->rcu, netlbl_domhsh_free_entry); | 552 | call_rcu(&entry->rcu, netlbl_domhsh_free_entry); |
@@ -590,20 +587,21 @@ int netlbl_domhsh_remove_af4(const char *domain, | |||
590 | entry_map = netlbl_domhsh_search(domain); | 587 | entry_map = netlbl_domhsh_search(domain); |
591 | else | 588 | else |
592 | entry_map = netlbl_domhsh_search_def(domain); | 589 | entry_map = netlbl_domhsh_search_def(domain); |
593 | if (entry_map == NULL || entry_map->type != NETLBL_NLTYPE_ADDRSELECT) | 590 | if (entry_map == NULL || |
591 | entry_map->def.type != NETLBL_NLTYPE_ADDRSELECT) | ||
594 | goto remove_af4_failure; | 592 | goto remove_af4_failure; |
595 | 593 | ||
596 | spin_lock(&netlbl_domhsh_lock); | 594 | spin_lock(&netlbl_domhsh_lock); |
597 | entry_addr = netlbl_af4list_remove(addr->s_addr, mask->s_addr, | 595 | entry_addr = netlbl_af4list_remove(addr->s_addr, mask->s_addr, |
598 | &entry_map->type_def.addrsel->list4); | 596 | &entry_map->def.addrsel->list4); |
599 | spin_unlock(&netlbl_domhsh_lock); | 597 | spin_unlock(&netlbl_domhsh_lock); |
600 | 598 | ||
601 | if (entry_addr == NULL) | 599 | if (entry_addr == NULL) |
602 | goto remove_af4_failure; | 600 | goto remove_af4_failure; |
603 | netlbl_af4list_foreach_rcu(iter4, &entry_map->type_def.addrsel->list4) | 601 | netlbl_af4list_foreach_rcu(iter4, &entry_map->def.addrsel->list4) |
604 | goto remove_af4_single_addr; | 602 | goto remove_af4_single_addr; |
605 | #if IS_ENABLED(CONFIG_IPV6) | 603 | #if IS_ENABLED(CONFIG_IPV6) |
606 | netlbl_af6list_foreach_rcu(iter6, &entry_map->type_def.addrsel->list6) | 604 | netlbl_af6list_foreach_rcu(iter6, &entry_map->def.addrsel->list6) |
607 | goto remove_af4_single_addr; | 605 | goto remove_af4_single_addr; |
608 | #endif /* IPv6 */ | 606 | #endif /* IPv6 */ |
609 | /* the domain mapping is empty so remove it from the mapping table */ | 607 | /* the domain mapping is empty so remove it from the mapping table */ |
@@ -616,7 +614,7 @@ remove_af4_single_addr: | |||
616 | * shouldn't be a problem */ | 614 | * shouldn't be a problem */ |
617 | synchronize_rcu(); | 615 | synchronize_rcu(); |
618 | entry = netlbl_domhsh_addr4_entry(entry_addr); | 616 | entry = netlbl_domhsh_addr4_entry(entry_addr); |
619 | cipso_v4_doi_putdef(entry->type_def.cipsov4); | 617 | cipso_v4_doi_putdef(entry->def.cipso); |
620 | kfree(entry); | 618 | kfree(entry); |
621 | return 0; | 619 | return 0; |
622 | 620 | ||
@@ -693,8 +691,8 @@ struct netlbl_dom_map *netlbl_domhsh_getentry(const char *domain) | |||
693 | * responsible for ensuring that rcu_read_[un]lock() is called. | 691 | * responsible for ensuring that rcu_read_[un]lock() is called. |
694 | * | 692 | * |
695 | */ | 693 | */ |
696 | struct netlbl_domaddr4_map *netlbl_domhsh_getentry_af4(const char *domain, | 694 | struct netlbl_dommap_def *netlbl_domhsh_getentry_af4(const char *domain, |
697 | __be32 addr) | 695 | __be32 addr) |
698 | { | 696 | { |
699 | struct netlbl_dom_map *dom_iter; | 697 | struct netlbl_dom_map *dom_iter; |
700 | struct netlbl_af4list *addr_iter; | 698 | struct netlbl_af4list *addr_iter; |
@@ -702,15 +700,13 @@ struct netlbl_domaddr4_map *netlbl_domhsh_getentry_af4(const char *domain, | |||
702 | dom_iter = netlbl_domhsh_search_def(domain); | 700 | dom_iter = netlbl_domhsh_search_def(domain); |
703 | if (dom_iter == NULL) | 701 | if (dom_iter == NULL) |
704 | return NULL; | 702 | return NULL; |
705 | if (dom_iter->type != NETLBL_NLTYPE_ADDRSELECT) | ||
706 | return NULL; | ||
707 | 703 | ||
708 | addr_iter = netlbl_af4list_search(addr, | 704 | if (dom_iter->def.type != NETLBL_NLTYPE_ADDRSELECT) |
709 | &dom_iter->type_def.addrsel->list4); | 705 | return &dom_iter->def; |
706 | addr_iter = netlbl_af4list_search(addr, &dom_iter->def.addrsel->list4); | ||
710 | if (addr_iter == NULL) | 707 | if (addr_iter == NULL) |
711 | return NULL; | 708 | return NULL; |
712 | 709 | return &(netlbl_domhsh_addr4_entry(addr_iter)->def); | |
713 | return netlbl_domhsh_addr4_entry(addr_iter); | ||
714 | } | 710 | } |
715 | 711 | ||
716 | #if IS_ENABLED(CONFIG_IPV6) | 712 | #if IS_ENABLED(CONFIG_IPV6) |
@@ -725,7 +721,7 @@ struct netlbl_domaddr4_map *netlbl_domhsh_getentry_af4(const char *domain, | |||
725 | * responsible for ensuring that rcu_read_[un]lock() is called. | 721 | * responsible for ensuring that rcu_read_[un]lock() is called. |
726 | * | 722 | * |
727 | */ | 723 | */ |
728 | struct netlbl_domaddr6_map *netlbl_domhsh_getentry_af6(const char *domain, | 724 | struct netlbl_dommap_def *netlbl_domhsh_getentry_af6(const char *domain, |
729 | const struct in6_addr *addr) | 725 | const struct in6_addr *addr) |
730 | { | 726 | { |
731 | struct netlbl_dom_map *dom_iter; | 727 | struct netlbl_dom_map *dom_iter; |
@@ -734,15 +730,13 @@ struct netlbl_domaddr6_map *netlbl_domhsh_getentry_af6(const char *domain, | |||
734 | dom_iter = netlbl_domhsh_search_def(domain); | 730 | dom_iter = netlbl_domhsh_search_def(domain); |
735 | if (dom_iter == NULL) | 731 | if (dom_iter == NULL) |
736 | return NULL; | 732 | return NULL; |
737 | if (dom_iter->type != NETLBL_NLTYPE_ADDRSELECT) | ||
738 | return NULL; | ||
739 | 733 | ||
740 | addr_iter = netlbl_af6list_search(addr, | 734 | if (dom_iter->def.type != NETLBL_NLTYPE_ADDRSELECT) |
741 | &dom_iter->type_def.addrsel->list6); | 735 | return &dom_iter->def; |
736 | addr_iter = netlbl_af6list_search(addr, &dom_iter->def.addrsel->list6); | ||
742 | if (addr_iter == NULL) | 737 | if (addr_iter == NULL) |
743 | return NULL; | 738 | return NULL; |
744 | 739 | return &(netlbl_domhsh_addr6_entry(addr_iter)->def); | |
745 | return netlbl_domhsh_addr6_entry(addr_iter); | ||
746 | } | 740 | } |
747 | #endif /* IPv6 */ | 741 | #endif /* IPv6 */ |
748 | 742 | ||
diff --git a/net/netlabel/netlabel_domainhash.h b/net/netlabel/netlabel_domainhash.h index 90872c4ca30f..b9be0eed8980 100644 --- a/net/netlabel/netlabel_domainhash.h +++ b/net/netlabel/netlabel_domainhash.h | |||
@@ -43,37 +43,35 @@ | |||
43 | #define NETLBL_DOMHSH_BITSIZE 7 | 43 | #define NETLBL_DOMHSH_BITSIZE 7 |
44 | 44 | ||
45 | /* Domain mapping definition structures */ | 45 | /* Domain mapping definition structures */ |
46 | struct netlbl_domaddr_map { | ||
47 | struct list_head list4; | ||
48 | struct list_head list6; | ||
49 | }; | ||
50 | struct netlbl_dommap_def { | ||
51 | u32 type; | ||
52 | union { | ||
53 | struct netlbl_domaddr_map *addrsel; | ||
54 | struct cipso_v4_doi *cipso; | ||
55 | }; | ||
56 | }; | ||
46 | #define netlbl_domhsh_addr4_entry(iter) \ | 57 | #define netlbl_domhsh_addr4_entry(iter) \ |
47 | container_of(iter, struct netlbl_domaddr4_map, list) | 58 | container_of(iter, struct netlbl_domaddr4_map, list) |
48 | struct netlbl_domaddr4_map { | 59 | struct netlbl_domaddr4_map { |
49 | u32 type; | 60 | struct netlbl_dommap_def def; |
50 | union { | ||
51 | struct cipso_v4_doi *cipsov4; | ||
52 | } type_def; | ||
53 | 61 | ||
54 | struct netlbl_af4list list; | 62 | struct netlbl_af4list list; |
55 | }; | 63 | }; |
56 | #define netlbl_domhsh_addr6_entry(iter) \ | 64 | #define netlbl_domhsh_addr6_entry(iter) \ |
57 | container_of(iter, struct netlbl_domaddr6_map, list) | 65 | container_of(iter, struct netlbl_domaddr6_map, list) |
58 | struct netlbl_domaddr6_map { | 66 | struct netlbl_domaddr6_map { |
59 | u32 type; | 67 | struct netlbl_dommap_def def; |
60 | |||
61 | /* NOTE: no 'type_def' union needed at present since we don't currently | ||
62 | * support any IPv6 labeling protocols */ | ||
63 | 68 | ||
64 | struct netlbl_af6list list; | 69 | struct netlbl_af6list list; |
65 | }; | 70 | }; |
66 | struct netlbl_domaddr_map { | 71 | |
67 | struct list_head list4; | ||
68 | struct list_head list6; | ||
69 | }; | ||
70 | struct netlbl_dom_map { | 72 | struct netlbl_dom_map { |
71 | char *domain; | 73 | char *domain; |
72 | u32 type; | 74 | struct netlbl_dommap_def def; |
73 | union { | ||
74 | struct cipso_v4_doi *cipsov4; | ||
75 | struct netlbl_domaddr_map *addrsel; | ||
76 | } type_def; | ||
77 | 75 | ||
78 | u32 valid; | 76 | u32 valid; |
79 | struct list_head list; | 77 | struct list_head list; |
@@ -97,16 +95,16 @@ int netlbl_domhsh_remove_af4(const char *domain, | |||
97 | int netlbl_domhsh_remove(const char *domain, struct netlbl_audit *audit_info); | 95 | int netlbl_domhsh_remove(const char *domain, struct netlbl_audit *audit_info); |
98 | int netlbl_domhsh_remove_default(struct netlbl_audit *audit_info); | 96 | int netlbl_domhsh_remove_default(struct netlbl_audit *audit_info); |
99 | struct netlbl_dom_map *netlbl_domhsh_getentry(const char *domain); | 97 | struct netlbl_dom_map *netlbl_domhsh_getentry(const char *domain); |
100 | struct netlbl_domaddr4_map *netlbl_domhsh_getentry_af4(const char *domain, | 98 | struct netlbl_dommap_def *netlbl_domhsh_getentry_af4(const char *domain, |
101 | __be32 addr); | 99 | __be32 addr); |
100 | #if IS_ENABLED(CONFIG_IPV6) | ||
101 | struct netlbl_dommap_def *netlbl_domhsh_getentry_af6(const char *domain, | ||
102 | const struct in6_addr *addr); | ||
103 | #endif /* IPv6 */ | ||
104 | |||
102 | int netlbl_domhsh_walk(u32 *skip_bkt, | 105 | int netlbl_domhsh_walk(u32 *skip_bkt, |
103 | u32 *skip_chain, | 106 | u32 *skip_chain, |
104 | int (*callback) (struct netlbl_dom_map *entry, void *arg), | 107 | int (*callback) (struct netlbl_dom_map *entry, void *arg), |
105 | void *cb_arg); | 108 | void *cb_arg); |
106 | 109 | ||
107 | #if IS_ENABLED(CONFIG_IPV6) | ||
108 | struct netlbl_domaddr6_map *netlbl_domhsh_getentry_af6(const char *domain, | ||
109 | const struct in6_addr *addr); | ||
110 | #endif /* IPv6 */ | ||
111 | |||
112 | #endif | 110 | #endif |
diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c index 7c94aedd0912..96a458e12f60 100644 --- a/net/netlabel/netlabel_kapi.c +++ b/net/netlabel/netlabel_kapi.c | |||
@@ -122,7 +122,7 @@ int netlbl_cfg_unlbl_map_add(const char *domain, | |||
122 | } | 122 | } |
123 | 123 | ||
124 | if (addr == NULL && mask == NULL) | 124 | if (addr == NULL && mask == NULL) |
125 | entry->type = NETLBL_NLTYPE_UNLABELED; | 125 | entry->def.type = NETLBL_NLTYPE_UNLABELED; |
126 | else if (addr != NULL && mask != NULL) { | 126 | else if (addr != NULL && mask != NULL) { |
127 | addrmap = kzalloc(sizeof(*addrmap), GFP_ATOMIC); | 127 | addrmap = kzalloc(sizeof(*addrmap), GFP_ATOMIC); |
128 | if (addrmap == NULL) | 128 | if (addrmap == NULL) |
@@ -137,7 +137,7 @@ int netlbl_cfg_unlbl_map_add(const char *domain, | |||
137 | map4 = kzalloc(sizeof(*map4), GFP_ATOMIC); | 137 | map4 = kzalloc(sizeof(*map4), GFP_ATOMIC); |
138 | if (map4 == NULL) | 138 | if (map4 == NULL) |
139 | goto cfg_unlbl_map_add_failure; | 139 | goto cfg_unlbl_map_add_failure; |
140 | map4->type = NETLBL_NLTYPE_UNLABELED; | 140 | map4->def.type = NETLBL_NLTYPE_UNLABELED; |
141 | map4->list.addr = addr4->s_addr & mask4->s_addr; | 141 | map4->list.addr = addr4->s_addr & mask4->s_addr; |
142 | map4->list.mask = mask4->s_addr; | 142 | map4->list.mask = mask4->s_addr; |
143 | map4->list.valid = 1; | 143 | map4->list.valid = 1; |
@@ -154,7 +154,7 @@ int netlbl_cfg_unlbl_map_add(const char *domain, | |||
154 | map6 = kzalloc(sizeof(*map6), GFP_ATOMIC); | 154 | map6 = kzalloc(sizeof(*map6), GFP_ATOMIC); |
155 | if (map6 == NULL) | 155 | if (map6 == NULL) |
156 | goto cfg_unlbl_map_add_failure; | 156 | goto cfg_unlbl_map_add_failure; |
157 | map6->type = NETLBL_NLTYPE_UNLABELED; | 157 | map6->def.type = NETLBL_NLTYPE_UNLABELED; |
158 | map6->list.addr = *addr6; | 158 | map6->list.addr = *addr6; |
159 | map6->list.addr.s6_addr32[0] &= mask6->s6_addr32[0]; | 159 | map6->list.addr.s6_addr32[0] &= mask6->s6_addr32[0]; |
160 | map6->list.addr.s6_addr32[1] &= mask6->s6_addr32[1]; | 160 | map6->list.addr.s6_addr32[1] &= mask6->s6_addr32[1]; |
@@ -174,8 +174,8 @@ int netlbl_cfg_unlbl_map_add(const char *domain, | |||
174 | break; | 174 | break; |
175 | } | 175 | } |
176 | 176 | ||
177 | entry->type_def.addrsel = addrmap; | 177 | entry->def.addrsel = addrmap; |
178 | entry->type = NETLBL_NLTYPE_ADDRSELECT; | 178 | entry->def.type = NETLBL_NLTYPE_ADDRSELECT; |
179 | } else { | 179 | } else { |
180 | ret_val = -EINVAL; | 180 | ret_val = -EINVAL; |
181 | goto cfg_unlbl_map_add_failure; | 181 | goto cfg_unlbl_map_add_failure; |
@@ -355,8 +355,8 @@ int netlbl_cfg_cipsov4_map_add(u32 doi, | |||
355 | } | 355 | } |
356 | 356 | ||
357 | if (addr == NULL && mask == NULL) { | 357 | if (addr == NULL && mask == NULL) { |
358 | entry->type_def.cipsov4 = doi_def; | 358 | entry->def.cipso = doi_def; |
359 | entry->type = NETLBL_NLTYPE_CIPSOV4; | 359 | entry->def.type = NETLBL_NLTYPE_CIPSOV4; |
360 | } else if (addr != NULL && mask != NULL) { | 360 | } else if (addr != NULL && mask != NULL) { |
361 | addrmap = kzalloc(sizeof(*addrmap), GFP_ATOMIC); | 361 | addrmap = kzalloc(sizeof(*addrmap), GFP_ATOMIC); |
362 | if (addrmap == NULL) | 362 | if (addrmap == NULL) |
@@ -367,8 +367,8 @@ int netlbl_cfg_cipsov4_map_add(u32 doi, | |||
367 | addrinfo = kzalloc(sizeof(*addrinfo), GFP_ATOMIC); | 367 | addrinfo = kzalloc(sizeof(*addrinfo), GFP_ATOMIC); |
368 | if (addrinfo == NULL) | 368 | if (addrinfo == NULL) |
369 | goto out_addrinfo; | 369 | goto out_addrinfo; |
370 | addrinfo->type_def.cipsov4 = doi_def; | 370 | addrinfo->def.cipso = doi_def; |
371 | addrinfo->type = NETLBL_NLTYPE_CIPSOV4; | 371 | addrinfo->def.type = NETLBL_NLTYPE_CIPSOV4; |
372 | addrinfo->list.addr = addr->s_addr & mask->s_addr; | 372 | addrinfo->list.addr = addr->s_addr & mask->s_addr; |
373 | addrinfo->list.mask = mask->s_addr; | 373 | addrinfo->list.mask = mask->s_addr; |
374 | addrinfo->list.valid = 1; | 374 | addrinfo->list.valid = 1; |
@@ -376,8 +376,8 @@ int netlbl_cfg_cipsov4_map_add(u32 doi, | |||
376 | if (ret_val != 0) | 376 | if (ret_val != 0) |
377 | goto cfg_cipsov4_map_add_failure; | 377 | goto cfg_cipsov4_map_add_failure; |
378 | 378 | ||
379 | entry->type_def.addrsel = addrmap; | 379 | entry->def.addrsel = addrmap; |
380 | entry->type = NETLBL_NLTYPE_ADDRSELECT; | 380 | entry->def.type = NETLBL_NLTYPE_ADDRSELECT; |
381 | } else { | 381 | } else { |
382 | ret_val = -EINVAL; | 382 | ret_val = -EINVAL; |
383 | goto out_addrmap; | 383 | goto out_addrmap; |
@@ -657,14 +657,14 @@ int netlbl_sock_setattr(struct sock *sk, | |||
657 | } | 657 | } |
658 | switch (family) { | 658 | switch (family) { |
659 | case AF_INET: | 659 | case AF_INET: |
660 | switch (dom_entry->type) { | 660 | switch (dom_entry->def.type) { |
661 | case NETLBL_NLTYPE_ADDRSELECT: | 661 | case NETLBL_NLTYPE_ADDRSELECT: |
662 | ret_val = -EDESTADDRREQ; | 662 | ret_val = -EDESTADDRREQ; |
663 | break; | 663 | break; |
664 | case NETLBL_NLTYPE_CIPSOV4: | 664 | case NETLBL_NLTYPE_CIPSOV4: |
665 | ret_val = cipso_v4_sock_setattr(sk, | 665 | ret_val = cipso_v4_sock_setattr(sk, |
666 | dom_entry->type_def.cipsov4, | 666 | dom_entry->def.cipso, |
667 | secattr); | 667 | secattr); |
668 | break; | 668 | break; |
669 | case NETLBL_NLTYPE_UNLABELED: | 669 | case NETLBL_NLTYPE_UNLABELED: |
670 | ret_val = 0; | 670 | ret_val = 0; |
@@ -754,23 +754,22 @@ int netlbl_conn_setattr(struct sock *sk, | |||
754 | { | 754 | { |
755 | int ret_val; | 755 | int ret_val; |
756 | struct sockaddr_in *addr4; | 756 | struct sockaddr_in *addr4; |
757 | struct netlbl_domaddr4_map *af4_entry; | 757 | struct netlbl_dommap_def *entry; |
758 | 758 | ||
759 | rcu_read_lock(); | 759 | rcu_read_lock(); |
760 | switch (addr->sa_family) { | 760 | switch (addr->sa_family) { |
761 | case AF_INET: | 761 | case AF_INET: |
762 | addr4 = (struct sockaddr_in *)addr; | 762 | addr4 = (struct sockaddr_in *)addr; |
763 | af4_entry = netlbl_domhsh_getentry_af4(secattr->domain, | 763 | entry = netlbl_domhsh_getentry_af4(secattr->domain, |
764 | addr4->sin_addr.s_addr); | 764 | addr4->sin_addr.s_addr); |
765 | if (af4_entry == NULL) { | 765 | if (entry == NULL) { |
766 | ret_val = -ENOENT; | 766 | ret_val = -ENOENT; |
767 | goto conn_setattr_return; | 767 | goto conn_setattr_return; |
768 | } | 768 | } |
769 | switch (af4_entry->type) { | 769 | switch (entry->type) { |
770 | case NETLBL_NLTYPE_CIPSOV4: | 770 | case NETLBL_NLTYPE_CIPSOV4: |
771 | ret_val = cipso_v4_sock_setattr(sk, | 771 | ret_val = cipso_v4_sock_setattr(sk, |
772 | af4_entry->type_def.cipsov4, | 772 | entry->cipso, secattr); |
773 | secattr); | ||
774 | break; | 773 | break; |
775 | case NETLBL_NLTYPE_UNLABELED: | 774 | case NETLBL_NLTYPE_UNLABELED: |
776 | /* just delete the protocols we support for right now | 775 | /* just delete the protocols we support for right now |
@@ -812,36 +811,21 @@ int netlbl_req_setattr(struct request_sock *req, | |||
812 | const struct netlbl_lsm_secattr *secattr) | 811 | const struct netlbl_lsm_secattr *secattr) |
813 | { | 812 | { |
814 | int ret_val; | 813 | int ret_val; |
815 | struct netlbl_dom_map *dom_entry; | 814 | struct netlbl_dommap_def *entry; |
816 | struct netlbl_domaddr4_map *af4_entry; | ||
817 | u32 proto_type; | ||
818 | struct cipso_v4_doi *proto_cv4; | ||
819 | 815 | ||
820 | rcu_read_lock(); | 816 | rcu_read_lock(); |
821 | dom_entry = netlbl_domhsh_getentry(secattr->domain); | ||
822 | if (dom_entry == NULL) { | ||
823 | ret_val = -ENOENT; | ||
824 | goto req_setattr_return; | ||
825 | } | ||
826 | switch (req->rsk_ops->family) { | 817 | switch (req->rsk_ops->family) { |
827 | case AF_INET: | 818 | case AF_INET: |
828 | if (dom_entry->type == NETLBL_NLTYPE_ADDRSELECT) { | 819 | entry = netlbl_domhsh_getentry_af4(secattr->domain, |
829 | struct inet_request_sock *req_inet = inet_rsk(req); | 820 | inet_rsk(req)->rmt_addr); |
830 | af4_entry = netlbl_domhsh_getentry_af4(secattr->domain, | 821 | if (entry == NULL) { |
831 | req_inet->rmt_addr); | 822 | ret_val = -ENOENT; |
832 | if (af4_entry == NULL) { | 823 | goto req_setattr_return; |
833 | ret_val = -ENOENT; | ||
834 | goto req_setattr_return; | ||
835 | } | ||
836 | proto_type = af4_entry->type; | ||
837 | proto_cv4 = af4_entry->type_def.cipsov4; | ||
838 | } else { | ||
839 | proto_type = dom_entry->type; | ||
840 | proto_cv4 = dom_entry->type_def.cipsov4; | ||
841 | } | 824 | } |
842 | switch (proto_type) { | 825 | switch (entry->type) { |
843 | case NETLBL_NLTYPE_CIPSOV4: | 826 | case NETLBL_NLTYPE_CIPSOV4: |
844 | ret_val = cipso_v4_req_setattr(req, proto_cv4, secattr); | 827 | ret_val = cipso_v4_req_setattr(req, |
828 | entry->cipso, secattr); | ||
845 | break; | 829 | break; |
846 | case NETLBL_NLTYPE_UNLABELED: | 830 | case NETLBL_NLTYPE_UNLABELED: |
847 | /* just delete the protocols we support for right now | 831 | /* just delete the protocols we support for right now |
@@ -899,23 +883,21 @@ int netlbl_skbuff_setattr(struct sk_buff *skb, | |||
899 | { | 883 | { |
900 | int ret_val; | 884 | int ret_val; |
901 | struct iphdr *hdr4; | 885 | struct iphdr *hdr4; |
902 | struct netlbl_domaddr4_map *af4_entry; | 886 | struct netlbl_dommap_def *entry; |
903 | 887 | ||
904 | rcu_read_lock(); | 888 | rcu_read_lock(); |
905 | switch (family) { | 889 | switch (family) { |
906 | case AF_INET: | 890 | case AF_INET: |
907 | hdr4 = ip_hdr(skb); | 891 | hdr4 = ip_hdr(skb); |
908 | af4_entry = netlbl_domhsh_getentry_af4(secattr->domain, | 892 | entry = netlbl_domhsh_getentry_af4(secattr->domain,hdr4->daddr); |
909 | hdr4->daddr); | 893 | if (entry == NULL) { |
910 | if (af4_entry == NULL) { | ||
911 | ret_val = -ENOENT; | 894 | ret_val = -ENOENT; |
912 | goto skbuff_setattr_return; | 895 | goto skbuff_setattr_return; |
913 | } | 896 | } |
914 | switch (af4_entry->type) { | 897 | switch (entry->type) { |
915 | case NETLBL_NLTYPE_CIPSOV4: | 898 | case NETLBL_NLTYPE_CIPSOV4: |
916 | ret_val = cipso_v4_skbuff_setattr(skb, | 899 | ret_val = cipso_v4_skbuff_setattr(skb, entry->cipso, |
917 | af4_entry->type_def.cipsov4, | 900 | secattr); |
918 | secattr); | ||
919 | break; | 901 | break; |
920 | case NETLBL_NLTYPE_UNLABELED: | 902 | case NETLBL_NLTYPE_UNLABELED: |
921 | /* just delete the protocols we support for right now | 903 | /* just delete the protocols we support for right now |
diff --git a/net/netlabel/netlabel_mgmt.c b/net/netlabel/netlabel_mgmt.c index c5384ffc6146..dd1c37d7acbc 100644 --- a/net/netlabel/netlabel_mgmt.c +++ b/net/netlabel/netlabel_mgmt.c | |||
@@ -104,7 +104,7 @@ static int netlbl_mgmt_add_common(struct genl_info *info, | |||
104 | ret_val = -ENOMEM; | 104 | ret_val = -ENOMEM; |
105 | goto add_failure; | 105 | goto add_failure; |
106 | } | 106 | } |
107 | entry->type = nla_get_u32(info->attrs[NLBL_MGMT_A_PROTOCOL]); | 107 | entry->def.type = nla_get_u32(info->attrs[NLBL_MGMT_A_PROTOCOL]); |
108 | if (info->attrs[NLBL_MGMT_A_DOMAIN]) { | 108 | if (info->attrs[NLBL_MGMT_A_DOMAIN]) { |
109 | size_t tmp_size = nla_len(info->attrs[NLBL_MGMT_A_DOMAIN]); | 109 | size_t tmp_size = nla_len(info->attrs[NLBL_MGMT_A_DOMAIN]); |
110 | entry->domain = kmalloc(tmp_size, GFP_KERNEL); | 110 | entry->domain = kmalloc(tmp_size, GFP_KERNEL); |
@@ -116,12 +116,12 @@ static int netlbl_mgmt_add_common(struct genl_info *info, | |||
116 | info->attrs[NLBL_MGMT_A_DOMAIN], tmp_size); | 116 | info->attrs[NLBL_MGMT_A_DOMAIN], tmp_size); |
117 | } | 117 | } |
118 | 118 | ||
119 | /* NOTE: internally we allow/use a entry->type value of | 119 | /* NOTE: internally we allow/use a entry->def.type value of |
120 | * NETLBL_NLTYPE_ADDRSELECT but we don't currently allow users | 120 | * NETLBL_NLTYPE_ADDRSELECT but we don't currently allow users |
121 | * to pass that as a protocol value because we need to know the | 121 | * to pass that as a protocol value because we need to know the |
122 | * "real" protocol */ | 122 | * "real" protocol */ |
123 | 123 | ||
124 | switch (entry->type) { | 124 | switch (entry->def.type) { |
125 | case NETLBL_NLTYPE_UNLABELED: | 125 | case NETLBL_NLTYPE_UNLABELED: |
126 | break; | 126 | break; |
127 | case NETLBL_NLTYPE_CIPSOV4: | 127 | case NETLBL_NLTYPE_CIPSOV4: |
@@ -132,7 +132,7 @@ static int netlbl_mgmt_add_common(struct genl_info *info, | |||
132 | cipsov4 = cipso_v4_doi_getdef(tmp_val); | 132 | cipsov4 = cipso_v4_doi_getdef(tmp_val); |
133 | if (cipsov4 == NULL) | 133 | if (cipsov4 == NULL) |
134 | goto add_failure; | 134 | goto add_failure; |
135 | entry->type_def.cipsov4 = cipsov4; | 135 | entry->def.cipso = cipsov4; |
136 | break; | 136 | break; |
137 | default: | 137 | default: |
138 | goto add_failure; | 138 | goto add_failure; |
@@ -172,9 +172,9 @@ static int netlbl_mgmt_add_common(struct genl_info *info, | |||
172 | map->list.addr = addr->s_addr & mask->s_addr; | 172 | map->list.addr = addr->s_addr & mask->s_addr; |
173 | map->list.mask = mask->s_addr; | 173 | map->list.mask = mask->s_addr; |
174 | map->list.valid = 1; | 174 | map->list.valid = 1; |
175 | map->type = entry->type; | 175 | map->def.type = entry->def.type; |
176 | if (cipsov4) | 176 | if (cipsov4) |
177 | map->type_def.cipsov4 = cipsov4; | 177 | map->def.cipso = cipsov4; |
178 | 178 | ||
179 | ret_val = netlbl_af4list_add(&map->list, &addrmap->list4); | 179 | ret_val = netlbl_af4list_add(&map->list, &addrmap->list4); |
180 | if (ret_val != 0) { | 180 | if (ret_val != 0) { |
@@ -182,8 +182,8 @@ static int netlbl_mgmt_add_common(struct genl_info *info, | |||
182 | goto add_failure; | 182 | goto add_failure; |
183 | } | 183 | } |
184 | 184 | ||
185 | entry->type = NETLBL_NLTYPE_ADDRSELECT; | 185 | entry->def.type = NETLBL_NLTYPE_ADDRSELECT; |
186 | entry->type_def.addrsel = addrmap; | 186 | entry->def.addrsel = addrmap; |
187 | #if IS_ENABLED(CONFIG_IPV6) | 187 | #if IS_ENABLED(CONFIG_IPV6) |
188 | } else if (info->attrs[NLBL_MGMT_A_IPV6ADDR]) { | 188 | } else if (info->attrs[NLBL_MGMT_A_IPV6ADDR]) { |
189 | struct in6_addr *addr; | 189 | struct in6_addr *addr; |
@@ -223,7 +223,7 @@ static int netlbl_mgmt_add_common(struct genl_info *info, | |||
223 | map->list.addr.s6_addr32[3] &= mask->s6_addr32[3]; | 223 | map->list.addr.s6_addr32[3] &= mask->s6_addr32[3]; |
224 | map->list.mask = *mask; | 224 | map->list.mask = *mask; |
225 | map->list.valid = 1; | 225 | map->list.valid = 1; |
226 | map->type = entry->type; | 226 | map->def.type = entry->def.type; |
227 | 227 | ||
228 | ret_val = netlbl_af6list_add(&map->list, &addrmap->list6); | 228 | ret_val = netlbl_af6list_add(&map->list, &addrmap->list6); |
229 | if (ret_val != 0) { | 229 | if (ret_val != 0) { |
@@ -231,8 +231,8 @@ static int netlbl_mgmt_add_common(struct genl_info *info, | |||
231 | goto add_failure; | 231 | goto add_failure; |
232 | } | 232 | } |
233 | 233 | ||
234 | entry->type = NETLBL_NLTYPE_ADDRSELECT; | 234 | entry->def.type = NETLBL_NLTYPE_ADDRSELECT; |
235 | entry->type_def.addrsel = addrmap; | 235 | entry->def.addrsel = addrmap; |
236 | #endif /* IPv6 */ | 236 | #endif /* IPv6 */ |
237 | } | 237 | } |
238 | 238 | ||
@@ -281,14 +281,13 @@ static int netlbl_mgmt_listentry(struct sk_buff *skb, | |||
281 | return ret_val; | 281 | return ret_val; |
282 | } | 282 | } |
283 | 283 | ||
284 | switch (entry->type) { | 284 | switch (entry->def.type) { |
285 | case NETLBL_NLTYPE_ADDRSELECT: | 285 | case NETLBL_NLTYPE_ADDRSELECT: |
286 | nla_a = nla_nest_start(skb, NLBL_MGMT_A_SELECTORLIST); | 286 | nla_a = nla_nest_start(skb, NLBL_MGMT_A_SELECTORLIST); |
287 | if (nla_a == NULL) | 287 | if (nla_a == NULL) |
288 | return -ENOMEM; | 288 | return -ENOMEM; |
289 | 289 | ||
290 | netlbl_af4list_foreach_rcu(iter4, | 290 | netlbl_af4list_foreach_rcu(iter4, &entry->def.addrsel->list4) { |
291 | &entry->type_def.addrsel->list4) { | ||
292 | struct netlbl_domaddr4_map *map4; | 291 | struct netlbl_domaddr4_map *map4; |
293 | struct in_addr addr_struct; | 292 | struct in_addr addr_struct; |
294 | 293 | ||
@@ -310,13 +309,13 @@ static int netlbl_mgmt_listentry(struct sk_buff *skb, | |||
310 | return ret_val; | 309 | return ret_val; |
311 | map4 = netlbl_domhsh_addr4_entry(iter4); | 310 | map4 = netlbl_domhsh_addr4_entry(iter4); |
312 | ret_val = nla_put_u32(skb, NLBL_MGMT_A_PROTOCOL, | 311 | ret_val = nla_put_u32(skb, NLBL_MGMT_A_PROTOCOL, |
313 | map4->type); | 312 | map4->def.type); |
314 | if (ret_val != 0) | 313 | if (ret_val != 0) |
315 | return ret_val; | 314 | return ret_val; |
316 | switch (map4->type) { | 315 | switch (map4->def.type) { |
317 | case NETLBL_NLTYPE_CIPSOV4: | 316 | case NETLBL_NLTYPE_CIPSOV4: |
318 | ret_val = nla_put_u32(skb, NLBL_MGMT_A_CV4DOI, | 317 | ret_val = nla_put_u32(skb, NLBL_MGMT_A_CV4DOI, |
319 | map4->type_def.cipsov4->doi); | 318 | map4->def.cipso->doi); |
320 | if (ret_val != 0) | 319 | if (ret_val != 0) |
321 | return ret_val; | 320 | return ret_val; |
322 | break; | 321 | break; |
@@ -325,8 +324,7 @@ static int netlbl_mgmt_listentry(struct sk_buff *skb, | |||
325 | nla_nest_end(skb, nla_b); | 324 | nla_nest_end(skb, nla_b); |
326 | } | 325 | } |
327 | #if IS_ENABLED(CONFIG_IPV6) | 326 | #if IS_ENABLED(CONFIG_IPV6) |
328 | netlbl_af6list_foreach_rcu(iter6, | 327 | netlbl_af6list_foreach_rcu(iter6, &entry->def.addrsel->list6) { |
329 | &entry->type_def.addrsel->list6) { | ||
330 | struct netlbl_domaddr6_map *map6; | 328 | struct netlbl_domaddr6_map *map6; |
331 | 329 | ||
332 | nla_b = nla_nest_start(skb, NLBL_MGMT_A_ADDRSELECTOR); | 330 | nla_b = nla_nest_start(skb, NLBL_MGMT_A_ADDRSELECTOR); |
@@ -345,7 +343,7 @@ static int netlbl_mgmt_listentry(struct sk_buff *skb, | |||
345 | return ret_val; | 343 | return ret_val; |
346 | map6 = netlbl_domhsh_addr6_entry(iter6); | 344 | map6 = netlbl_domhsh_addr6_entry(iter6); |
347 | ret_val = nla_put_u32(skb, NLBL_MGMT_A_PROTOCOL, | 345 | ret_val = nla_put_u32(skb, NLBL_MGMT_A_PROTOCOL, |
348 | map6->type); | 346 | map6->def.type); |
349 | if (ret_val != 0) | 347 | if (ret_val != 0) |
350 | return ret_val; | 348 | return ret_val; |
351 | 349 | ||
@@ -356,14 +354,14 @@ static int netlbl_mgmt_listentry(struct sk_buff *skb, | |||
356 | nla_nest_end(skb, nla_a); | 354 | nla_nest_end(skb, nla_a); |
357 | break; | 355 | break; |
358 | case NETLBL_NLTYPE_UNLABELED: | 356 | case NETLBL_NLTYPE_UNLABELED: |
359 | ret_val = nla_put_u32(skb, NLBL_MGMT_A_PROTOCOL, entry->type); | 357 | ret_val = nla_put_u32(skb,NLBL_MGMT_A_PROTOCOL,entry->def.type); |
360 | break; | 358 | break; |
361 | case NETLBL_NLTYPE_CIPSOV4: | 359 | case NETLBL_NLTYPE_CIPSOV4: |
362 | ret_val = nla_put_u32(skb, NLBL_MGMT_A_PROTOCOL, entry->type); | 360 | ret_val = nla_put_u32(skb,NLBL_MGMT_A_PROTOCOL,entry->def.type); |
363 | if (ret_val != 0) | 361 | if (ret_val != 0) |
364 | return ret_val; | 362 | return ret_val; |
365 | ret_val = nla_put_u32(skb, NLBL_MGMT_A_CV4DOI, | 363 | ret_val = nla_put_u32(skb, NLBL_MGMT_A_CV4DOI, |
366 | entry->type_def.cipsov4->doi); | 364 | entry->def.cipso->doi); |
367 | break; | 365 | break; |
368 | } | 366 | } |
369 | 367 | ||
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c index af3531926ee0..8f0897407a2c 100644 --- a/net/netlabel/netlabel_unlabeled.c +++ b/net/netlabel/netlabel_unlabeled.c | |||
@@ -1541,7 +1541,7 @@ int __init netlbl_unlabel_defconf(void) | |||
1541 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); | 1541 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); |
1542 | if (entry == NULL) | 1542 | if (entry == NULL) |
1543 | return -ENOMEM; | 1543 | return -ENOMEM; |
1544 | entry->type = NETLBL_NLTYPE_UNLABELED; | 1544 | entry->def.type = NETLBL_NLTYPE_UNLABELED; |
1545 | ret_val = netlbl_domhsh_add_default(entry, &audit_info); | 1545 | ret_val = netlbl_domhsh_add_default(entry, &audit_info); |
1546 | if (ret_val != 0) | 1546 | if (ret_val != 0) |
1547 | return ret_val; | 1547 | return ret_val; |
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 2fd6dbea327a..512718adb0d5 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c | |||
@@ -571,7 +571,7 @@ static int genl_family_rcv_msg(struct genl_family *family, | |||
571 | !capable(CAP_NET_ADMIN)) | 571 | !capable(CAP_NET_ADMIN)) |
572 | return -EPERM; | 572 | return -EPERM; |
573 | 573 | ||
574 | if (nlh->nlmsg_flags & NLM_F_DUMP) { | 574 | if ((nlh->nlmsg_flags & NLM_F_DUMP) == NLM_F_DUMP) { |
575 | struct netlink_dump_control c = { | 575 | struct netlink_dump_control c = { |
576 | .dump = ops->dumpit, | 576 | .dump = ops->dumpit, |
577 | .done = ops->done, | 577 | .done = ops->done, |
@@ -877,8 +877,10 @@ static int ctrl_getfamily(struct sk_buff *skb, struct genl_info *info) | |||
877 | #ifdef CONFIG_MODULES | 877 | #ifdef CONFIG_MODULES |
878 | if (res == NULL) { | 878 | if (res == NULL) { |
879 | genl_unlock(); | 879 | genl_unlock(); |
880 | up_read(&cb_lock); | ||
880 | request_module("net-pf-%d-proto-%d-family-%s", | 881 | request_module("net-pf-%d-proto-%d-family-%s", |
881 | PF_NETLINK, NETLINK_GENERIC, name); | 882 | PF_NETLINK, NETLINK_GENERIC, name); |
883 | down_read(&cb_lock); | ||
882 | genl_lock(); | 884 | genl_lock(); |
883 | res = genl_family_find_byname(name); | 885 | res = genl_family_find_byname(name); |
884 | } | 886 | } |
diff --git a/net/nfc/core.c b/net/nfc/core.c index dc96a83aa6ab..1d074dd1650f 100644 --- a/net/nfc/core.c +++ b/net/nfc/core.c | |||
@@ -44,7 +44,7 @@ DEFINE_MUTEX(nfc_devlist_mutex); | |||
44 | /* NFC device ID bitmap */ | 44 | /* NFC device ID bitmap */ |
45 | static DEFINE_IDA(nfc_index_ida); | 45 | static DEFINE_IDA(nfc_index_ida); |
46 | 46 | ||
47 | int nfc_fw_upload(struct nfc_dev *dev, const char *firmware_name) | 47 | int nfc_fw_download(struct nfc_dev *dev, const char *firmware_name) |
48 | { | 48 | { |
49 | int rc = 0; | 49 | int rc = 0; |
50 | 50 | ||
@@ -62,28 +62,28 @@ int nfc_fw_upload(struct nfc_dev *dev, const char *firmware_name) | |||
62 | goto error; | 62 | goto error; |
63 | } | 63 | } |
64 | 64 | ||
65 | if (!dev->ops->fw_upload) { | 65 | if (!dev->ops->fw_download) { |
66 | rc = -EOPNOTSUPP; | 66 | rc = -EOPNOTSUPP; |
67 | goto error; | 67 | goto error; |
68 | } | 68 | } |
69 | 69 | ||
70 | dev->fw_upload_in_progress = true; | 70 | dev->fw_download_in_progress = true; |
71 | rc = dev->ops->fw_upload(dev, firmware_name); | 71 | rc = dev->ops->fw_download(dev, firmware_name); |
72 | if (rc) | 72 | if (rc) |
73 | dev->fw_upload_in_progress = false; | 73 | dev->fw_download_in_progress = false; |
74 | 74 | ||
75 | error: | 75 | error: |
76 | device_unlock(&dev->dev); | 76 | device_unlock(&dev->dev); |
77 | return rc; | 77 | return rc; |
78 | } | 78 | } |
79 | 79 | ||
80 | int nfc_fw_upload_done(struct nfc_dev *dev, const char *firmware_name) | 80 | int nfc_fw_download_done(struct nfc_dev *dev, const char *firmware_name) |
81 | { | 81 | { |
82 | dev->fw_upload_in_progress = false; | 82 | dev->fw_download_in_progress = false; |
83 | 83 | ||
84 | return nfc_genl_fw_upload_done(dev, firmware_name); | 84 | return nfc_genl_fw_download_done(dev, firmware_name); |
85 | } | 85 | } |
86 | EXPORT_SYMBOL(nfc_fw_upload_done); | 86 | EXPORT_SYMBOL(nfc_fw_download_done); |
87 | 87 | ||
88 | /** | 88 | /** |
89 | * nfc_dev_up - turn on the NFC device | 89 | * nfc_dev_up - turn on the NFC device |
@@ -110,7 +110,7 @@ int nfc_dev_up(struct nfc_dev *dev) | |||
110 | goto error; | 110 | goto error; |
111 | } | 111 | } |
112 | 112 | ||
113 | if (dev->fw_upload_in_progress) { | 113 | if (dev->fw_download_in_progress) { |
114 | rc = -EBUSY; | 114 | rc = -EBUSY; |
115 | goto error; | 115 | goto error; |
116 | } | 116 | } |
diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c index 7b1c186736eb..fe66908401f5 100644 --- a/net/nfc/hci/core.c +++ b/net/nfc/hci/core.c | |||
@@ -809,14 +809,14 @@ static void nfc_hci_recv_from_llc(struct nfc_hci_dev *hdev, struct sk_buff *skb) | |||
809 | } | 809 | } |
810 | } | 810 | } |
811 | 811 | ||
812 | static int hci_fw_upload(struct nfc_dev *nfc_dev, const char *firmware_name) | 812 | static int hci_fw_download(struct nfc_dev *nfc_dev, const char *firmware_name) |
813 | { | 813 | { |
814 | struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); | 814 | struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); |
815 | 815 | ||
816 | if (!hdev->ops->fw_upload) | 816 | if (!hdev->ops->fw_download) |
817 | return -ENOTSUPP; | 817 | return -ENOTSUPP; |
818 | 818 | ||
819 | return hdev->ops->fw_upload(hdev, firmware_name); | 819 | return hdev->ops->fw_download(hdev, firmware_name); |
820 | } | 820 | } |
821 | 821 | ||
822 | static struct nfc_ops hci_nfc_ops = { | 822 | static struct nfc_ops hci_nfc_ops = { |
@@ -831,7 +831,7 @@ static struct nfc_ops hci_nfc_ops = { | |||
831 | .im_transceive = hci_transceive, | 831 | .im_transceive = hci_transceive, |
832 | .tm_send = hci_tm_send, | 832 | .tm_send = hci_tm_send, |
833 | .check_presence = hci_check_presence, | 833 | .check_presence = hci_check_presence, |
834 | .fw_upload = hci_fw_upload, | 834 | .fw_download = hci_fw_download, |
835 | .discover_se = hci_discover_se, | 835 | .discover_se = hci_discover_se, |
836 | .enable_se = hci_enable_se, | 836 | .enable_se = hci_enable_se, |
837 | .disable_se = hci_disable_se, | 837 | .disable_se = hci_disable_se, |
diff --git a/net/nfc/nci/Kconfig b/net/nfc/nci/Kconfig index 2a2416080b4f..a4f1e42e3481 100644 --- a/net/nfc/nci/Kconfig +++ b/net/nfc/nci/Kconfig | |||
@@ -11,6 +11,7 @@ config NFC_NCI | |||
11 | 11 | ||
12 | config NFC_NCI_SPI | 12 | config NFC_NCI_SPI |
13 | depends on NFC_NCI && SPI | 13 | depends on NFC_NCI && SPI |
14 | select CRC_CCITT | ||
14 | bool "NCI over SPI protocol support" | 15 | bool "NCI over SPI protocol support" |
15 | default n | 16 | default n |
16 | help | 17 | help |
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c index b05ad909778f..f16fd59d4160 100644 --- a/net/nfc/netlink.c +++ b/net/nfc/netlink.c | |||
@@ -1089,7 +1089,7 @@ exit: | |||
1089 | return rc; | 1089 | return rc; |
1090 | } | 1090 | } |
1091 | 1091 | ||
1092 | static int nfc_genl_fw_upload(struct sk_buff *skb, struct genl_info *info) | 1092 | static int nfc_genl_fw_download(struct sk_buff *skb, struct genl_info *info) |
1093 | { | 1093 | { |
1094 | struct nfc_dev *dev; | 1094 | struct nfc_dev *dev; |
1095 | int rc; | 1095 | int rc; |
@@ -1108,13 +1108,13 @@ static int nfc_genl_fw_upload(struct sk_buff *skb, struct genl_info *info) | |||
1108 | nla_strlcpy(firmware_name, info->attrs[NFC_ATTR_FIRMWARE_NAME], | 1108 | nla_strlcpy(firmware_name, info->attrs[NFC_ATTR_FIRMWARE_NAME], |
1109 | sizeof(firmware_name)); | 1109 | sizeof(firmware_name)); |
1110 | 1110 | ||
1111 | rc = nfc_fw_upload(dev, firmware_name); | 1111 | rc = nfc_fw_download(dev, firmware_name); |
1112 | 1112 | ||
1113 | nfc_put_device(dev); | 1113 | nfc_put_device(dev); |
1114 | return rc; | 1114 | return rc; |
1115 | } | 1115 | } |
1116 | 1116 | ||
1117 | int nfc_genl_fw_upload_done(struct nfc_dev *dev, const char *firmware_name) | 1117 | int nfc_genl_fw_download_done(struct nfc_dev *dev, const char *firmware_name) |
1118 | { | 1118 | { |
1119 | struct sk_buff *msg; | 1119 | struct sk_buff *msg; |
1120 | void *hdr; | 1120 | void *hdr; |
@@ -1124,7 +1124,7 @@ int nfc_genl_fw_upload_done(struct nfc_dev *dev, const char *firmware_name) | |||
1124 | return -ENOMEM; | 1124 | return -ENOMEM; |
1125 | 1125 | ||
1126 | hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, | 1126 | hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, |
1127 | NFC_CMD_FW_UPLOAD); | 1127 | NFC_CMD_FW_DOWNLOAD); |
1128 | if (!hdr) | 1128 | if (!hdr) |
1129 | goto free_msg; | 1129 | goto free_msg; |
1130 | 1130 | ||
@@ -1251,8 +1251,8 @@ static struct genl_ops nfc_genl_ops[] = { | |||
1251 | .policy = nfc_genl_policy, | 1251 | .policy = nfc_genl_policy, |
1252 | }, | 1252 | }, |
1253 | { | 1253 | { |
1254 | .cmd = NFC_CMD_FW_UPLOAD, | 1254 | .cmd = NFC_CMD_FW_DOWNLOAD, |
1255 | .doit = nfc_genl_fw_upload, | 1255 | .doit = nfc_genl_fw_download, |
1256 | .policy = nfc_genl_policy, | 1256 | .policy = nfc_genl_policy, |
1257 | }, | 1257 | }, |
1258 | { | 1258 | { |
diff --git a/net/nfc/nfc.h b/net/nfc/nfc.h index ee85a1fc1b24..820a7850c36a 100644 --- a/net/nfc/nfc.h +++ b/net/nfc/nfc.h | |||
@@ -123,10 +123,10 @@ static inline void nfc_device_iter_exit(struct class_dev_iter *iter) | |||
123 | class_dev_iter_exit(iter); | 123 | class_dev_iter_exit(iter); |
124 | } | 124 | } |
125 | 125 | ||
126 | int nfc_fw_upload(struct nfc_dev *dev, const char *firmware_name); | 126 | int nfc_fw_download(struct nfc_dev *dev, const char *firmware_name); |
127 | int nfc_genl_fw_upload_done(struct nfc_dev *dev, const char *firmware_name); | 127 | int nfc_genl_fw_download_done(struct nfc_dev *dev, const char *firmware_name); |
128 | 128 | ||
129 | int nfc_fw_upload_done(struct nfc_dev *dev, const char *firmware_name); | 129 | int nfc_fw_download_done(struct nfc_dev *dev, const char *firmware_name); |
130 | 130 | ||
131 | int nfc_dev_up(struct nfc_dev *dev); | 131 | int nfc_dev_up(struct nfc_dev *dev); |
132 | 132 | ||
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c index ca8e0a57d945..1f9c31411f19 100644 --- a/net/sched/sch_atm.c +++ b/net/sched/sch_atm.c | |||
@@ -605,6 +605,7 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl, | |||
605 | struct sockaddr_atmpvc pvc; | 605 | struct sockaddr_atmpvc pvc; |
606 | int state; | 606 | int state; |
607 | 607 | ||
608 | memset(&pvc, 0, sizeof(pvc)); | ||
608 | pvc.sap_family = AF_ATMPVC; | 609 | pvc.sap_family = AF_ATMPVC; |
609 | pvc.sap_addr.itf = flow->vcc->dev ? flow->vcc->dev->number : -1; | 610 | pvc.sap_addr.itf = flow->vcc->dev ? flow->vcc->dev->number : -1; |
610 | pvc.sap_addr.vpi = flow->vcc->vpi; | 611 | pvc.sap_addr.vpi = flow->vcc->vpi; |
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index 71a568862557..7a42c81a19eb 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -1465,6 +1465,7 @@ static int cbq_dump_wrr(struct sk_buff *skb, struct cbq_class *cl) | |||
1465 | unsigned char *b = skb_tail_pointer(skb); | 1465 | unsigned char *b = skb_tail_pointer(skb); |
1466 | struct tc_cbq_wrropt opt; | 1466 | struct tc_cbq_wrropt opt; |
1467 | 1467 | ||
1468 | memset(&opt, 0, sizeof(opt)); | ||
1468 | opt.flags = 0; | 1469 | opt.flags = 0; |
1469 | opt.allot = cl->allot; | 1470 | opt.allot = cl->allot; |
1470 | opt.priority = cl->priority + 1; | 1471 | opt.priority = cl->priority + 1; |
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index c2124ea29f45..45e751527dfc 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -100,7 +100,7 @@ struct htb_class { | |||
100 | struct psched_ratecfg ceil; | 100 | struct psched_ratecfg ceil; |
101 | s64 buffer, cbuffer;/* token bucket depth/rate */ | 101 | s64 buffer, cbuffer;/* token bucket depth/rate */ |
102 | s64 mbuffer; /* max wait time */ | 102 | s64 mbuffer; /* max wait time */ |
103 | int prio; /* these two are used only by leaves... */ | 103 | u32 prio; /* these two are used only by leaves... */ |
104 | int quantum; /* but stored for parent-to-leaf return */ | 104 | int quantum; /* but stored for parent-to-leaf return */ |
105 | 105 | ||
106 | struct tcf_proto *filter_list; /* class attached filters */ | 106 | struct tcf_proto *filter_list; /* class attached filters */ |
diff --git a/net/socket.c b/net/socket.c index 829b460acb87..b2d7c629eeb9 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -106,7 +106,7 @@ | |||
106 | #include <linux/atalk.h> | 106 | #include <linux/atalk.h> |
107 | #include <net/busy_poll.h> | 107 | #include <net/busy_poll.h> |
108 | 108 | ||
109 | #ifdef CONFIG_NET_LL_RX_POLL | 109 | #ifdef CONFIG_NET_RX_BUSY_POLL |
110 | unsigned int sysctl_net_busy_read __read_mostly; | 110 | unsigned int sysctl_net_busy_read __read_mostly; |
111 | unsigned int sysctl_net_busy_poll __read_mostly; | 111 | unsigned int sysctl_net_busy_poll __read_mostly; |
112 | #endif | 112 | #endif |
diff --git a/net/sunrpc/auth_gss/gss_rpc_upcall.c b/net/sunrpc/auth_gss/gss_rpc_upcall.c index d304f41260f2..af7ffd447fee 100644 --- a/net/sunrpc/auth_gss/gss_rpc_upcall.c +++ b/net/sunrpc/auth_gss/gss_rpc_upcall.c | |||
@@ -120,7 +120,7 @@ static int gssp_rpc_create(struct net *net, struct rpc_clnt **_clnt) | |||
120 | if (IS_ERR(clnt)) { | 120 | if (IS_ERR(clnt)) { |
121 | dprintk("RPC: failed to create AF_LOCAL gssproxy " | 121 | dprintk("RPC: failed to create AF_LOCAL gssproxy " |
122 | "client (errno %ld).\n", PTR_ERR(clnt)); | 122 | "client (errno %ld).\n", PTR_ERR(clnt)); |
123 | result = -PTR_ERR(clnt); | 123 | result = PTR_ERR(clnt); |
124 | *_clnt = NULL; | 124 | *_clnt = NULL; |
125 | goto out; | 125 | goto out; |
126 | } | 126 | } |
@@ -328,7 +328,6 @@ void gssp_free_upcall_data(struct gssp_upcall_data *data) | |||
328 | kfree(data->in_handle.data); | 328 | kfree(data->in_handle.data); |
329 | kfree(data->out_handle.data); | 329 | kfree(data->out_handle.data); |
330 | kfree(data->out_token.data); | 330 | kfree(data->out_token.data); |
331 | kfree(data->mech_oid.data); | ||
332 | free_svc_cred(&data->creds); | 331 | free_svc_cred(&data->creds); |
333 | } | 332 | } |
334 | 333 | ||
diff --git a/net/sunrpc/auth_gss/gss_rpc_xdr.c b/net/sunrpc/auth_gss/gss_rpc_xdr.c index 357f613df7ff..3c85d1c8a028 100644 --- a/net/sunrpc/auth_gss/gss_rpc_xdr.c +++ b/net/sunrpc/auth_gss/gss_rpc_xdr.c | |||
@@ -430,7 +430,7 @@ static int dummy_enc_nameattr_array(struct xdr_stream *xdr, | |||
430 | static int dummy_dec_nameattr_array(struct xdr_stream *xdr, | 430 | static int dummy_dec_nameattr_array(struct xdr_stream *xdr, |
431 | struct gssx_name_attr_array *naa) | 431 | struct gssx_name_attr_array *naa) |
432 | { | 432 | { |
433 | struct gssx_name_attr dummy; | 433 | struct gssx_name_attr dummy = { .attr = {.len = 0} }; |
434 | u32 count, i; | 434 | u32 count, i; |
435 | __be32 *p; | 435 | __be32 *p; |
436 | 436 | ||
@@ -493,12 +493,13 @@ static int gssx_enc_name(struct xdr_stream *xdr, | |||
493 | return err; | 493 | return err; |
494 | } | 494 | } |
495 | 495 | ||
496 | |||
496 | static int gssx_dec_name(struct xdr_stream *xdr, | 497 | static int gssx_dec_name(struct xdr_stream *xdr, |
497 | struct gssx_name *name) | 498 | struct gssx_name *name) |
498 | { | 499 | { |
499 | struct xdr_netobj dummy_netobj; | 500 | struct xdr_netobj dummy_netobj = { .len = 0 }; |
500 | struct gssx_name_attr_array dummy_name_attr_array; | 501 | struct gssx_name_attr_array dummy_name_attr_array = { .count = 0 }; |
501 | struct gssx_option_array dummy_option_array; | 502 | struct gssx_option_array dummy_option_array = { .count = 0 }; |
502 | int err; | 503 | int err; |
503 | 504 | ||
504 | /* name->display_name */ | 505 | /* name->display_name */ |
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index d0347d148b34..09fb638bcaa4 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c | |||
@@ -1180,6 +1180,7 @@ static int gss_proxy_save_rsc(struct cache_detail *cd, | |||
1180 | gm = gss_mech_get_by_OID(&ud->mech_oid); | 1180 | gm = gss_mech_get_by_OID(&ud->mech_oid); |
1181 | if (!gm) | 1181 | if (!gm) |
1182 | goto out; | 1182 | goto out; |
1183 | rsci.cred.cr_gss_mech = gm; | ||
1183 | 1184 | ||
1184 | status = -EINVAL; | 1185 | status = -EINVAL; |
1185 | /* mech-specific data: */ | 1186 | /* mech-specific data: */ |
@@ -1195,7 +1196,6 @@ static int gss_proxy_save_rsc(struct cache_detail *cd, | |||
1195 | rscp = rsc_update(cd, &rsci, rscp); | 1196 | rscp = rsc_update(cd, &rsci, rscp); |
1196 | status = 0; | 1197 | status = 0; |
1197 | out: | 1198 | out: |
1198 | gss_mech_put(gm); | ||
1199 | rsc_free(&rsci); | 1199 | rsc_free(&rsci); |
1200 | if (rscp) | 1200 | if (rscp) |
1201 | cache_put(&rscp->h, cd); | 1201 | cache_put(&rscp->h, cd); |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 9963584605c0..74f6a704e374 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -309,6 +309,7 @@ static int rpc_client_register(const struct rpc_create_args *args, | |||
309 | return 0; | 309 | return 0; |
310 | err_auth: | 310 | err_auth: |
311 | pipefs_sb = rpc_get_sb_net(net); | 311 | pipefs_sb = rpc_get_sb_net(net); |
312 | rpc_unregister_client(clnt); | ||
312 | __rpc_clnt_remove_pipedir(clnt); | 313 | __rpc_clnt_remove_pipedir(clnt); |
313 | out: | 314 | out: |
314 | if (pipefs_sb) | 315 | if (pipefs_sb) |
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 0da6785ec15a..9c9caaa5e0d3 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -1193,7 +1193,9 @@ static int svc_tcp_has_wspace(struct svc_xprt *xprt) | |||
1193 | if (test_bit(XPT_LISTENER, &xprt->xpt_flags)) | 1193 | if (test_bit(XPT_LISTENER, &xprt->xpt_flags)) |
1194 | return 1; | 1194 | return 1; |
1195 | required = atomic_read(&xprt->xpt_reserved) + serv->sv_max_mesg; | 1195 | required = atomic_read(&xprt->xpt_reserved) + serv->sv_max_mesg; |
1196 | if (sk_stream_wspace(svsk->sk_sk) >= required) | 1196 | if (sk_stream_wspace(svsk->sk_sk) >= required || |
1197 | (sk_stream_min_wspace(svsk->sk_sk) == 0 && | ||
1198 | atomic_read(&xprt->xpt_reserved) == 0)) | ||
1197 | return 1; | 1199 | return 1; |
1198 | set_bit(SOCK_NOSPACE, &svsk->sk_sock->flags); | 1200 | set_bit(SOCK_NOSPACE, &svsk->sk_sock->flags); |
1199 | return 0; | 1201 | return 0; |
diff --git a/net/tipc/server.c b/net/tipc/server.c index 19da5abe0fa6..fd3fa57a410e 100644 --- a/net/tipc/server.c +++ b/net/tipc/server.c | |||
@@ -355,8 +355,12 @@ static int tipc_open_listening_sock(struct tipc_server *s) | |||
355 | return PTR_ERR(con); | 355 | return PTR_ERR(con); |
356 | 356 | ||
357 | sock = tipc_create_listen_sock(con); | 357 | sock = tipc_create_listen_sock(con); |
358 | if (!sock) | 358 | if (!sock) { |
359 | idr_remove(&s->conn_idr, con->conid); | ||
360 | s->idr_in_use--; | ||
361 | kfree(con); | ||
359 | return -EINVAL; | 362 | return -EINVAL; |
363 | } | ||
360 | 364 | ||
361 | tipc_register_callbacks(sock, con); | 365 | tipc_register_callbacks(sock, con); |
362 | return 0; | 366 | return 0; |
@@ -563,9 +567,14 @@ int tipc_server_start(struct tipc_server *s) | |||
563 | kmem_cache_destroy(s->rcvbuf_cache); | 567 | kmem_cache_destroy(s->rcvbuf_cache); |
564 | return ret; | 568 | return ret; |
565 | } | 569 | } |
570 | ret = tipc_open_listening_sock(s); | ||
571 | if (ret < 0) { | ||
572 | tipc_work_stop(s); | ||
573 | kmem_cache_destroy(s->rcvbuf_cache); | ||
574 | return ret; | ||
575 | } | ||
566 | s->enabled = 1; | 576 | s->enabled = 1; |
567 | 577 | return ret; | |
568 | return tipc_open_listening_sock(s); | ||
569 | } | 578 | } |
570 | 579 | ||
571 | void tipc_server_stop(struct tipc_server *s) | 580 | void tipc_server_stop(struct tipc_server *s) |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 1cc47aca7f05..25d217d90807 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -4770,9 +4770,9 @@ do { \ | |||
4770 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshForwarding, 0, 1, | 4770 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshForwarding, 0, 1, |
4771 | mask, NL80211_MESHCONF_FORWARDING, | 4771 | mask, NL80211_MESHCONF_FORWARDING, |
4772 | nla_get_u8); | 4772 | nla_get_u8); |
4773 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, rssi_threshold, 1, 255, | 4773 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, rssi_threshold, -255, 0, |
4774 | mask, NL80211_MESHCONF_RSSI_THRESHOLD, | 4774 | mask, NL80211_MESHCONF_RSSI_THRESHOLD, |
4775 | nla_get_u32); | 4775 | nla_get_s32); |
4776 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, ht_opmode, 0, 16, | 4776 | FILL_IN_MESH_PARAM_IF_SET(tb, cfg, ht_opmode, 0, 16, |
4777 | mask, NL80211_MESHCONF_HT_OPMODE, | 4777 | mask, NL80211_MESHCONF_HT_OPMODE, |
4778 | nla_get_u16); | 4778 | nla_get_u16); |
@@ -6613,12 +6613,14 @@ EXPORT_SYMBOL(cfg80211_testmode_alloc_event_skb); | |||
6613 | 6613 | ||
6614 | void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp) | 6614 | void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp) |
6615 | { | 6615 | { |
6616 | struct cfg80211_registered_device *rdev = ((void **)skb->cb)[0]; | ||
6616 | void *hdr = ((void **)skb->cb)[1]; | 6617 | void *hdr = ((void **)skb->cb)[1]; |
6617 | struct nlattr *data = ((void **)skb->cb)[2]; | 6618 | struct nlattr *data = ((void **)skb->cb)[2]; |
6618 | 6619 | ||
6619 | nla_nest_end(skb, data); | 6620 | nla_nest_end(skb, data); |
6620 | genlmsg_end(skb, hdr); | 6621 | genlmsg_end(skb, hdr); |
6621 | genlmsg_multicast(skb, 0, nl80211_testmode_mcgrp.id, gfp); | 6622 | genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), skb, 0, |
6623 | nl80211_testmode_mcgrp.id, gfp); | ||
6622 | } | 6624 | } |
6623 | EXPORT_SYMBOL(cfg80211_testmode_event); | 6625 | EXPORT_SYMBOL(cfg80211_testmode_event); |
6624 | #endif | 6626 | #endif |
@@ -10064,7 +10066,8 @@ void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie, | |||
10064 | 10066 | ||
10065 | genlmsg_end(msg, hdr); | 10067 | genlmsg_end(msg, hdr); |
10066 | 10068 | ||
10067 | genlmsg_multicast(msg, 0, nl80211_mlme_mcgrp.id, gfp); | 10069 | genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, |
10070 | nl80211_mlme_mcgrp.id, gfp); | ||
10068 | return; | 10071 | return; |
10069 | 10072 | ||
10070 | nla_put_failure: | 10073 | nla_put_failure: |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 5a24c986f34b..de06d5d1287f 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -2247,10 +2247,13 @@ int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
2247 | 2247 | ||
2248 | void wiphy_regulatory_register(struct wiphy *wiphy) | 2248 | void wiphy_regulatory_register(struct wiphy *wiphy) |
2249 | { | 2249 | { |
2250 | struct regulatory_request *lr; | ||
2251 | |||
2250 | if (!reg_dev_ignore_cell_hint(wiphy)) | 2252 | if (!reg_dev_ignore_cell_hint(wiphy)) |
2251 | reg_num_devs_support_basehint++; | 2253 | reg_num_devs_support_basehint++; |
2252 | 2254 | ||
2253 | wiphy_update_regulatory(wiphy, NL80211_REGDOM_SET_BY_CORE); | 2255 | lr = get_last_request(); |
2256 | wiphy_update_regulatory(wiphy, lr->initiator); | ||
2254 | } | 2257 | } |
2255 | 2258 | ||
2256 | void wiphy_regulatory_deregister(struct wiphy *wiphy) | 2259 | void wiphy_regulatory_deregister(struct wiphy *wiphy) |
@@ -2279,7 +2282,9 @@ void wiphy_regulatory_deregister(struct wiphy *wiphy) | |||
2279 | static void reg_timeout_work(struct work_struct *work) | 2282 | static void reg_timeout_work(struct work_struct *work) |
2280 | { | 2283 | { |
2281 | REG_DBG_PRINT("Timeout while waiting for CRDA to reply, restoring regulatory settings\n"); | 2284 | REG_DBG_PRINT("Timeout while waiting for CRDA to reply, restoring regulatory settings\n"); |
2285 | rtnl_lock(); | ||
2282 | restore_regulatory_settings(true); | 2286 | restore_regulatory_settings(true); |
2287 | rtnl_unlock(); | ||
2283 | } | 2288 | } |
2284 | 2289 | ||
2285 | int __init regulatory_init(void) | 2290 | int __init regulatory_init(void) |
diff --git a/net/wireless/sme.c b/net/wireless/sme.c index 1d3cfb1a3f28..81c8a10d743c 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c | |||
@@ -34,8 +34,10 @@ struct cfg80211_conn { | |||
34 | CFG80211_CONN_SCAN_AGAIN, | 34 | CFG80211_CONN_SCAN_AGAIN, |
35 | CFG80211_CONN_AUTHENTICATE_NEXT, | 35 | CFG80211_CONN_AUTHENTICATE_NEXT, |
36 | CFG80211_CONN_AUTHENTICATING, | 36 | CFG80211_CONN_AUTHENTICATING, |
37 | CFG80211_CONN_AUTH_FAILED, | ||
37 | CFG80211_CONN_ASSOCIATE_NEXT, | 38 | CFG80211_CONN_ASSOCIATE_NEXT, |
38 | CFG80211_CONN_ASSOCIATING, | 39 | CFG80211_CONN_ASSOCIATING, |
40 | CFG80211_CONN_ASSOC_FAILED, | ||
39 | CFG80211_CONN_DEAUTH, | 41 | CFG80211_CONN_DEAUTH, |
40 | CFG80211_CONN_CONNECTED, | 42 | CFG80211_CONN_CONNECTED, |
41 | } state; | 43 | } state; |
@@ -164,6 +166,8 @@ static int cfg80211_conn_do_work(struct wireless_dev *wdev) | |||
164 | NULL, 0, | 166 | NULL, 0, |
165 | params->key, params->key_len, | 167 | params->key, params->key_len, |
166 | params->key_idx, NULL, 0); | 168 | params->key_idx, NULL, 0); |
169 | case CFG80211_CONN_AUTH_FAILED: | ||
170 | return -ENOTCONN; | ||
167 | case CFG80211_CONN_ASSOCIATE_NEXT: | 171 | case CFG80211_CONN_ASSOCIATE_NEXT: |
168 | BUG_ON(!rdev->ops->assoc); | 172 | BUG_ON(!rdev->ops->assoc); |
169 | wdev->conn->state = CFG80211_CONN_ASSOCIATING; | 173 | wdev->conn->state = CFG80211_CONN_ASSOCIATING; |
@@ -188,10 +192,17 @@ static int cfg80211_conn_do_work(struct wireless_dev *wdev) | |||
188 | WLAN_REASON_DEAUTH_LEAVING, | 192 | WLAN_REASON_DEAUTH_LEAVING, |
189 | false); | 193 | false); |
190 | return err; | 194 | return err; |
195 | case CFG80211_CONN_ASSOC_FAILED: | ||
196 | cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid, | ||
197 | NULL, 0, | ||
198 | WLAN_REASON_DEAUTH_LEAVING, false); | ||
199 | return -ENOTCONN; | ||
191 | case CFG80211_CONN_DEAUTH: | 200 | case CFG80211_CONN_DEAUTH: |
192 | cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid, | 201 | cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid, |
193 | NULL, 0, | 202 | NULL, 0, |
194 | WLAN_REASON_DEAUTH_LEAVING, false); | 203 | WLAN_REASON_DEAUTH_LEAVING, false); |
204 | /* free directly, disconnected event already sent */ | ||
205 | cfg80211_sme_free(wdev); | ||
195 | return 0; | 206 | return 0; |
196 | default: | 207 | default: |
197 | return 0; | 208 | return 0; |
@@ -371,7 +382,7 @@ bool cfg80211_sme_rx_assoc_resp(struct wireless_dev *wdev, u16 status) | |||
371 | return true; | 382 | return true; |
372 | } | 383 | } |
373 | 384 | ||
374 | wdev->conn->state = CFG80211_CONN_DEAUTH; | 385 | wdev->conn->state = CFG80211_CONN_ASSOC_FAILED; |
375 | schedule_work(&rdev->conn_work); | 386 | schedule_work(&rdev->conn_work); |
376 | return false; | 387 | return false; |
377 | } | 388 | } |
@@ -383,7 +394,13 @@ void cfg80211_sme_deauth(struct wireless_dev *wdev) | |||
383 | 394 | ||
384 | void cfg80211_sme_auth_timeout(struct wireless_dev *wdev) | 395 | void cfg80211_sme_auth_timeout(struct wireless_dev *wdev) |
385 | { | 396 | { |
386 | cfg80211_sme_free(wdev); | 397 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); |
398 | |||
399 | if (!wdev->conn) | ||
400 | return; | ||
401 | |||
402 | wdev->conn->state = CFG80211_CONN_AUTH_FAILED; | ||
403 | schedule_work(&rdev->conn_work); | ||
387 | } | 404 | } |
388 | 405 | ||
389 | void cfg80211_sme_disassoc(struct wireless_dev *wdev) | 406 | void cfg80211_sme_disassoc(struct wireless_dev *wdev) |
@@ -399,7 +416,13 @@ void cfg80211_sme_disassoc(struct wireless_dev *wdev) | |||
399 | 416 | ||
400 | void cfg80211_sme_assoc_timeout(struct wireless_dev *wdev) | 417 | void cfg80211_sme_assoc_timeout(struct wireless_dev *wdev) |
401 | { | 418 | { |
402 | cfg80211_sme_disassoc(wdev); | 419 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); |
420 | |||
421 | if (!wdev->conn) | ||
422 | return; | ||
423 | |||
424 | wdev->conn->state = CFG80211_CONN_ASSOC_FAILED; | ||
425 | schedule_work(&rdev->conn_work); | ||
403 | } | 426 | } |
404 | 427 | ||
405 | static int cfg80211_sme_connect(struct wireless_dev *wdev, | 428 | static int cfg80211_sme_connect(struct wireless_dev *wdev, |