diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-08-03 18:00:23 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-08-03 18:00:23 -0400 |
commit | 72a67a94bcba71a5fddd6b3596a20604d2b5dcd6 (patch) | |
tree | c16021b2e216d126cbf62301362fd1115a628438 /net | |
parent | 83aaf3b39c4f26d71a58f84924b6c6f9b1070d54 (diff) | |
parent | 4bd8e7385961932d863ea976a67f384c3a8302cb (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller:
1) Don't ignore user initiated wireless regulatory settings on cards
with custom regulatory domains, from Arik Nemtsov.
2) Fix length check of bluetooth information responses, from Jaganath
Kanakkassery.
3) Fix misuse of PTR_ERR in btusb, from Adam Lee.
4) Handle rfkill properly while iwlwifi devices are offline, from
Emmanuel Grumbach.
5) Fix r815x devices DMA'ing to stack buffers, from Hayes Wang.
6) Kernel info leak in ATM packet scheduler, from Dan Carpenter.
7) 8139cp doesn't check for DMA mapping errors, from Neil Horman.
8) Fix bridge multicast code to not snoop when no querier exists,
otherwise mutlicast traffic is lost. From Linus Lüssing.
9) Avoid soft lockups in fib6_run_gc(), from Michal Kubecek.
10) Fix races in automatic address asignment on ipv6, which can result
in incorrect lifetime assignments. From Jiri Benc.
11) Cure build bustage when CONFIG_NET_LL_RX_POLL is not set and rename
it CONFIG_NET_RX_BUSY_POLL to eliminate the last reference to the
original naming of this feature. From Cong Wang.
12) Fix crash in TIPC when server socket creation fails, from Ying Xue.
13) macvlan_changelink() silently succeeds when it shouldn't, from
Michael S Tsirkin.
14) HTB packet scheduler can crash due to sign extension, fix from
Stephen Hemminger.
15) With the cable unplugged, r8169 prints out a message every 10
seconds, make it netif_dbg() instead of netif_warn(). From Peter
Wu.
16) Fix memory leak in rtm_to_ifaddr(), from Daniel Borkmann.
17) sis900 gets spurious TX queue timeouts due to mismanagement of link
carrier state, from Denis Kirjanov.
18) Validate somaxconn sysctl to make sure it fits inside of a u16.
From Roman Gushchin.
19) Fix MAC address filtering on qlcnic, from Shahed Shaikh.
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (68 commits)
qlcnic: Fix for flash update failure on 83xx adapter
qlcnic: Fix link speed and duplex display for 83xx adapter
qlcnic: Fix link speed display for 82xx adapter
qlcnic: Fix external loopback test.
qlcnic: Removed adapter series name from warning messages.
qlcnic: Free up memory in error path.
qlcnic: Fix ingress MAC learning
qlcnic: Fix MAC address filter issue on 82xx adapter
net: ethernet: davinci_emac: drop IRQF_DISABLED
netlabel: use domain based selectors when address based selectors are not available
net: check net.core.somaxconn sysctl values
sis900: Fix the tx queue timeout issue
net: rtm_to_ifaddr: free ifa if ifa_cacheinfo processing fails
r8169: remove "PHY reset until link up" log spam
net: ethernet: cpsw: drop IRQF_DISABLED
htb: fix sign extension bug
macvlan: handle set_promiscuity failures
macvlan: better mode validation
tipc: fix oops when creating server socket fails
net: rename CONFIG_NET_LL_RX_POLL to CONFIG_NET_RX_BUSY_POLL
...
Diffstat (limited to 'net')
32 files changed, 299 insertions, 257 deletions
diff --git a/net/Kconfig b/net/Kconfig index 37702491abe9..2b406608a1a4 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 2ef66781fedb..69363bd37f64 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 4b99c9a27044..61c5e819380e 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -1014,6 +1014,16 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br, | |||
1014 | } | 1014 | } |
1015 | #endif | 1015 | #endif |
1016 | 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 | |||
1017 | /* | 1027 | /* |
1018 | * Add port to router_list | 1028 | * Add port to router_list |
1019 | * list is maintained ordered by pointer value | 1029 | * list is maintained ordered by pointer value |
@@ -1064,11 +1074,11 @@ timer: | |||
1064 | 1074 | ||
1065 | static void br_multicast_query_received(struct net_bridge *br, | 1075 | static void br_multicast_query_received(struct net_bridge *br, |
1066 | struct net_bridge_port *port, | 1076 | struct net_bridge_port *port, |
1067 | int saddr) | 1077 | int saddr, |
1078 | unsigned long max_delay) | ||
1068 | { | 1079 | { |
1069 | if (saddr) | 1080 | if (saddr) |
1070 | mod_timer(&br->multicast_querier_timer, | 1081 | br_multicast_update_querier_timer(br, max_delay); |
1071 | jiffies + br->multicast_querier_interval); | ||
1072 | else if (timer_pending(&br->multicast_querier_timer)) | 1082 | else if (timer_pending(&br->multicast_querier_timer)) |
1073 | return; | 1083 | return; |
1074 | 1084 | ||
@@ -1096,8 +1106,6 @@ static int br_ip4_multicast_query(struct net_bridge *br, | |||
1096 | (port && port->state == BR_STATE_DISABLED)) | 1106 | (port && port->state == BR_STATE_DISABLED)) |
1097 | goto out; | 1107 | goto out; |
1098 | 1108 | ||
1099 | br_multicast_query_received(br, port, !!iph->saddr); | ||
1100 | |||
1101 | group = ih->group; | 1109 | group = ih->group; |
1102 | 1110 | ||
1103 | if (skb->len == sizeof(*ih)) { | 1111 | if (skb->len == sizeof(*ih)) { |
@@ -1121,6 +1129,8 @@ static int br_ip4_multicast_query(struct net_bridge *br, | |||
1121 | IGMPV3_MRC(ih3->code) * (HZ / IGMP_TIMER_SCALE) : 1; | 1129 | IGMPV3_MRC(ih3->code) * (HZ / IGMP_TIMER_SCALE) : 1; |
1122 | } | 1130 | } |
1123 | 1131 | ||
1132 | br_multicast_query_received(br, port, !!iph->saddr, max_delay); | ||
1133 | |||
1124 | if (!group) | 1134 | if (!group) |
1125 | goto out; | 1135 | goto out; |
1126 | 1136 | ||
@@ -1176,8 +1186,6 @@ static int br_ip6_multicast_query(struct net_bridge *br, | |||
1176 | (port && port->state == BR_STATE_DISABLED)) | 1186 | (port && port->state == BR_STATE_DISABLED)) |
1177 | goto out; | 1187 | goto out; |
1178 | 1188 | ||
1179 | br_multicast_query_received(br, port, !ipv6_addr_any(&ip6h->saddr)); | ||
1180 | |||
1181 | if (skb->len == sizeof(*mld)) { | 1189 | if (skb->len == sizeof(*mld)) { |
1182 | if (!pskb_may_pull(skb, sizeof(*mld))) { | 1190 | if (!pskb_may_pull(skb, sizeof(*mld))) { |
1183 | err = -EINVAL; | 1191 | err = -EINVAL; |
@@ -1198,6 +1206,9 @@ static int br_ip6_multicast_query(struct net_bridge *br, | |||
1198 | 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; |
1199 | } | 1207 | } |
1200 | 1208 | ||
1209 | br_multicast_query_received(br, port, !ipv6_addr_any(&ip6h->saddr), | ||
1210 | max_delay); | ||
1211 | |||
1201 | if (!group) | 1212 | if (!group) |
1202 | goto out; | 1213 | goto out; |
1203 | 1214 | ||
@@ -1643,6 +1654,8 @@ void br_multicast_init(struct net_bridge *br) | |||
1643 | br->multicast_querier_interval = 255 * HZ; | 1654 | br->multicast_querier_interval = 255 * HZ; |
1644 | br->multicast_membership_interval = 260 * HZ; | 1655 | br->multicast_membership_interval = 260 * HZ; |
1645 | 1656 | ||
1657 | br->multicast_querier_delay_time = 0; | ||
1658 | |||
1646 | spin_lock_init(&br->multicast_lock); | 1659 | spin_lock_init(&br->multicast_lock); |
1647 | setup_timer(&br->multicast_router_timer, | 1660 | setup_timer(&br->multicast_router_timer, |
1648 | br_multicast_local_router_expired, 0); | 1661 | br_multicast_local_router_expired, 0); |
@@ -1831,6 +1844,8 @@ unlock: | |||
1831 | 1844 | ||
1832 | 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) |
1833 | { | 1846 | { |
1847 | unsigned long max_delay; | ||
1848 | |||
1834 | val = !!val; | 1849 | val = !!val; |
1835 | 1850 | ||
1836 | spin_lock_bh(&br->multicast_lock); | 1851 | spin_lock_bh(&br->multicast_lock); |
@@ -1838,8 +1853,14 @@ int br_multicast_set_querier(struct net_bridge *br, unsigned long val) | |||
1838 | goto unlock; | 1853 | goto unlock; |
1839 | 1854 | ||
1840 | br->multicast_querier = val; | 1855 | br->multicast_querier = val; |
1841 | if (val) | 1856 | if (!val) |
1842 | 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); | ||
1843 | 1864 | ||
1844 | unlock: | 1865 | unlock: |
1845 | 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 3be89b3ce17b..2f7da41851bf 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; |
@@ -501,6 +502,13 @@ static inline bool br_multicast_is_router(struct net_bridge *br) | |||
501 | (br->multicast_router == 1 && | 502 | (br->multicast_router == 1 && |
502 | timer_pending(&br->multicast_router_timer)); | 503 | timer_pending(&br->multicast_router_timer)); |
503 | } | 504 | } |
505 | |||
506 | static inline bool br_multicast_querier_exists(struct net_bridge *br) | ||
507 | { | ||
508 | return time_is_before_jiffies(br->multicast_querier_delay_time) && | ||
509 | (br->multicast_querier || | ||
510 | timer_pending(&br->multicast_querier_timer)); | ||
511 | } | ||
504 | #else | 512 | #else |
505 | static inline int br_multicast_rcv(struct net_bridge *br, | 513 | static inline int br_multicast_rcv(struct net_bridge *br, |
506 | struct net_bridge_port *port, | 514 | struct net_bridge_port *port, |
@@ -557,6 +565,10 @@ static inline bool br_multicast_is_router(struct net_bridge *br) | |||
557 | { | 565 | { |
558 | return 0; | 566 | return 0; |
559 | } | 567 | } |
568 | static inline bool br_multicast_querier_exists(struct net_bridge *br) | ||
569 | { | ||
570 | return false; | ||
571 | } | ||
560 | static inline void br_mdb_init(void) | 572 | static inline void br_mdb_init(void) |
561 | { | 573 | { |
562 | } | 574 | } |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 3df4d4ccf440..2c3d0f53d198 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -740,7 +740,7 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old) | |||
740 | 740 | ||
741 | skb_copy_secmark(new, old); | 741 | skb_copy_secmark(new, old); |
742 | 742 | ||
743 | #ifdef CONFIG_NET_LL_RX_POLL | 743 | #ifdef CONFIG_NET_RX_BUSY_POLL |
744 | new->napi_id = old->napi_id; | 744 | new->napi_id = old->napi_id; |
745 | #endif | 745 | #endif |
746 | } | 746 | } |
diff --git a/net/core/sock.c b/net/core/sock.c index 548d716c5f62..2c097c5a35dd 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -900,7 +900,7 @@ set_rcvbuf: | |||
900 | sock_valbool_flag(sk, SOCK_SELECT_ERR_QUEUE, valbool); | 900 | sock_valbool_flag(sk, SOCK_SELECT_ERR_QUEUE, valbool); |
901 | break; | 901 | break; |
902 | 902 | ||
903 | #ifdef CONFIG_NET_LL_RX_POLL | 903 | #ifdef CONFIG_NET_RX_BUSY_POLL |
904 | case SO_BUSY_POLL: | 904 | case SO_BUSY_POLL: |
905 | /* allow unprivileged users to decrease the value */ | 905 | /* allow unprivileged users to decrease the value */ |
906 | if ((val > sk->sk_ll_usec) && !capable(CAP_NET_ADMIN)) | 906 | if ((val > sk->sk_ll_usec) && !capable(CAP_NET_ADMIN)) |
@@ -1170,7 +1170,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, | |||
1170 | v.val = sock_flag(sk, SOCK_SELECT_ERR_QUEUE); | 1170 | v.val = sock_flag(sk, SOCK_SELECT_ERR_QUEUE); |
1171 | break; | 1171 | break; |
1172 | 1172 | ||
1173 | #ifdef CONFIG_NET_LL_RX_POLL | 1173 | #ifdef CONFIG_NET_RX_BUSY_POLL |
1174 | case SO_BUSY_POLL: | 1174 | case SO_BUSY_POLL: |
1175 | v.val = sk->sk_ll_usec; | 1175 | v.val = sk->sk_ll_usec; |
1176 | break; | 1176 | break; |
@@ -2292,7 +2292,7 @@ void sock_init_data(struct socket *sock, struct sock *sk) | |||
2292 | 2292 | ||
2293 | sk->sk_stamp = ktime_set(-1L, 0); | 2293 | sk->sk_stamp = ktime_set(-1L, 0); |
2294 | 2294 | ||
2295 | #ifdef CONFIG_NET_LL_RX_POLL | 2295 | #ifdef CONFIG_NET_RX_BUSY_POLL |
2296 | sk->sk_napi_id = 0; | 2296 | sk->sk_napi_id = 0; |
2297 | sk->sk_ll_usec = sysctl_net_busy_read; | 2297 | sk->sk_ll_usec = sysctl_net_busy_read; |
2298 | #endif | 2298 | #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 8d48c392adcc..34ca6d5a3a4b 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/ipv6/addrconf.c b/net/ipv6/addrconf.c index cfdcf7b2daf6..da4241c8c7da 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 5fc9c7a68d8d..bff3d821c7eb 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/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 a8c891aa2464..b70f8979003b 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -1311,7 +1311,6 @@ static void icmp6_clean_all(int (*func)(struct rt6_info *rt, void *arg), | |||
1311 | 1311 | ||
1312 | static int ip6_dst_gc(struct dst_ops *ops) | 1312 | static int ip6_dst_gc(struct dst_ops *ops) |
1313 | { | 1313 | { |
1314 | unsigned long now = jiffies; | ||
1315 | struct net *net = container_of(ops, struct net, ipv6.ip6_dst_ops); | 1314 | struct net *net = container_of(ops, struct net, ipv6.ip6_dst_ops); |
1316 | int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval; | 1315 | int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval; |
1317 | int rt_max_size = net->ipv6.sysctl.ip6_rt_max_size; | 1316 | int rt_max_size = net->ipv6.sysctl.ip6_rt_max_size; |
@@ -1321,13 +1320,12 @@ static int ip6_dst_gc(struct dst_ops *ops) | |||
1321 | int entries; | 1320 | int entries; |
1322 | 1321 | ||
1323 | entries = dst_entries_get_fast(ops); | 1322 | entries = dst_entries_get_fast(ops); |
1324 | if (time_after(rt_last_gc + rt_min_interval, now) && | 1323 | if (time_after(rt_last_gc + rt_min_interval, jiffies) && |
1325 | entries <= rt_max_size) | 1324 | entries <= rt_max_size) |
1326 | goto out; | 1325 | goto out; |
1327 | 1326 | ||
1328 | net->ipv6.ip6_rt_gc_expire++; | 1327 | net->ipv6.ip6_rt_gc_expire++; |
1329 | fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net); | 1328 | fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net, entries > rt_max_size); |
1330 | net->ipv6.ip6_rt_last_gc = now; | ||
1331 | entries = dst_entries_get_slow(ops); | 1329 | entries = dst_entries_get_slow(ops); |
1332 | if (entries < ops->gc_thresh) | 1330 | if (entries < ops->gc_thresh) |
1333 | net->ipv6.ip6_rt_gc_expire = rt_gc_timeout>>1; | 1331 | net->ipv6.ip6_rt_gc_expire = rt_gc_timeout>>1; |
@@ -2827,7 +2825,7 @@ int ipv6_sysctl_rtcache_flush(struct ctl_table *ctl, int write, | |||
2827 | net = (struct net *)ctl->extra1; | 2825 | net = (struct net *)ctl->extra1; |
2828 | delay = net->ipv6.sysctl.flush_delay; | 2826 | delay = net->ipv6.sysctl.flush_delay; |
2829 | proc_dointvec(ctl, write, buffer, lenp, ppos); | 2827 | proc_dointvec(ctl, write, buffer, lenp, ppos); |
2830 | fib6_run_gc(delay <= 0 ? ~0UL : (unsigned long)delay, net); | 2828 | fib6_run_gc(delay <= 0 ? 0 : (unsigned long)delay, net, delay > 0); |
2831 | return 0; | 2829 | return 0; |
2832 | } | 2830 | } |
2833 | 2831 | ||
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/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/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_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/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/reg.c b/net/wireless/reg.c index 5a950f36bae4..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) |