diff options
Diffstat (limited to 'net')
80 files changed, 646 insertions, 502 deletions
diff --git a/net/802/garp.c b/net/802/garp.c index 8e21b6db3981..a5c224830439 100644 --- a/net/802/garp.c +++ b/net/802/garp.c | |||
@@ -167,7 +167,8 @@ static struct garp_attr *garp_attr_lookup(const struct garp_applicant *app, | |||
167 | return NULL; | 167 | return NULL; |
168 | } | 168 | } |
169 | 169 | ||
170 | static void garp_attr_insert(struct garp_applicant *app, struct garp_attr *new) | 170 | static struct garp_attr *garp_attr_create(struct garp_applicant *app, |
171 | const void *data, u8 len, u8 type) | ||
171 | { | 172 | { |
172 | struct rb_node *parent = NULL, **p = &app->gid.rb_node; | 173 | struct rb_node *parent = NULL, **p = &app->gid.rb_node; |
173 | struct garp_attr *attr; | 174 | struct garp_attr *attr; |
@@ -176,21 +177,16 @@ static void garp_attr_insert(struct garp_applicant *app, struct garp_attr *new) | |||
176 | while (*p) { | 177 | while (*p) { |
177 | parent = *p; | 178 | parent = *p; |
178 | attr = rb_entry(parent, struct garp_attr, node); | 179 | attr = rb_entry(parent, struct garp_attr, node); |
179 | d = garp_attr_cmp(attr, new->data, new->dlen, new->type); | 180 | d = garp_attr_cmp(attr, data, len, type); |
180 | if (d < 0) | 181 | if (d < 0) |
181 | p = &parent->rb_left; | 182 | p = &parent->rb_left; |
182 | else if (d > 0) | 183 | else if (d > 0) |
183 | p = &parent->rb_right; | 184 | p = &parent->rb_right; |
185 | else { | ||
186 | /* The attribute already exists; re-use it. */ | ||
187 | return attr; | ||
188 | } | ||
184 | } | 189 | } |
185 | rb_link_node(&new->node, parent, p); | ||
186 | rb_insert_color(&new->node, &app->gid); | ||
187 | } | ||
188 | |||
189 | static struct garp_attr *garp_attr_create(struct garp_applicant *app, | ||
190 | const void *data, u8 len, u8 type) | ||
191 | { | ||
192 | struct garp_attr *attr; | ||
193 | |||
194 | attr = kmalloc(sizeof(*attr) + len, GFP_ATOMIC); | 190 | attr = kmalloc(sizeof(*attr) + len, GFP_ATOMIC); |
195 | if (!attr) | 191 | if (!attr) |
196 | return attr; | 192 | return attr; |
@@ -198,7 +194,9 @@ static struct garp_attr *garp_attr_create(struct garp_applicant *app, | |||
198 | attr->type = type; | 194 | attr->type = type; |
199 | attr->dlen = len; | 195 | attr->dlen = len; |
200 | memcpy(attr->data, data, len); | 196 | memcpy(attr->data, data, len); |
201 | garp_attr_insert(app, attr); | 197 | |
198 | rb_link_node(&attr->node, parent, p); | ||
199 | rb_insert_color(&attr->node, &app->gid); | ||
202 | return attr; | 200 | return attr; |
203 | } | 201 | } |
204 | 202 | ||
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 0906c194a413..9d9a6a3edbd5 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c | |||
@@ -2011,16 +2011,17 @@ static void __exit ax25_exit(void) | |||
2011 | proc_net_remove(&init_net, "ax25_route"); | 2011 | proc_net_remove(&init_net, "ax25_route"); |
2012 | proc_net_remove(&init_net, "ax25"); | 2012 | proc_net_remove(&init_net, "ax25"); |
2013 | proc_net_remove(&init_net, "ax25_calls"); | 2013 | proc_net_remove(&init_net, "ax25_calls"); |
2014 | ax25_rt_free(); | ||
2015 | ax25_uid_free(); | ||
2016 | ax25_dev_free(); | ||
2017 | 2014 | ||
2018 | ax25_unregister_sysctl(); | ||
2019 | unregister_netdevice_notifier(&ax25_dev_notifier); | 2015 | unregister_netdevice_notifier(&ax25_dev_notifier); |
2016 | ax25_unregister_sysctl(); | ||
2020 | 2017 | ||
2021 | dev_remove_pack(&ax25_packet_type); | 2018 | dev_remove_pack(&ax25_packet_type); |
2022 | 2019 | ||
2023 | sock_unregister(PF_AX25); | 2020 | sock_unregister(PF_AX25); |
2024 | proto_unregister(&ax25_proto); | 2021 | proto_unregister(&ax25_proto); |
2022 | |||
2023 | ax25_rt_free(); | ||
2024 | ax25_uid_free(); | ||
2025 | ax25_dev_free(); | ||
2025 | } | 2026 | } |
2026 | module_exit(ax25_exit); | 2027 | module_exit(ax25_exit); |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index e33af63a884a..edfd61addcec 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -665,6 +665,11 @@ int hci_dev_open(__u16 dev) | |||
665 | 665 | ||
666 | hci_req_lock(hdev); | 666 | hci_req_lock(hdev); |
667 | 667 | ||
668 | if (test_bit(HCI_UNREGISTER, &hdev->dev_flags)) { | ||
669 | ret = -ENODEV; | ||
670 | goto done; | ||
671 | } | ||
672 | |||
668 | if (hdev->rfkill && rfkill_blocked(hdev->rfkill)) { | 673 | if (hdev->rfkill && rfkill_blocked(hdev->rfkill)) { |
669 | ret = -ERFKILL; | 674 | ret = -ERFKILL; |
670 | goto done; | 675 | goto done; |
@@ -1210,40 +1215,40 @@ struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr) | |||
1210 | return NULL; | 1215 | return NULL; |
1211 | } | 1216 | } |
1212 | 1217 | ||
1213 | static int hci_persistent_key(struct hci_dev *hdev, struct hci_conn *conn, | 1218 | static bool hci_persistent_key(struct hci_dev *hdev, struct hci_conn *conn, |
1214 | u8 key_type, u8 old_key_type) | 1219 | u8 key_type, u8 old_key_type) |
1215 | { | 1220 | { |
1216 | /* Legacy key */ | 1221 | /* Legacy key */ |
1217 | if (key_type < 0x03) | 1222 | if (key_type < 0x03) |
1218 | return 1; | 1223 | return true; |
1219 | 1224 | ||
1220 | /* Debug keys are insecure so don't store them persistently */ | 1225 | /* Debug keys are insecure so don't store them persistently */ |
1221 | if (key_type == HCI_LK_DEBUG_COMBINATION) | 1226 | if (key_type == HCI_LK_DEBUG_COMBINATION) |
1222 | return 0; | 1227 | return false; |
1223 | 1228 | ||
1224 | /* Changed combination key and there's no previous one */ | 1229 | /* Changed combination key and there's no previous one */ |
1225 | if (key_type == HCI_LK_CHANGED_COMBINATION && old_key_type == 0xff) | 1230 | if (key_type == HCI_LK_CHANGED_COMBINATION && old_key_type == 0xff) |
1226 | return 0; | 1231 | return false; |
1227 | 1232 | ||
1228 | /* Security mode 3 case */ | 1233 | /* Security mode 3 case */ |
1229 | if (!conn) | 1234 | if (!conn) |
1230 | return 1; | 1235 | return true; |
1231 | 1236 | ||
1232 | /* Neither local nor remote side had no-bonding as requirement */ | 1237 | /* Neither local nor remote side had no-bonding as requirement */ |
1233 | if (conn->auth_type > 0x01 && conn->remote_auth > 0x01) | 1238 | if (conn->auth_type > 0x01 && conn->remote_auth > 0x01) |
1234 | return 1; | 1239 | return true; |
1235 | 1240 | ||
1236 | /* Local side had dedicated bonding as requirement */ | 1241 | /* Local side had dedicated bonding as requirement */ |
1237 | if (conn->auth_type == 0x02 || conn->auth_type == 0x03) | 1242 | if (conn->auth_type == 0x02 || conn->auth_type == 0x03) |
1238 | return 1; | 1243 | return true; |
1239 | 1244 | ||
1240 | /* Remote side had dedicated bonding as requirement */ | 1245 | /* Remote side had dedicated bonding as requirement */ |
1241 | if (conn->remote_auth == 0x02 || conn->remote_auth == 0x03) | 1246 | if (conn->remote_auth == 0x02 || conn->remote_auth == 0x03) |
1242 | return 1; | 1247 | return true; |
1243 | 1248 | ||
1244 | /* If none of the above criteria match, then don't store the key | 1249 | /* If none of the above criteria match, then don't store the key |
1245 | * persistently */ | 1250 | * persistently */ |
1246 | return 0; | 1251 | return false; |
1247 | } | 1252 | } |
1248 | 1253 | ||
1249 | struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]) | 1254 | struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]) |
@@ -1280,7 +1285,8 @@ int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, | |||
1280 | bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len) | 1285 | bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len) |
1281 | { | 1286 | { |
1282 | struct link_key *key, *old_key; | 1287 | struct link_key *key, *old_key; |
1283 | u8 old_key_type, persistent; | 1288 | u8 old_key_type; |
1289 | bool persistent; | ||
1284 | 1290 | ||
1285 | old_key = hci_find_link_key(hdev, bdaddr); | 1291 | old_key = hci_find_link_key(hdev, bdaddr); |
1286 | if (old_key) { | 1292 | if (old_key) { |
@@ -1323,10 +1329,8 @@ int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, | |||
1323 | 1329 | ||
1324 | mgmt_new_link_key(hdev, key, persistent); | 1330 | mgmt_new_link_key(hdev, key, persistent); |
1325 | 1331 | ||
1326 | if (!persistent) { | 1332 | if (conn) |
1327 | list_del(&key->list); | 1333 | conn->flush_key = !persistent; |
1328 | kfree(key); | ||
1329 | } | ||
1330 | 1334 | ||
1331 | return 0; | 1335 | return 0; |
1332 | } | 1336 | } |
@@ -1849,6 +1853,8 @@ void hci_unregister_dev(struct hci_dev *hdev) | |||
1849 | 1853 | ||
1850 | BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); | 1854 | BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); |
1851 | 1855 | ||
1856 | set_bit(HCI_UNREGISTER, &hdev->dev_flags); | ||
1857 | |||
1852 | write_lock(&hci_dev_list_lock); | 1858 | write_lock(&hci_dev_list_lock); |
1853 | list_del(&hdev->list); | 1859 | list_del(&hdev->list); |
1854 | write_unlock(&hci_dev_list_lock); | 1860 | write_unlock(&hci_dev_list_lock); |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index b37531094c49..6c065254afc0 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -1901,6 +1901,8 @@ static inline void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff | |||
1901 | } | 1901 | } |
1902 | 1902 | ||
1903 | if (ev->status == 0) { | 1903 | if (ev->status == 0) { |
1904 | if (conn->type == ACL_LINK && conn->flush_key) | ||
1905 | hci_remove_link_key(hdev, &conn->dst); | ||
1904 | hci_proto_disconn_cfm(conn, ev->reason); | 1906 | hci_proto_disconn_cfm(conn, ev->reason); |
1905 | hci_conn_del(conn); | 1907 | hci_conn_del(conn); |
1906 | } | 1908 | } |
@@ -2311,6 +2313,7 @@ static inline void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *sk | |||
2311 | 2313 | ||
2312 | case HCI_OP_USER_PASSKEY_NEG_REPLY: | 2314 | case HCI_OP_USER_PASSKEY_NEG_REPLY: |
2313 | hci_cc_user_passkey_neg_reply(hdev, skb); | 2315 | hci_cc_user_passkey_neg_reply(hdev, skb); |
2316 | break; | ||
2314 | 2317 | ||
2315 | case HCI_OP_LE_SET_SCAN_PARAM: | 2318 | case HCI_OP_LE_SET_SCAN_PARAM: |
2316 | hci_cc_le_set_scan_param(hdev, skb); | 2319 | hci_cc_le_set_scan_param(hdev, skb); |
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index b8e17e4dac8b..94552b33d528 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -1308,6 +1308,7 @@ static void l2cap_monitor_timeout(struct work_struct *work) | |||
1308 | if (chan->retry_count >= chan->remote_max_tx) { | 1308 | if (chan->retry_count >= chan->remote_max_tx) { |
1309 | l2cap_send_disconn_req(chan->conn, chan, ECONNABORTED); | 1309 | l2cap_send_disconn_req(chan->conn, chan, ECONNABORTED); |
1310 | l2cap_chan_unlock(chan); | 1310 | l2cap_chan_unlock(chan); |
1311 | l2cap_chan_put(chan); | ||
1311 | return; | 1312 | return; |
1312 | } | 1313 | } |
1313 | 1314 | ||
@@ -1316,6 +1317,7 @@ static void l2cap_monitor_timeout(struct work_struct *work) | |||
1316 | 1317 | ||
1317 | l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_POLL); | 1318 | l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_POLL); |
1318 | l2cap_chan_unlock(chan); | 1319 | l2cap_chan_unlock(chan); |
1320 | l2cap_chan_put(chan); | ||
1319 | } | 1321 | } |
1320 | 1322 | ||
1321 | static void l2cap_retrans_timeout(struct work_struct *work) | 1323 | static void l2cap_retrans_timeout(struct work_struct *work) |
@@ -1335,6 +1337,7 @@ static void l2cap_retrans_timeout(struct work_struct *work) | |||
1335 | l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_POLL); | 1337 | l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_POLL); |
1336 | 1338 | ||
1337 | l2cap_chan_unlock(chan); | 1339 | l2cap_chan_unlock(chan); |
1340 | l2cap_chan_put(chan); | ||
1338 | } | 1341 | } |
1339 | 1342 | ||
1340 | static void l2cap_drop_acked_frames(struct l2cap_chan *chan) | 1343 | static void l2cap_drop_acked_frames(struct l2cap_chan *chan) |
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index c4fe583b0af6..29122ed28ea9 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c | |||
@@ -82,7 +82,7 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) | |||
82 | } | 82 | } |
83 | 83 | ||
84 | if (la.l2_cid) | 84 | if (la.l2_cid) |
85 | err = l2cap_add_scid(chan, la.l2_cid); | 85 | err = l2cap_add_scid(chan, __le16_to_cpu(la.l2_cid)); |
86 | else | 86 | else |
87 | err = l2cap_add_psm(chan, &la.l2_bdaddr, la.l2_psm); | 87 | err = l2cap_add_psm(chan, &la.l2_bdaddr, la.l2_psm); |
88 | 88 | ||
@@ -123,7 +123,8 @@ static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int al | |||
123 | if (la.l2_cid && la.l2_psm) | 123 | if (la.l2_cid && la.l2_psm) |
124 | return -EINVAL; | 124 | return -EINVAL; |
125 | 125 | ||
126 | err = l2cap_chan_connect(chan, la.l2_psm, la.l2_cid, &la.l2_bdaddr); | 126 | err = l2cap_chan_connect(chan, la.l2_psm, __le16_to_cpu(la.l2_cid), |
127 | &la.l2_bdaddr); | ||
127 | if (err) | 128 | if (err) |
128 | return err; | 129 | return err; |
129 | 130 | ||
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 7fcff8887131..4bb03b111122 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -2523,13 +2523,18 @@ static int set_fast_connectable(struct sock *sk, struct hci_dev *hdev, | |||
2523 | 2523 | ||
2524 | if (cp->val) { | 2524 | if (cp->val) { |
2525 | type = PAGE_SCAN_TYPE_INTERLACED; | 2525 | type = PAGE_SCAN_TYPE_INTERLACED; |
2526 | acp.interval = 0x0024; /* 22.5 msec page scan interval */ | 2526 | |
2527 | /* 22.5 msec page scan interval */ | ||
2528 | acp.interval = __constant_cpu_to_le16(0x0024); | ||
2527 | } else { | 2529 | } else { |
2528 | type = PAGE_SCAN_TYPE_STANDARD; /* default */ | 2530 | type = PAGE_SCAN_TYPE_STANDARD; /* default */ |
2529 | acp.interval = 0x0800; /* default 1.28 sec page scan */ | 2531 | |
2532 | /* default 1.28 sec page scan */ | ||
2533 | acp.interval = __constant_cpu_to_le16(0x0800); | ||
2530 | } | 2534 | } |
2531 | 2535 | ||
2532 | acp.window = 0x0012; /* default 11.25 msec page scan window */ | 2536 | /* default 11.25 msec page scan window */ |
2537 | acp.window = __constant_cpu_to_le16(0x0012); | ||
2533 | 2538 | ||
2534 | err = hci_send_cmd(hdev, HCI_OP_WRITE_PAGE_SCAN_ACTIVITY, sizeof(acp), | 2539 | err = hci_send_cmd(hdev, HCI_OP_WRITE_PAGE_SCAN_ACTIVITY, sizeof(acp), |
2535 | &acp); | 2540 | &acp); |
@@ -2879,7 +2884,7 @@ int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status) | |||
2879 | return 0; | 2884 | return 0; |
2880 | } | 2885 | } |
2881 | 2886 | ||
2882 | int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, u8 persistent) | 2887 | int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, bool persistent) |
2883 | { | 2888 | { |
2884 | struct mgmt_ev_new_link_key ev; | 2889 | struct mgmt_ev_new_link_key ev; |
2885 | 2890 | ||
@@ -2936,7 +2941,7 @@ int mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | |||
2936 | name, name_len); | 2941 | name, name_len); |
2937 | 2942 | ||
2938 | if (dev_class && memcmp(dev_class, "\0\0\0", 3) != 0) | 2943 | if (dev_class && memcmp(dev_class, "\0\0\0", 3) != 0) |
2939 | eir_len = eir_append_data(&ev->eir[eir_len], eir_len, | 2944 | eir_len = eir_append_data(ev->eir, eir_len, |
2940 | EIR_CLASS_OF_DEV, dev_class, 3); | 2945 | EIR_CLASS_OF_DEV, dev_class, 3); |
2941 | 2946 | ||
2942 | put_unaligned_le16(eir_len, &ev->eir_len); | 2947 | put_unaligned_le16(eir_len, &ev->eir_len); |
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c index 61f65344e711..a2098e3de500 100644 --- a/net/bridge/br_forward.c +++ b/net/bridge/br_forward.c | |||
@@ -47,6 +47,7 @@ int br_dev_queue_push_xmit(struct sk_buff *skb) | |||
47 | kfree_skb(skb); | 47 | kfree_skb(skb); |
48 | } else { | 48 | } else { |
49 | skb_push(skb, ETH_HLEN); | 49 | skb_push(skb, ETH_HLEN); |
50 | br_drop_fake_rtable(skb); | ||
50 | dev_queue_xmit(skb); | 51 | dev_queue_xmit(skb); |
51 | } | 52 | } |
52 | 53 | ||
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 702a1ae9220b..27ca25ed7021 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -241,7 +241,6 @@ static void br_multicast_group_expired(unsigned long data) | |||
241 | hlist_del_rcu(&mp->hlist[mdb->ver]); | 241 | hlist_del_rcu(&mp->hlist[mdb->ver]); |
242 | mdb->size--; | 242 | mdb->size--; |
243 | 243 | ||
244 | del_timer(&mp->query_timer); | ||
245 | call_rcu_bh(&mp->rcu, br_multicast_free_group); | 244 | call_rcu_bh(&mp->rcu, br_multicast_free_group); |
246 | 245 | ||
247 | out: | 246 | out: |
@@ -271,7 +270,6 @@ static void br_multicast_del_pg(struct net_bridge *br, | |||
271 | rcu_assign_pointer(*pp, p->next); | 270 | rcu_assign_pointer(*pp, p->next); |
272 | hlist_del_init(&p->mglist); | 271 | hlist_del_init(&p->mglist); |
273 | del_timer(&p->timer); | 272 | del_timer(&p->timer); |
274 | del_timer(&p->query_timer); | ||
275 | call_rcu_bh(&p->rcu, br_multicast_free_pg); | 273 | call_rcu_bh(&p->rcu, br_multicast_free_pg); |
276 | 274 | ||
277 | if (!mp->ports && !mp->mglist && | 275 | if (!mp->ports && !mp->mglist && |
@@ -507,74 +505,6 @@ static struct sk_buff *br_multicast_alloc_query(struct net_bridge *br, | |||
507 | return NULL; | 505 | return NULL; |
508 | } | 506 | } |
509 | 507 | ||
510 | static void br_multicast_send_group_query(struct net_bridge_mdb_entry *mp) | ||
511 | { | ||
512 | struct net_bridge *br = mp->br; | ||
513 | struct sk_buff *skb; | ||
514 | |||
515 | skb = br_multicast_alloc_query(br, &mp->addr); | ||
516 | if (!skb) | ||
517 | goto timer; | ||
518 | |||
519 | netif_rx(skb); | ||
520 | |||
521 | timer: | ||
522 | if (++mp->queries_sent < br->multicast_last_member_count) | ||
523 | mod_timer(&mp->query_timer, | ||
524 | jiffies + br->multicast_last_member_interval); | ||
525 | } | ||
526 | |||
527 | static void br_multicast_group_query_expired(unsigned long data) | ||
528 | { | ||
529 | struct net_bridge_mdb_entry *mp = (void *)data; | ||
530 | struct net_bridge *br = mp->br; | ||
531 | |||
532 | spin_lock(&br->multicast_lock); | ||
533 | if (!netif_running(br->dev) || !mp->mglist || | ||
534 | mp->queries_sent >= br->multicast_last_member_count) | ||
535 | goto out; | ||
536 | |||
537 | br_multicast_send_group_query(mp); | ||
538 | |||
539 | out: | ||
540 | spin_unlock(&br->multicast_lock); | ||
541 | } | ||
542 | |||
543 | static void br_multicast_send_port_group_query(struct net_bridge_port_group *pg) | ||
544 | { | ||
545 | struct net_bridge_port *port = pg->port; | ||
546 | struct net_bridge *br = port->br; | ||
547 | struct sk_buff *skb; | ||
548 | |||
549 | skb = br_multicast_alloc_query(br, &pg->addr); | ||
550 | if (!skb) | ||
551 | goto timer; | ||
552 | |||
553 | br_deliver(port, skb); | ||
554 | |||
555 | timer: | ||
556 | if (++pg->queries_sent < br->multicast_last_member_count) | ||
557 | mod_timer(&pg->query_timer, | ||
558 | jiffies + br->multicast_last_member_interval); | ||
559 | } | ||
560 | |||
561 | static void br_multicast_port_group_query_expired(unsigned long data) | ||
562 | { | ||
563 | struct net_bridge_port_group *pg = (void *)data; | ||
564 | struct net_bridge_port *port = pg->port; | ||
565 | struct net_bridge *br = port->br; | ||
566 | |||
567 | spin_lock(&br->multicast_lock); | ||
568 | if (!netif_running(br->dev) || hlist_unhashed(&pg->mglist) || | ||
569 | pg->queries_sent >= br->multicast_last_member_count) | ||
570 | goto out; | ||
571 | |||
572 | br_multicast_send_port_group_query(pg); | ||
573 | |||
574 | out: | ||
575 | spin_unlock(&br->multicast_lock); | ||
576 | } | ||
577 | |||
578 | static struct net_bridge_mdb_entry *br_multicast_get_group( | 508 | static struct net_bridge_mdb_entry *br_multicast_get_group( |
579 | struct net_bridge *br, struct net_bridge_port *port, | 509 | struct net_bridge *br, struct net_bridge_port *port, |
580 | struct br_ip *group, int hash) | 510 | struct br_ip *group, int hash) |
@@ -690,8 +620,6 @@ rehash: | |||
690 | mp->addr = *group; | 620 | mp->addr = *group; |
691 | setup_timer(&mp->timer, br_multicast_group_expired, | 621 | setup_timer(&mp->timer, br_multicast_group_expired, |
692 | (unsigned long)mp); | 622 | (unsigned long)mp); |
693 | setup_timer(&mp->query_timer, br_multicast_group_query_expired, | ||
694 | (unsigned long)mp); | ||
695 | 623 | ||
696 | hlist_add_head_rcu(&mp->hlist[mdb->ver], &mdb->mhash[hash]); | 624 | hlist_add_head_rcu(&mp->hlist[mdb->ver], &mdb->mhash[hash]); |
697 | mdb->size++; | 625 | mdb->size++; |
@@ -746,8 +674,6 @@ static int br_multicast_add_group(struct net_bridge *br, | |||
746 | hlist_add_head(&p->mglist, &port->mglist); | 674 | hlist_add_head(&p->mglist, &port->mglist); |
747 | setup_timer(&p->timer, br_multicast_port_group_expired, | 675 | setup_timer(&p->timer, br_multicast_port_group_expired, |
748 | (unsigned long)p); | 676 | (unsigned long)p); |
749 | setup_timer(&p->query_timer, br_multicast_port_group_query_expired, | ||
750 | (unsigned long)p); | ||
751 | 677 | ||
752 | rcu_assign_pointer(*pp, p); | 678 | rcu_assign_pointer(*pp, p); |
753 | 679 | ||
@@ -1291,9 +1217,6 @@ static void br_multicast_leave_group(struct net_bridge *br, | |||
1291 | time_after(mp->timer.expires, time) : | 1217 | time_after(mp->timer.expires, time) : |
1292 | try_to_del_timer_sync(&mp->timer) >= 0)) { | 1218 | try_to_del_timer_sync(&mp->timer) >= 0)) { |
1293 | mod_timer(&mp->timer, time); | 1219 | mod_timer(&mp->timer, time); |
1294 | |||
1295 | mp->queries_sent = 0; | ||
1296 | mod_timer(&mp->query_timer, now); | ||
1297 | } | 1220 | } |
1298 | 1221 | ||
1299 | goto out; | 1222 | goto out; |
@@ -1310,9 +1233,6 @@ static void br_multicast_leave_group(struct net_bridge *br, | |||
1310 | time_after(p->timer.expires, time) : | 1233 | time_after(p->timer.expires, time) : |
1311 | try_to_del_timer_sync(&p->timer) >= 0)) { | 1234 | try_to_del_timer_sync(&p->timer) >= 0)) { |
1312 | mod_timer(&p->timer, time); | 1235 | mod_timer(&p->timer, time); |
1313 | |||
1314 | p->queries_sent = 0; | ||
1315 | mod_timer(&p->query_timer, now); | ||
1316 | } | 1236 | } |
1317 | 1237 | ||
1318 | break; | 1238 | break; |
@@ -1681,7 +1601,6 @@ void br_multicast_stop(struct net_bridge *br) | |||
1681 | hlist_for_each_entry_safe(mp, p, n, &mdb->mhash[i], | 1601 | hlist_for_each_entry_safe(mp, p, n, &mdb->mhash[i], |
1682 | hlist[ver]) { | 1602 | hlist[ver]) { |
1683 | del_timer(&mp->timer); | 1603 | del_timer(&mp->timer); |
1684 | del_timer(&mp->query_timer); | ||
1685 | call_rcu_bh(&mp->rcu, br_multicast_free_group); | 1604 | call_rcu_bh(&mp->rcu, br_multicast_free_group); |
1686 | } | 1605 | } |
1687 | } | 1606 | } |
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index dec4f3817133..d7f49b63ab0f 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
@@ -156,7 +156,7 @@ void br_netfilter_rtable_init(struct net_bridge *br) | |||
156 | rt->dst.dev = br->dev; | 156 | rt->dst.dev = br->dev; |
157 | rt->dst.path = &rt->dst; | 157 | rt->dst.path = &rt->dst; |
158 | dst_init_metrics(&rt->dst, br_dst_default_metrics, true); | 158 | dst_init_metrics(&rt->dst, br_dst_default_metrics, true); |
159 | rt->dst.flags = DST_NOXFRM | DST_NOPEER; | 159 | rt->dst.flags = DST_NOXFRM | DST_NOPEER | DST_FAKE_RTABLE; |
160 | rt->dst.ops = &fake_dst_ops; | 160 | rt->dst.ops = &fake_dst_ops; |
161 | } | 161 | } |
162 | 162 | ||
@@ -694,11 +694,7 @@ static unsigned int br_nf_local_in(unsigned int hook, struct sk_buff *skb, | |||
694 | const struct net_device *out, | 694 | const struct net_device *out, |
695 | int (*okfn)(struct sk_buff *)) | 695 | int (*okfn)(struct sk_buff *)) |
696 | { | 696 | { |
697 | struct rtable *rt = skb_rtable(skb); | 697 | br_drop_fake_rtable(skb); |
698 | |||
699 | if (rt && rt == bridge_parent_rtable(in)) | ||
700 | skb_dst_drop(skb); | ||
701 | |||
702 | return NF_ACCEPT; | 698 | return NF_ACCEPT; |
703 | } | 699 | } |
704 | 700 | ||
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 0b67a63ad7a8..e1d882257877 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h | |||
@@ -82,9 +82,7 @@ struct net_bridge_port_group { | |||
82 | struct hlist_node mglist; | 82 | struct hlist_node mglist; |
83 | struct rcu_head rcu; | 83 | struct rcu_head rcu; |
84 | struct timer_list timer; | 84 | struct timer_list timer; |
85 | struct timer_list query_timer; | ||
86 | struct br_ip addr; | 85 | struct br_ip addr; |
87 | u32 queries_sent; | ||
88 | }; | 86 | }; |
89 | 87 | ||
90 | struct net_bridge_mdb_entry | 88 | struct net_bridge_mdb_entry |
@@ -94,10 +92,8 @@ struct net_bridge_mdb_entry | |||
94 | struct net_bridge_port_group __rcu *ports; | 92 | struct net_bridge_port_group __rcu *ports; |
95 | struct rcu_head rcu; | 93 | struct rcu_head rcu; |
96 | struct timer_list timer; | 94 | struct timer_list timer; |
97 | struct timer_list query_timer; | ||
98 | struct br_ip addr; | 95 | struct br_ip addr; |
99 | bool mglist; | 96 | bool mglist; |
100 | u32 queries_sent; | ||
101 | }; | 97 | }; |
102 | 98 | ||
103 | struct net_bridge_mdb_htable | 99 | struct net_bridge_mdb_htable |
diff --git a/net/caif/chnl_net.c b/net/caif/chnl_net.c index 20618dd3088b..d09340e1523f 100644 --- a/net/caif/chnl_net.c +++ b/net/caif/chnl_net.c | |||
@@ -103,6 +103,7 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt) | |||
103 | skb->protocol = htons(ETH_P_IPV6); | 103 | skb->protocol = htons(ETH_P_IPV6); |
104 | break; | 104 | break; |
105 | default: | 105 | default: |
106 | kfree_skb(skb); | ||
106 | priv->netdev->stats.rx_errors++; | 107 | priv->netdev->stats.rx_errors++; |
107 | return -EINVAL; | 108 | return -EINVAL; |
108 | } | 109 | } |
@@ -220,14 +221,16 @@ static int chnl_net_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
220 | 221 | ||
221 | if (skb->len > priv->netdev->mtu) { | 222 | if (skb->len > priv->netdev->mtu) { |
222 | pr_warn("Size of skb exceeded MTU\n"); | 223 | pr_warn("Size of skb exceeded MTU\n"); |
224 | kfree_skb(skb); | ||
223 | dev->stats.tx_errors++; | 225 | dev->stats.tx_errors++; |
224 | return -ENOSPC; | 226 | return NETDEV_TX_OK; |
225 | } | 227 | } |
226 | 228 | ||
227 | if (!priv->flowenabled) { | 229 | if (!priv->flowenabled) { |
228 | pr_debug("dropping packets flow off\n"); | 230 | pr_debug("dropping packets flow off\n"); |
231 | kfree_skb(skb); | ||
229 | dev->stats.tx_dropped++; | 232 | dev->stats.tx_dropped++; |
230 | return NETDEV_TX_BUSY; | 233 | return NETDEV_TX_OK; |
231 | } | 234 | } |
232 | 235 | ||
233 | if (priv->conn_req.protocol == CAIFPROTO_DATAGRAM_LOOP) | 236 | if (priv->conn_req.protocol == CAIFPROTO_DATAGRAM_LOOP) |
@@ -242,7 +245,7 @@ static int chnl_net_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
242 | result = priv->chnl.dn->transmit(priv->chnl.dn, pkt); | 245 | result = priv->chnl.dn->transmit(priv->chnl.dn, pkt); |
243 | if (result) { | 246 | if (result) { |
244 | dev->stats.tx_dropped++; | 247 | dev->stats.tx_dropped++; |
245 | return result; | 248 | return NETDEV_TX_OK; |
246 | } | 249 | } |
247 | 250 | ||
248 | /* Update statistics. */ | 251 | /* Update statistics. */ |
diff --git a/net/core/dev.c b/net/core/dev.c index 5d59155adf2a..9bb8f87c4cda 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1409,14 +1409,34 @@ EXPORT_SYMBOL(register_netdevice_notifier); | |||
1409 | * register_netdevice_notifier(). The notifier is unlinked into the | 1409 | * register_netdevice_notifier(). The notifier is unlinked into the |
1410 | * kernel structures and may then be reused. A negative errno code | 1410 | * kernel structures and may then be reused. A negative errno code |
1411 | * is returned on a failure. | 1411 | * is returned on a failure. |
1412 | * | ||
1413 | * After unregistering unregister and down device events are synthesized | ||
1414 | * for all devices on the device list to the removed notifier to remove | ||
1415 | * the need for special case cleanup code. | ||
1412 | */ | 1416 | */ |
1413 | 1417 | ||
1414 | int unregister_netdevice_notifier(struct notifier_block *nb) | 1418 | int unregister_netdevice_notifier(struct notifier_block *nb) |
1415 | { | 1419 | { |
1420 | struct net_device *dev; | ||
1421 | struct net *net; | ||
1416 | int err; | 1422 | int err; |
1417 | 1423 | ||
1418 | rtnl_lock(); | 1424 | rtnl_lock(); |
1419 | err = raw_notifier_chain_unregister(&netdev_chain, nb); | 1425 | err = raw_notifier_chain_unregister(&netdev_chain, nb); |
1426 | if (err) | ||
1427 | goto unlock; | ||
1428 | |||
1429 | for_each_net(net) { | ||
1430 | for_each_netdev(net, dev) { | ||
1431 | if (dev->flags & IFF_UP) { | ||
1432 | nb->notifier_call(nb, NETDEV_GOING_DOWN, dev); | ||
1433 | nb->notifier_call(nb, NETDEV_DOWN, dev); | ||
1434 | } | ||
1435 | nb->notifier_call(nb, NETDEV_UNREGISTER, dev); | ||
1436 | nb->notifier_call(nb, NETDEV_UNREGISTER_BATCH, dev); | ||
1437 | } | ||
1438 | } | ||
1439 | unlock: | ||
1420 | rtnl_unlock(); | 1440 | rtnl_unlock(); |
1421 | return err; | 1441 | return err; |
1422 | } | 1442 | } |
@@ -1596,6 +1616,7 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb) | |||
1596 | kfree_skb(skb); | 1616 | kfree_skb(skb); |
1597 | return NET_RX_DROP; | 1617 | return NET_RX_DROP; |
1598 | } | 1618 | } |
1619 | skb->skb_iif = 0; | ||
1599 | skb_set_dev(skb, dev); | 1620 | skb_set_dev(skb, dev); |
1600 | skb->tstamp.tv64 = 0; | 1621 | skb->tstamp.tv64 = 0; |
1601 | skb->pkt_type = PACKET_HOST; | 1622 | skb->pkt_type = PACKET_HOST; |
@@ -4027,54 +4048,41 @@ static int dev_ifconf(struct net *net, char __user *arg) | |||
4027 | 4048 | ||
4028 | #ifdef CONFIG_PROC_FS | 4049 | #ifdef CONFIG_PROC_FS |
4029 | 4050 | ||
4030 | #define BUCKET_SPACE (32 - NETDEV_HASHBITS) | 4051 | #define BUCKET_SPACE (32 - NETDEV_HASHBITS - 1) |
4031 | |||
4032 | struct dev_iter_state { | ||
4033 | struct seq_net_private p; | ||
4034 | unsigned int pos; /* bucket << BUCKET_SPACE + offset */ | ||
4035 | }; | ||
4036 | 4052 | ||
4037 | #define get_bucket(x) ((x) >> BUCKET_SPACE) | 4053 | #define get_bucket(x) ((x) >> BUCKET_SPACE) |
4038 | #define get_offset(x) ((x) & ((1 << BUCKET_SPACE) - 1)) | 4054 | #define get_offset(x) ((x) & ((1 << BUCKET_SPACE) - 1)) |
4039 | #define set_bucket_offset(b, o) ((b) << BUCKET_SPACE | (o)) | 4055 | #define set_bucket_offset(b, o) ((b) << BUCKET_SPACE | (o)) |
4040 | 4056 | ||
4041 | static inline struct net_device *dev_from_same_bucket(struct seq_file *seq) | 4057 | static inline struct net_device *dev_from_same_bucket(struct seq_file *seq, loff_t *pos) |
4042 | { | 4058 | { |
4043 | struct dev_iter_state *state = seq->private; | ||
4044 | struct net *net = seq_file_net(seq); | 4059 | struct net *net = seq_file_net(seq); |
4045 | struct net_device *dev; | 4060 | struct net_device *dev; |
4046 | struct hlist_node *p; | 4061 | struct hlist_node *p; |
4047 | struct hlist_head *h; | 4062 | struct hlist_head *h; |
4048 | unsigned int count, bucket, offset; | 4063 | unsigned int count = 0, offset = get_offset(*pos); |
4049 | 4064 | ||
4050 | bucket = get_bucket(state->pos); | 4065 | h = &net->dev_name_head[get_bucket(*pos)]; |
4051 | offset = get_offset(state->pos); | ||
4052 | h = &net->dev_name_head[bucket]; | ||
4053 | count = 0; | ||
4054 | hlist_for_each_entry_rcu(dev, p, h, name_hlist) { | 4066 | hlist_for_each_entry_rcu(dev, p, h, name_hlist) { |
4055 | if (count++ == offset) { | 4067 | if (++count == offset) |
4056 | state->pos = set_bucket_offset(bucket, count); | ||
4057 | return dev; | 4068 | return dev; |
4058 | } | ||
4059 | } | 4069 | } |
4060 | 4070 | ||
4061 | return NULL; | 4071 | return NULL; |
4062 | } | 4072 | } |
4063 | 4073 | ||
4064 | static inline struct net_device *dev_from_new_bucket(struct seq_file *seq) | 4074 | static inline struct net_device *dev_from_bucket(struct seq_file *seq, loff_t *pos) |
4065 | { | 4075 | { |
4066 | struct dev_iter_state *state = seq->private; | ||
4067 | struct net_device *dev; | 4076 | struct net_device *dev; |
4068 | unsigned int bucket; | 4077 | unsigned int bucket; |
4069 | 4078 | ||
4070 | bucket = get_bucket(state->pos); | ||
4071 | do { | 4079 | do { |
4072 | dev = dev_from_same_bucket(seq); | 4080 | dev = dev_from_same_bucket(seq, pos); |
4073 | if (dev) | 4081 | if (dev) |
4074 | return dev; | 4082 | return dev; |
4075 | 4083 | ||
4076 | bucket++; | 4084 | bucket = get_bucket(*pos) + 1; |
4077 | state->pos = set_bucket_offset(bucket, 0); | 4085 | *pos = set_bucket_offset(bucket, 1); |
4078 | } while (bucket < NETDEV_HASHENTRIES); | 4086 | } while (bucket < NETDEV_HASHENTRIES); |
4079 | 4087 | ||
4080 | return NULL; | 4088 | return NULL; |
@@ -4087,33 +4095,20 @@ static inline struct net_device *dev_from_new_bucket(struct seq_file *seq) | |||
4087 | void *dev_seq_start(struct seq_file *seq, loff_t *pos) | 4095 | void *dev_seq_start(struct seq_file *seq, loff_t *pos) |
4088 | __acquires(RCU) | 4096 | __acquires(RCU) |
4089 | { | 4097 | { |
4090 | struct dev_iter_state *state = seq->private; | ||
4091 | |||
4092 | rcu_read_lock(); | 4098 | rcu_read_lock(); |
4093 | if (!*pos) | 4099 | if (!*pos) |
4094 | return SEQ_START_TOKEN; | 4100 | return SEQ_START_TOKEN; |
4095 | 4101 | ||
4096 | /* check for end of the hash */ | 4102 | if (get_bucket(*pos) >= NETDEV_HASHENTRIES) |
4097 | if (state->pos == 0 && *pos > 1) | ||
4098 | return NULL; | 4103 | return NULL; |
4099 | 4104 | ||
4100 | return dev_from_new_bucket(seq); | 4105 | return dev_from_bucket(seq, pos); |
4101 | } | 4106 | } |
4102 | 4107 | ||
4103 | void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 4108 | void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
4104 | { | 4109 | { |
4105 | struct net_device *dev; | ||
4106 | |||
4107 | ++*pos; | 4110 | ++*pos; |
4108 | 4111 | return dev_from_bucket(seq, pos); | |
4109 | if (v == SEQ_START_TOKEN) | ||
4110 | return dev_from_new_bucket(seq); | ||
4111 | |||
4112 | dev = dev_from_same_bucket(seq); | ||
4113 | if (dev) | ||
4114 | return dev; | ||
4115 | |||
4116 | return dev_from_new_bucket(seq); | ||
4117 | } | 4112 | } |
4118 | 4113 | ||
4119 | void dev_seq_stop(struct seq_file *seq, void *v) | 4114 | void dev_seq_stop(struct seq_file *seq, void *v) |
@@ -4212,13 +4207,7 @@ static const struct seq_operations dev_seq_ops = { | |||
4212 | static int dev_seq_open(struct inode *inode, struct file *file) | 4207 | static int dev_seq_open(struct inode *inode, struct file *file) |
4213 | { | 4208 | { |
4214 | return seq_open_net(inode, file, &dev_seq_ops, | 4209 | return seq_open_net(inode, file, &dev_seq_ops, |
4215 | sizeof(struct dev_iter_state)); | 4210 | sizeof(struct seq_net_private)); |
4216 | } | ||
4217 | |||
4218 | int dev_seq_open_ops(struct inode *inode, struct file *file, | ||
4219 | const struct seq_operations *ops) | ||
4220 | { | ||
4221 | return seq_open_net(inode, file, ops, sizeof(struct dev_iter_state)); | ||
4222 | } | 4211 | } |
4223 | 4212 | ||
4224 | static const struct file_operations dev_seq_fops = { | 4213 | static const struct file_operations dev_seq_fops = { |
diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c index 29c07fef9228..626698f0db8b 100644 --- a/net/core/dev_addr_lists.c +++ b/net/core/dev_addr_lists.c | |||
@@ -696,7 +696,8 @@ static const struct seq_operations dev_mc_seq_ops = { | |||
696 | 696 | ||
697 | static int dev_mc_seq_open(struct inode *inode, struct file *file) | 697 | static int dev_mc_seq_open(struct inode *inode, struct file *file) |
698 | { | 698 | { |
699 | return dev_seq_open_ops(inode, file, &dev_mc_seq_ops); | 699 | return seq_open_net(inode, file, &dev_mc_seq_ops, |
700 | sizeof(struct seq_net_private)); | ||
700 | } | 701 | } |
701 | 702 | ||
702 | static const struct file_operations dev_mc_seq_fops = { | 703 | static const struct file_operations dev_mc_seq_fops = { |
diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c index 7f36b38e060f..a7cad741df01 100644 --- a/net/core/drop_monitor.c +++ b/net/core/drop_monitor.c | |||
@@ -42,13 +42,14 @@ static void send_dm_alert(struct work_struct *unused); | |||
42 | * netlink alerts | 42 | * netlink alerts |
43 | */ | 43 | */ |
44 | static int trace_state = TRACE_OFF; | 44 | static int trace_state = TRACE_OFF; |
45 | static DEFINE_SPINLOCK(trace_state_lock); | 45 | static DEFINE_MUTEX(trace_state_mutex); |
46 | 46 | ||
47 | struct per_cpu_dm_data { | 47 | struct per_cpu_dm_data { |
48 | struct work_struct dm_alert_work; | 48 | struct work_struct dm_alert_work; |
49 | struct sk_buff *skb; | 49 | struct sk_buff __rcu *skb; |
50 | atomic_t dm_hit_count; | 50 | atomic_t dm_hit_count; |
51 | struct timer_list send_timer; | 51 | struct timer_list send_timer; |
52 | int cpu; | ||
52 | }; | 53 | }; |
53 | 54 | ||
54 | struct dm_hw_stat_delta { | 55 | struct dm_hw_stat_delta { |
@@ -79,29 +80,53 @@ static void reset_per_cpu_data(struct per_cpu_dm_data *data) | |||
79 | size_t al; | 80 | size_t al; |
80 | struct net_dm_alert_msg *msg; | 81 | struct net_dm_alert_msg *msg; |
81 | struct nlattr *nla; | 82 | struct nlattr *nla; |
83 | struct sk_buff *skb; | ||
84 | struct sk_buff *oskb = rcu_dereference_protected(data->skb, 1); | ||
82 | 85 | ||
83 | al = sizeof(struct net_dm_alert_msg); | 86 | al = sizeof(struct net_dm_alert_msg); |
84 | al += dm_hit_limit * sizeof(struct net_dm_drop_point); | 87 | al += dm_hit_limit * sizeof(struct net_dm_drop_point); |
85 | al += sizeof(struct nlattr); | 88 | al += sizeof(struct nlattr); |
86 | 89 | ||
87 | data->skb = genlmsg_new(al, GFP_KERNEL); | 90 | skb = genlmsg_new(al, GFP_KERNEL); |
88 | genlmsg_put(data->skb, 0, 0, &net_drop_monitor_family, | 91 | |
89 | 0, NET_DM_CMD_ALERT); | 92 | if (skb) { |
90 | nla = nla_reserve(data->skb, NLA_UNSPEC, sizeof(struct net_dm_alert_msg)); | 93 | genlmsg_put(skb, 0, 0, &net_drop_monitor_family, |
91 | msg = nla_data(nla); | 94 | 0, NET_DM_CMD_ALERT); |
92 | memset(msg, 0, al); | 95 | nla = nla_reserve(skb, NLA_UNSPEC, |
93 | atomic_set(&data->dm_hit_count, dm_hit_limit); | 96 | sizeof(struct net_dm_alert_msg)); |
97 | msg = nla_data(nla); | ||
98 | memset(msg, 0, al); | ||
99 | } else | ||
100 | schedule_work_on(data->cpu, &data->dm_alert_work); | ||
101 | |||
102 | /* | ||
103 | * Don't need to lock this, since we are guaranteed to only | ||
104 | * run this on a single cpu at a time. | ||
105 | * Note also that we only update data->skb if the old and new skb | ||
106 | * pointers don't match. This ensures that we don't continually call | ||
107 | * synchornize_rcu if we repeatedly fail to alloc a new netlink message. | ||
108 | */ | ||
109 | if (skb != oskb) { | ||
110 | rcu_assign_pointer(data->skb, skb); | ||
111 | |||
112 | synchronize_rcu(); | ||
113 | |||
114 | atomic_set(&data->dm_hit_count, dm_hit_limit); | ||
115 | } | ||
116 | |||
94 | } | 117 | } |
95 | 118 | ||
96 | static void send_dm_alert(struct work_struct *unused) | 119 | static void send_dm_alert(struct work_struct *unused) |
97 | { | 120 | { |
98 | struct sk_buff *skb; | 121 | struct sk_buff *skb; |
99 | struct per_cpu_dm_data *data = &__get_cpu_var(dm_cpu_data); | 122 | struct per_cpu_dm_data *data = &get_cpu_var(dm_cpu_data); |
123 | |||
124 | WARN_ON_ONCE(data->cpu != smp_processor_id()); | ||
100 | 125 | ||
101 | /* | 126 | /* |
102 | * Grab the skb we're about to send | 127 | * Grab the skb we're about to send |
103 | */ | 128 | */ |
104 | skb = data->skb; | 129 | skb = rcu_dereference_protected(data->skb, 1); |
105 | 130 | ||
106 | /* | 131 | /* |
107 | * Replace it with a new one | 132 | * Replace it with a new one |
@@ -111,8 +136,10 @@ static void send_dm_alert(struct work_struct *unused) | |||
111 | /* | 136 | /* |
112 | * Ship it! | 137 | * Ship it! |
113 | */ | 138 | */ |
114 | genlmsg_multicast(skb, 0, NET_DM_GRP_ALERT, GFP_KERNEL); | 139 | if (skb) |
140 | genlmsg_multicast(skb, 0, NET_DM_GRP_ALERT, GFP_KERNEL); | ||
115 | 141 | ||
142 | put_cpu_var(dm_cpu_data); | ||
116 | } | 143 | } |
117 | 144 | ||
118 | /* | 145 | /* |
@@ -123,9 +150,11 @@ static void send_dm_alert(struct work_struct *unused) | |||
123 | */ | 150 | */ |
124 | static void sched_send_work(unsigned long unused) | 151 | static void sched_send_work(unsigned long unused) |
125 | { | 152 | { |
126 | struct per_cpu_dm_data *data = &__get_cpu_var(dm_cpu_data); | 153 | struct per_cpu_dm_data *data = &get_cpu_var(dm_cpu_data); |
154 | |||
155 | schedule_work_on(smp_processor_id(), &data->dm_alert_work); | ||
127 | 156 | ||
128 | schedule_work(&data->dm_alert_work); | 157 | put_cpu_var(dm_cpu_data); |
129 | } | 158 | } |
130 | 159 | ||
131 | static void trace_drop_common(struct sk_buff *skb, void *location) | 160 | static void trace_drop_common(struct sk_buff *skb, void *location) |
@@ -134,8 +163,15 @@ static void trace_drop_common(struct sk_buff *skb, void *location) | |||
134 | struct nlmsghdr *nlh; | 163 | struct nlmsghdr *nlh; |
135 | struct nlattr *nla; | 164 | struct nlattr *nla; |
136 | int i; | 165 | int i; |
137 | struct per_cpu_dm_data *data = &__get_cpu_var(dm_cpu_data); | 166 | struct sk_buff *dskb; |
167 | struct per_cpu_dm_data *data = &get_cpu_var(dm_cpu_data); | ||
168 | |||
169 | |||
170 | rcu_read_lock(); | ||
171 | dskb = rcu_dereference(data->skb); | ||
138 | 172 | ||
173 | if (!dskb) | ||
174 | goto out; | ||
139 | 175 | ||
140 | if (!atomic_add_unless(&data->dm_hit_count, -1, 0)) { | 176 | if (!atomic_add_unless(&data->dm_hit_count, -1, 0)) { |
141 | /* | 177 | /* |
@@ -144,12 +180,13 @@ static void trace_drop_common(struct sk_buff *skb, void *location) | |||
144 | goto out; | 180 | goto out; |
145 | } | 181 | } |
146 | 182 | ||
147 | nlh = (struct nlmsghdr *)data->skb->data; | 183 | nlh = (struct nlmsghdr *)dskb->data; |
148 | nla = genlmsg_data(nlmsg_data(nlh)); | 184 | nla = genlmsg_data(nlmsg_data(nlh)); |
149 | msg = nla_data(nla); | 185 | msg = nla_data(nla); |
150 | for (i = 0; i < msg->entries; i++) { | 186 | for (i = 0; i < msg->entries; i++) { |
151 | if (!memcmp(&location, msg->points[i].pc, sizeof(void *))) { | 187 | if (!memcmp(&location, msg->points[i].pc, sizeof(void *))) { |
152 | msg->points[i].count++; | 188 | msg->points[i].count++; |
189 | atomic_inc(&data->dm_hit_count); | ||
153 | goto out; | 190 | goto out; |
154 | } | 191 | } |
155 | } | 192 | } |
@@ -157,7 +194,7 @@ static void trace_drop_common(struct sk_buff *skb, void *location) | |||
157 | /* | 194 | /* |
158 | * We need to create a new entry | 195 | * We need to create a new entry |
159 | */ | 196 | */ |
160 | __nla_reserve_nohdr(data->skb, sizeof(struct net_dm_drop_point)); | 197 | __nla_reserve_nohdr(dskb, sizeof(struct net_dm_drop_point)); |
161 | nla->nla_len += NLA_ALIGN(sizeof(struct net_dm_drop_point)); | 198 | nla->nla_len += NLA_ALIGN(sizeof(struct net_dm_drop_point)); |
162 | memcpy(msg->points[msg->entries].pc, &location, sizeof(void *)); | 199 | memcpy(msg->points[msg->entries].pc, &location, sizeof(void *)); |
163 | msg->points[msg->entries].count = 1; | 200 | msg->points[msg->entries].count = 1; |
@@ -169,6 +206,8 @@ static void trace_drop_common(struct sk_buff *skb, void *location) | |||
169 | } | 206 | } |
170 | 207 | ||
171 | out: | 208 | out: |
209 | rcu_read_unlock(); | ||
210 | put_cpu_var(dm_cpu_data); | ||
172 | return; | 211 | return; |
173 | } | 212 | } |
174 | 213 | ||
@@ -213,7 +252,7 @@ static int set_all_monitor_traces(int state) | |||
213 | struct dm_hw_stat_delta *new_stat = NULL; | 252 | struct dm_hw_stat_delta *new_stat = NULL; |
214 | struct dm_hw_stat_delta *temp; | 253 | struct dm_hw_stat_delta *temp; |
215 | 254 | ||
216 | spin_lock(&trace_state_lock); | 255 | mutex_lock(&trace_state_mutex); |
217 | 256 | ||
218 | if (state == trace_state) { | 257 | if (state == trace_state) { |
219 | rc = -EAGAIN; | 258 | rc = -EAGAIN; |
@@ -252,7 +291,7 @@ static int set_all_monitor_traces(int state) | |||
252 | rc = -EINPROGRESS; | 291 | rc = -EINPROGRESS; |
253 | 292 | ||
254 | out_unlock: | 293 | out_unlock: |
255 | spin_unlock(&trace_state_lock); | 294 | mutex_unlock(&trace_state_mutex); |
256 | 295 | ||
257 | return rc; | 296 | return rc; |
258 | } | 297 | } |
@@ -295,12 +334,12 @@ static int dropmon_net_event(struct notifier_block *ev_block, | |||
295 | 334 | ||
296 | new_stat->dev = dev; | 335 | new_stat->dev = dev; |
297 | new_stat->last_rx = jiffies; | 336 | new_stat->last_rx = jiffies; |
298 | spin_lock(&trace_state_lock); | 337 | mutex_lock(&trace_state_mutex); |
299 | list_add_rcu(&new_stat->list, &hw_stats_list); | 338 | list_add_rcu(&new_stat->list, &hw_stats_list); |
300 | spin_unlock(&trace_state_lock); | 339 | mutex_unlock(&trace_state_mutex); |
301 | break; | 340 | break; |
302 | case NETDEV_UNREGISTER: | 341 | case NETDEV_UNREGISTER: |
303 | spin_lock(&trace_state_lock); | 342 | mutex_lock(&trace_state_mutex); |
304 | list_for_each_entry_safe(new_stat, tmp, &hw_stats_list, list) { | 343 | list_for_each_entry_safe(new_stat, tmp, &hw_stats_list, list) { |
305 | if (new_stat->dev == dev) { | 344 | if (new_stat->dev == dev) { |
306 | new_stat->dev = NULL; | 345 | new_stat->dev = NULL; |
@@ -311,7 +350,7 @@ static int dropmon_net_event(struct notifier_block *ev_block, | |||
311 | } | 350 | } |
312 | } | 351 | } |
313 | } | 352 | } |
314 | spin_unlock(&trace_state_lock); | 353 | mutex_unlock(&trace_state_mutex); |
315 | break; | 354 | break; |
316 | } | 355 | } |
317 | out: | 356 | out: |
@@ -367,13 +406,15 @@ static int __init init_net_drop_monitor(void) | |||
367 | 406 | ||
368 | for_each_present_cpu(cpu) { | 407 | for_each_present_cpu(cpu) { |
369 | data = &per_cpu(dm_cpu_data, cpu); | 408 | data = &per_cpu(dm_cpu_data, cpu); |
370 | reset_per_cpu_data(data); | 409 | data->cpu = cpu; |
371 | INIT_WORK(&data->dm_alert_work, send_dm_alert); | 410 | INIT_WORK(&data->dm_alert_work, send_dm_alert); |
372 | init_timer(&data->send_timer); | 411 | init_timer(&data->send_timer); |
373 | data->send_timer.data = cpu; | 412 | data->send_timer.data = cpu; |
374 | data->send_timer.function = sched_send_work; | 413 | data->send_timer.function = sched_send_work; |
414 | reset_per_cpu_data(data); | ||
375 | } | 415 | } |
376 | 416 | ||
417 | |||
377 | goto out; | 418 | goto out; |
378 | 419 | ||
379 | out_unreg: | 420 | out_unreg: |
diff --git a/net/core/filter.c b/net/core/filter.c index cf4989ac503b..6f755cca4520 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -39,8 +39,11 @@ | |||
39 | #include <linux/reciprocal_div.h> | 39 | #include <linux/reciprocal_div.h> |
40 | #include <linux/ratelimit.h> | 40 | #include <linux/ratelimit.h> |
41 | 41 | ||
42 | /* No hurry in this branch */ | 42 | /* No hurry in this branch |
43 | static void *__load_pointer(const struct sk_buff *skb, int k, unsigned int size) | 43 | * |
44 | * Exported for the bpf jit load helper. | ||
45 | */ | ||
46 | void *bpf_internal_load_pointer_neg_helper(const struct sk_buff *skb, int k, unsigned int size) | ||
44 | { | 47 | { |
45 | u8 *ptr = NULL; | 48 | u8 *ptr = NULL; |
46 | 49 | ||
@@ -59,7 +62,7 @@ static inline void *load_pointer(const struct sk_buff *skb, int k, | |||
59 | { | 62 | { |
60 | if (k >= 0) | 63 | if (k >= 0) |
61 | return skb_header_pointer(skb, k, size, buffer); | 64 | return skb_header_pointer(skb, k, size, buffer); |
62 | return __load_pointer(skb, k, size); | 65 | return bpf_internal_load_pointer_neg_helper(skb, k, size); |
63 | } | 66 | } |
64 | 67 | ||
65 | /** | 68 | /** |
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 0e950fda9a0a..31a5ae51a45c 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c | |||
@@ -83,21 +83,29 @@ assign: | |||
83 | 83 | ||
84 | static int ops_init(const struct pernet_operations *ops, struct net *net) | 84 | static int ops_init(const struct pernet_operations *ops, struct net *net) |
85 | { | 85 | { |
86 | int err; | 86 | int err = -ENOMEM; |
87 | void *data = NULL; | ||
88 | |||
87 | if (ops->id && ops->size) { | 89 | if (ops->id && ops->size) { |
88 | void *data = kzalloc(ops->size, GFP_KERNEL); | 90 | data = kzalloc(ops->size, GFP_KERNEL); |
89 | if (!data) | 91 | if (!data) |
90 | return -ENOMEM; | 92 | goto out; |
91 | 93 | ||
92 | err = net_assign_generic(net, *ops->id, data); | 94 | err = net_assign_generic(net, *ops->id, data); |
93 | if (err) { | 95 | if (err) |
94 | kfree(data); | 96 | goto cleanup; |
95 | return err; | ||
96 | } | ||
97 | } | 97 | } |
98 | err = 0; | ||
98 | if (ops->init) | 99 | if (ops->init) |
99 | return ops->init(net); | 100 | err = ops->init(net); |
100 | return 0; | 101 | if (!err) |
102 | return 0; | ||
103 | |||
104 | cleanup: | ||
105 | kfree(data); | ||
106 | |||
107 | out: | ||
108 | return err; | ||
101 | } | 109 | } |
102 | 110 | ||
103 | static void ops_free(const struct pernet_operations *ops, struct net *net) | 111 | static void ops_free(const struct pernet_operations *ops, struct net *net) |
@@ -448,12 +456,7 @@ static void __unregister_pernet_operations(struct pernet_operations *ops) | |||
448 | static int __register_pernet_operations(struct list_head *list, | 456 | static int __register_pernet_operations(struct list_head *list, |
449 | struct pernet_operations *ops) | 457 | struct pernet_operations *ops) |
450 | { | 458 | { |
451 | int err = 0; | 459 | return ops_init(ops, &init_net); |
452 | err = ops_init(ops, &init_net); | ||
453 | if (err) | ||
454 | ops_free(ops, &init_net); | ||
455 | return err; | ||
456 | |||
457 | } | 460 | } |
458 | 461 | ||
459 | static void __unregister_pernet_operations(struct pernet_operations *ops) | 462 | static void __unregister_pernet_operations(struct pernet_operations *ops) |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index f223cdc75da6..e59840010d45 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -952,9 +952,11 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, | |||
952 | goto adjust_others; | 952 | goto adjust_others; |
953 | } | 953 | } |
954 | 954 | ||
955 | data = kmalloc(size + sizeof(struct skb_shared_info), gfp_mask); | 955 | data = kmalloc(size + SKB_DATA_ALIGN(sizeof(struct skb_shared_info)), |
956 | gfp_mask); | ||
956 | if (!data) | 957 | if (!data) |
957 | goto nodata; | 958 | goto nodata; |
959 | size = SKB_WITH_OVERHEAD(ksize(data)); | ||
958 | 960 | ||
959 | /* Copy only real data... and, alas, header. This should be | 961 | /* Copy only real data... and, alas, header. This should be |
960 | * optimized for the cases when header is void. | 962 | * optimized for the cases when header is void. |
@@ -3161,6 +3163,8 @@ static void sock_rmem_free(struct sk_buff *skb) | |||
3161 | */ | 3163 | */ |
3162 | int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) | 3164 | int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) |
3163 | { | 3165 | { |
3166 | int len = skb->len; | ||
3167 | |||
3164 | if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= | 3168 | if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= |
3165 | (unsigned)sk->sk_rcvbuf) | 3169 | (unsigned)sk->sk_rcvbuf) |
3166 | return -ENOMEM; | 3170 | return -ENOMEM; |
@@ -3175,7 +3179,7 @@ int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) | |||
3175 | 3179 | ||
3176 | skb_queue_tail(&sk->sk_error_queue, skb); | 3180 | skb_queue_tail(&sk->sk_error_queue, skb); |
3177 | if (!sock_flag(sk, SOCK_DEAD)) | 3181 | if (!sock_flag(sk, SOCK_DEAD)) |
3178 | sk->sk_data_ready(sk, skb->len); | 3182 | sk->sk_data_ready(sk, len); |
3179 | return 0; | 3183 | return 0; |
3180 | } | 3184 | } |
3181 | EXPORT_SYMBOL(sock_queue_err_skb); | 3185 | EXPORT_SYMBOL(sock_queue_err_skb); |
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c index 368515885368..840821b90bcd 100644 --- a/net/ieee802154/6lowpan.c +++ b/net/ieee802154/6lowpan.c | |||
@@ -1044,6 +1044,24 @@ static void lowpan_dev_free(struct net_device *dev) | |||
1044 | free_netdev(dev); | 1044 | free_netdev(dev); |
1045 | } | 1045 | } |
1046 | 1046 | ||
1047 | static struct wpan_phy *lowpan_get_phy(const struct net_device *dev) | ||
1048 | { | ||
1049 | struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; | ||
1050 | return ieee802154_mlme_ops(real_dev)->get_phy(real_dev); | ||
1051 | } | ||
1052 | |||
1053 | static u16 lowpan_get_pan_id(const struct net_device *dev) | ||
1054 | { | ||
1055 | struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; | ||
1056 | return ieee802154_mlme_ops(real_dev)->get_pan_id(real_dev); | ||
1057 | } | ||
1058 | |||
1059 | static u16 lowpan_get_short_addr(const struct net_device *dev) | ||
1060 | { | ||
1061 | struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; | ||
1062 | return ieee802154_mlme_ops(real_dev)->get_short_addr(real_dev); | ||
1063 | } | ||
1064 | |||
1047 | static struct header_ops lowpan_header_ops = { | 1065 | static struct header_ops lowpan_header_ops = { |
1048 | .create = lowpan_header_create, | 1066 | .create = lowpan_header_create, |
1049 | }; | 1067 | }; |
@@ -1053,6 +1071,12 @@ static const struct net_device_ops lowpan_netdev_ops = { | |||
1053 | .ndo_set_mac_address = eth_mac_addr, | 1071 | .ndo_set_mac_address = eth_mac_addr, |
1054 | }; | 1072 | }; |
1055 | 1073 | ||
1074 | static struct ieee802154_mlme_ops lowpan_mlme = { | ||
1075 | .get_pan_id = lowpan_get_pan_id, | ||
1076 | .get_phy = lowpan_get_phy, | ||
1077 | .get_short_addr = lowpan_get_short_addr, | ||
1078 | }; | ||
1079 | |||
1056 | static void lowpan_setup(struct net_device *dev) | 1080 | static void lowpan_setup(struct net_device *dev) |
1057 | { | 1081 | { |
1058 | pr_debug("(%s)\n", __func__); | 1082 | pr_debug("(%s)\n", __func__); |
@@ -1070,6 +1094,7 @@ static void lowpan_setup(struct net_device *dev) | |||
1070 | 1094 | ||
1071 | dev->netdev_ops = &lowpan_netdev_ops; | 1095 | dev->netdev_ops = &lowpan_netdev_ops; |
1072 | dev->header_ops = &lowpan_header_ops; | 1096 | dev->header_ops = &lowpan_header_ops; |
1097 | dev->ml_priv = &lowpan_mlme; | ||
1073 | dev->destructor = lowpan_dev_free; | 1098 | dev->destructor = lowpan_dev_free; |
1074 | } | 1099 | } |
1075 | 1100 | ||
@@ -1143,6 +1168,8 @@ static int lowpan_newlink(struct net *src_net, struct net_device *dev, | |||
1143 | list_add_tail(&entry->list, &lowpan_devices); | 1168 | list_add_tail(&entry->list, &lowpan_devices); |
1144 | mutex_unlock(&lowpan_dev_info(dev)->dev_list_mtx); | 1169 | mutex_unlock(&lowpan_dev_info(dev)->dev_list_mtx); |
1145 | 1170 | ||
1171 | spin_lock_init(&flist_lock); | ||
1172 | |||
1146 | register_netdevice(dev); | 1173 | register_netdevice(dev); |
1147 | 1174 | ||
1148 | return 0; | 1175 | return 0; |
@@ -1152,11 +1179,20 @@ static void lowpan_dellink(struct net_device *dev, struct list_head *head) | |||
1152 | { | 1179 | { |
1153 | struct lowpan_dev_info *lowpan_dev = lowpan_dev_info(dev); | 1180 | struct lowpan_dev_info *lowpan_dev = lowpan_dev_info(dev); |
1154 | struct net_device *real_dev = lowpan_dev->real_dev; | 1181 | struct net_device *real_dev = lowpan_dev->real_dev; |
1155 | struct lowpan_dev_record *entry; | 1182 | struct lowpan_dev_record *entry, *tmp; |
1156 | struct lowpan_dev_record *tmp; | 1183 | struct lowpan_fragment *frame, *tframe; |
1157 | 1184 | ||
1158 | ASSERT_RTNL(); | 1185 | ASSERT_RTNL(); |
1159 | 1186 | ||
1187 | spin_lock(&flist_lock); | ||
1188 | list_for_each_entry_safe(frame, tframe, &lowpan_fragments, list) { | ||
1189 | del_timer(&frame->timer); | ||
1190 | list_del(&frame->list); | ||
1191 | dev_kfree_skb(frame->skb); | ||
1192 | kfree(frame); | ||
1193 | } | ||
1194 | spin_unlock(&flist_lock); | ||
1195 | |||
1160 | mutex_lock(&lowpan_dev_info(dev)->dev_list_mtx); | 1196 | mutex_lock(&lowpan_dev_info(dev)->dev_list_mtx); |
1161 | list_for_each_entry_safe(entry, tmp, &lowpan_devices, list) { | 1197 | list_for_each_entry_safe(entry, tmp, &lowpan_devices, list) { |
1162 | if (entry->ldev == dev) { | 1198 | if (entry->ldev == dev) { |
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 8d25a1c557eb..8f8db724bfaf 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -141,7 +141,7 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, | |||
141 | goto rtattr_failure; | 141 | goto rtattr_failure; |
142 | 142 | ||
143 | if (icsk == NULL) { | 143 | if (icsk == NULL) { |
144 | r->idiag_rqueue = r->idiag_wqueue = 0; | 144 | handler->idiag_get_info(sk, r, NULL); |
145 | goto out; | 145 | goto out; |
146 | } | 146 | } |
147 | 147 | ||
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c index de9da21113a1..cf73cc70ed2d 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | |||
@@ -74,16 +74,24 @@ static int ipv4_get_l4proto(const struct sk_buff *skb, unsigned int nhoff, | |||
74 | 74 | ||
75 | iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph); | 75 | iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph); |
76 | if (iph == NULL) | 76 | if (iph == NULL) |
77 | return -NF_DROP; | 77 | return -NF_ACCEPT; |
78 | 78 | ||
79 | /* Conntrack defragments packets, we might still see fragments | 79 | /* Conntrack defragments packets, we might still see fragments |
80 | * inside ICMP packets though. */ | 80 | * inside ICMP packets though. */ |
81 | if (iph->frag_off & htons(IP_OFFSET)) | 81 | if (iph->frag_off & htons(IP_OFFSET)) |
82 | return -NF_DROP; | 82 | return -NF_ACCEPT; |
83 | 83 | ||
84 | *dataoff = nhoff + (iph->ihl << 2); | 84 | *dataoff = nhoff + (iph->ihl << 2); |
85 | *protonum = iph->protocol; | 85 | *protonum = iph->protocol; |
86 | 86 | ||
87 | /* Check bogus IP headers */ | ||
88 | if (*dataoff > skb->len) { | ||
89 | pr_debug("nf_conntrack_ipv4: bogus IPv4 packet: " | ||
90 | "nhoff %u, ihl %u, skblen %u\n", | ||
91 | nhoff, iph->ihl << 2, skb->len); | ||
92 | return -NF_ACCEPT; | ||
93 | } | ||
94 | |||
87 | return NF_ACCEPT; | 95 | return NF_ACCEPT; |
88 | } | 96 | } |
89 | 97 | ||
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 4dc1c104c942..167ea10b521a 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -2041,7 +2041,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2041 | if (err < 0) | 2041 | if (err < 0) |
2042 | goto e_err; | 2042 | goto e_err; |
2043 | } | 2043 | } |
2044 | rth = rt_dst_alloc(init_net.loopback_dev, | 2044 | rth = rt_dst_alloc(dev_net(dev)->loopback_dev, |
2045 | IN_DEV_CONF_GET(in_dev, NOPOLICY), false); | 2045 | IN_DEV_CONF_GET(in_dev, NOPOLICY), false); |
2046 | if (!rth) | 2046 | if (!rth) |
2047 | goto e_nobufs; | 2047 | goto e_nobufs; |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index cfd7edda0a8e..1272a88c2a63 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -701,11 +701,12 @@ struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp) | |||
701 | skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp); | 701 | skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp); |
702 | if (skb) { | 702 | if (skb) { |
703 | if (sk_wmem_schedule(sk, skb->truesize)) { | 703 | if (sk_wmem_schedule(sk, skb->truesize)) { |
704 | skb_reserve(skb, sk->sk_prot->max_header); | ||
704 | /* | 705 | /* |
705 | * Make sure that we have exactly size bytes | 706 | * Make sure that we have exactly size bytes |
706 | * available to the caller, no more, no less. | 707 | * available to the caller, no more, no less. |
707 | */ | 708 | */ |
708 | skb_reserve(skb, skb_tailroom(skb) - size); | 709 | skb->avail_size = size; |
709 | return skb; | 710 | return skb; |
710 | } | 711 | } |
711 | __kfree_skb(skb); | 712 | __kfree_skb(skb); |
@@ -860,7 +861,7 @@ wait_for_memory: | |||
860 | } | 861 | } |
861 | 862 | ||
862 | out: | 863 | out: |
863 | if (copied) | 864 | if (copied && !(flags & MSG_SENDPAGE_NOTLAST)) |
864 | tcp_push(sk, flags, mss_now, tp->nonagle); | 865 | tcp_push(sk, flags, mss_now, tp->nonagle); |
865 | return copied; | 866 | return copied; |
866 | 867 | ||
@@ -995,10 +996,9 @@ new_segment: | |||
995 | copy = seglen; | 996 | copy = seglen; |
996 | 997 | ||
997 | /* Where to copy to? */ | 998 | /* Where to copy to? */ |
998 | if (skb_tailroom(skb) > 0) { | 999 | if (skb_availroom(skb) > 0) { |
999 | /* We have some space in skb head. Superb! */ | 1000 | /* We have some space in skb head. Superb! */ |
1000 | if (copy > skb_tailroom(skb)) | 1001 | copy = min_t(int, copy, skb_availroom(skb)); |
1001 | copy = skb_tailroom(skb); | ||
1002 | err = skb_add_data_nocache(sk, skb, from, copy); | 1002 | err = skb_add_data_nocache(sk, skb, from, copy); |
1003 | if (err) | 1003 | if (err) |
1004 | goto do_fault; | 1004 | goto do_fault; |
@@ -1452,7 +1452,7 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
1452 | if ((available < target) && | 1452 | if ((available < target) && |
1453 | (len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) && | 1453 | (len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) && |
1454 | !sysctl_tcp_low_latency && | 1454 | !sysctl_tcp_low_latency && |
1455 | dma_find_channel(DMA_MEMCPY)) { | 1455 | net_dma_find_channel()) { |
1456 | preempt_enable_no_resched(); | 1456 | preempt_enable_no_resched(); |
1457 | tp->ucopy.pinned_list = | 1457 | tp->ucopy.pinned_list = |
1458 | dma_pin_iovec_pages(msg->msg_iov, len); | 1458 | dma_pin_iovec_pages(msg->msg_iov, len); |
@@ -1667,7 +1667,7 @@ do_prequeue: | |||
1667 | if (!(flags & MSG_TRUNC)) { | 1667 | if (!(flags & MSG_TRUNC)) { |
1668 | #ifdef CONFIG_NET_DMA | 1668 | #ifdef CONFIG_NET_DMA |
1669 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) | 1669 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) |
1670 | tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY); | 1670 | tp->ucopy.dma_chan = net_dma_find_channel(); |
1671 | 1671 | ||
1672 | if (tp->ucopy.dma_chan) { | 1672 | if (tp->ucopy.dma_chan) { |
1673 | tp->ucopy.dma_cookie = dma_skb_copy_datagram_iovec( | 1673 | tp->ucopy.dma_cookie = dma_skb_copy_datagram_iovec( |
@@ -3243,7 +3243,7 @@ void __init tcp_init(void) | |||
3243 | { | 3243 | { |
3244 | struct sk_buff *skb = NULL; | 3244 | struct sk_buff *skb = NULL; |
3245 | unsigned long limit; | 3245 | unsigned long limit; |
3246 | int max_share, cnt; | 3246 | int max_rshare, max_wshare, cnt; |
3247 | unsigned int i; | 3247 | unsigned int i; |
3248 | unsigned long jiffy = jiffies; | 3248 | unsigned long jiffy = jiffies; |
3249 | 3249 | ||
@@ -3302,17 +3302,17 @@ void __init tcp_init(void) | |||
3302 | 3302 | ||
3303 | tcp_init_mem(&init_net); | 3303 | tcp_init_mem(&init_net); |
3304 | /* Set per-socket limits to no more than 1/128 the pressure threshold */ | 3304 | /* Set per-socket limits to no more than 1/128 the pressure threshold */ |
3305 | limit = nr_free_buffer_pages() << (PAGE_SHIFT - 10); | 3305 | limit = nr_free_buffer_pages() << (PAGE_SHIFT - 7); |
3306 | limit = max(limit, 128UL); | 3306 | max_wshare = min(4UL*1024*1024, limit); |
3307 | max_share = min(4UL*1024*1024, limit); | 3307 | max_rshare = min(6UL*1024*1024, limit); |
3308 | 3308 | ||
3309 | sysctl_tcp_wmem[0] = SK_MEM_QUANTUM; | 3309 | sysctl_tcp_wmem[0] = SK_MEM_QUANTUM; |
3310 | sysctl_tcp_wmem[1] = 16*1024; | 3310 | sysctl_tcp_wmem[1] = 16*1024; |
3311 | sysctl_tcp_wmem[2] = max(64*1024, max_share); | 3311 | sysctl_tcp_wmem[2] = max(64*1024, max_wshare); |
3312 | 3312 | ||
3313 | sysctl_tcp_rmem[0] = SK_MEM_QUANTUM; | 3313 | sysctl_tcp_rmem[0] = SK_MEM_QUANTUM; |
3314 | sysctl_tcp_rmem[1] = 87380; | 3314 | sysctl_tcp_rmem[1] = 87380; |
3315 | sysctl_tcp_rmem[2] = max(87380, max_share); | 3315 | sysctl_tcp_rmem[2] = max(87380, max_rshare); |
3316 | 3316 | ||
3317 | pr_info("Hash tables configured (established %u bind %u)\n", | 3317 | pr_info("Hash tables configured (established %u bind %u)\n", |
3318 | tcp_hashinfo.ehash_mask + 1, tcp_hashinfo.bhash_size); | 3318 | tcp_hashinfo.ehash_mask + 1, tcp_hashinfo.bhash_size); |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index e886e2f7fa8d..257b61789eeb 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -85,7 +85,7 @@ int sysctl_tcp_ecn __read_mostly = 2; | |||
85 | EXPORT_SYMBOL(sysctl_tcp_ecn); | 85 | EXPORT_SYMBOL(sysctl_tcp_ecn); |
86 | int sysctl_tcp_dsack __read_mostly = 1; | 86 | int sysctl_tcp_dsack __read_mostly = 1; |
87 | int sysctl_tcp_app_win __read_mostly = 31; | 87 | int sysctl_tcp_app_win __read_mostly = 31; |
88 | int sysctl_tcp_adv_win_scale __read_mostly = 2; | 88 | int sysctl_tcp_adv_win_scale __read_mostly = 1; |
89 | EXPORT_SYMBOL(sysctl_tcp_adv_win_scale); | 89 | EXPORT_SYMBOL(sysctl_tcp_adv_win_scale); |
90 | 90 | ||
91 | int sysctl_tcp_stdurg __read_mostly; | 91 | int sysctl_tcp_stdurg __read_mostly; |
@@ -335,6 +335,7 @@ static void tcp_grow_window(struct sock *sk, const struct sk_buff *skb) | |||
335 | incr = __tcp_grow_window(sk, skb); | 335 | incr = __tcp_grow_window(sk, skb); |
336 | 336 | ||
337 | if (incr) { | 337 | if (incr) { |
338 | incr = max_t(int, incr, 2 * skb->len); | ||
338 | tp->rcv_ssthresh = min(tp->rcv_ssthresh + incr, | 339 | tp->rcv_ssthresh = min(tp->rcv_ssthresh + incr, |
339 | tp->window_clamp); | 340 | tp->window_clamp); |
340 | inet_csk(sk)->icsk_ack.quick |= 1; | 341 | inet_csk(sk)->icsk_ack.quick |= 1; |
@@ -474,8 +475,11 @@ static void tcp_rcv_rtt_update(struct tcp_sock *tp, u32 sample, int win_dep) | |||
474 | if (!win_dep) { | 475 | if (!win_dep) { |
475 | m -= (new_sample >> 3); | 476 | m -= (new_sample >> 3); |
476 | new_sample += m; | 477 | new_sample += m; |
477 | } else if (m < new_sample) | 478 | } else { |
478 | new_sample = m << 3; | 479 | m <<= 3; |
480 | if (m < new_sample) | ||
481 | new_sample = m; | ||
482 | } | ||
479 | } else { | 483 | } else { |
480 | /* No previous measure. */ | 484 | /* No previous measure. */ |
481 | new_sample = m << 3; | 485 | new_sample = m << 3; |
@@ -491,7 +495,7 @@ static inline void tcp_rcv_rtt_measure(struct tcp_sock *tp) | |||
491 | goto new_measure; | 495 | goto new_measure; |
492 | if (before(tp->rcv_nxt, tp->rcv_rtt_est.seq)) | 496 | if (before(tp->rcv_nxt, tp->rcv_rtt_est.seq)) |
493 | return; | 497 | return; |
494 | tcp_rcv_rtt_update(tp, jiffies - tp->rcv_rtt_est.time, 1); | 498 | tcp_rcv_rtt_update(tp, tcp_time_stamp - tp->rcv_rtt_est.time, 1); |
495 | 499 | ||
496 | new_measure: | 500 | new_measure: |
497 | tp->rcv_rtt_est.seq = tp->rcv_nxt + tp->rcv_wnd; | 501 | tp->rcv_rtt_est.seq = tp->rcv_nxt + tp->rcv_wnd; |
@@ -2864,11 +2868,14 @@ static inline void tcp_complete_cwr(struct sock *sk) | |||
2864 | 2868 | ||
2865 | /* Do not moderate cwnd if it's already undone in cwr or recovery. */ | 2869 | /* Do not moderate cwnd if it's already undone in cwr or recovery. */ |
2866 | if (tp->undo_marker) { | 2870 | if (tp->undo_marker) { |
2867 | if (inet_csk(sk)->icsk_ca_state == TCP_CA_CWR) | 2871 | if (inet_csk(sk)->icsk_ca_state == TCP_CA_CWR) { |
2868 | tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_ssthresh); | 2872 | tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_ssthresh); |
2869 | else /* PRR */ | 2873 | tp->snd_cwnd_stamp = tcp_time_stamp; |
2874 | } else if (tp->snd_ssthresh < TCP_INFINITE_SSTHRESH) { | ||
2875 | /* PRR algorithm. */ | ||
2870 | tp->snd_cwnd = tp->snd_ssthresh; | 2876 | tp->snd_cwnd = tp->snd_ssthresh; |
2871 | tp->snd_cwnd_stamp = tcp_time_stamp; | 2877 | tp->snd_cwnd_stamp = tcp_time_stamp; |
2878 | } | ||
2872 | } | 2879 | } |
2873 | tcp_ca_event(sk, CA_EVENT_COMPLETE_CWR); | 2880 | tcp_ca_event(sk, CA_EVENT_COMPLETE_CWR); |
2874 | } | 2881 | } |
@@ -5225,7 +5232,7 @@ static int tcp_dma_try_early_copy(struct sock *sk, struct sk_buff *skb, | |||
5225 | return 0; | 5232 | return 0; |
5226 | 5233 | ||
5227 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) | 5234 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) |
5228 | tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY); | 5235 | tp->ucopy.dma_chan = net_dma_find_channel(); |
5229 | 5236 | ||
5230 | if (tp->ucopy.dma_chan && skb_csum_unnecessary(skb)) { | 5237 | if (tp->ucopy.dma_chan && skb_csum_unnecessary(skb)) { |
5231 | 5238 | ||
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 3a25cf743f8b..0cb86ceb652f 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -1730,7 +1730,7 @@ process: | |||
1730 | #ifdef CONFIG_NET_DMA | 1730 | #ifdef CONFIG_NET_DMA |
1731 | struct tcp_sock *tp = tcp_sk(sk); | 1731 | struct tcp_sock *tp = tcp_sk(sk); |
1732 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) | 1732 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) |
1733 | tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY); | 1733 | tp->ucopy.dma_chan = net_dma_find_channel(); |
1734 | if (tp->ucopy.dma_chan) | 1734 | if (tp->ucopy.dma_chan) |
1735 | ret = tcp_v4_do_rcv(sk, skb); | 1735 | ret = tcp_v4_do_rcv(sk, skb); |
1736 | else | 1736 | else |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 364784a91939..7ac6423117ad 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -1096,6 +1096,7 @@ static void __pskb_trim_head(struct sk_buff *skb, int len) | |||
1096 | eat = min_t(int, len, skb_headlen(skb)); | 1096 | eat = min_t(int, len, skb_headlen(skb)); |
1097 | if (eat) { | 1097 | if (eat) { |
1098 | __skb_pull(skb, eat); | 1098 | __skb_pull(skb, eat); |
1099 | skb->avail_size -= eat; | ||
1099 | len -= eat; | 1100 | len -= eat; |
1100 | if (!len) | 1101 | if (!len) |
1101 | return; | 1102 | return; |
@@ -2060,7 +2061,7 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *to, | |||
2060 | /* Punt if not enough space exists in the first SKB for | 2061 | /* Punt if not enough space exists in the first SKB for |
2061 | * the data in the second | 2062 | * the data in the second |
2062 | */ | 2063 | */ |
2063 | if (skb->len > skb_tailroom(to)) | 2064 | if (skb->len > skb_availroom(to)) |
2064 | break; | 2065 | break; |
2065 | 2066 | ||
2066 | if (after(TCP_SKB_CB(skb)->end_seq, tcp_wnd_end(tp))) | 2067 | if (after(TCP_SKB_CB(skb)->end_seq, tcp_wnd_end(tp))) |
diff --git a/net/ipv4/udp_diag.c b/net/ipv4/udp_diag.c index 8a949f19deb6..a7f86a3cd502 100644 --- a/net/ipv4/udp_diag.c +++ b/net/ipv4/udp_diag.c | |||
@@ -146,9 +146,17 @@ static int udp_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh, | |||
146 | return udp_dump_one(&udp_table, in_skb, nlh, req); | 146 | return udp_dump_one(&udp_table, in_skb, nlh, req); |
147 | } | 147 | } |
148 | 148 | ||
149 | static void udp_diag_get_info(struct sock *sk, struct inet_diag_msg *r, | ||
150 | void *info) | ||
151 | { | ||
152 | r->idiag_rqueue = sk_rmem_alloc_get(sk); | ||
153 | r->idiag_wqueue = sk_wmem_alloc_get(sk); | ||
154 | } | ||
155 | |||
149 | static const struct inet_diag_handler udp_diag_handler = { | 156 | static const struct inet_diag_handler udp_diag_handler = { |
150 | .dump = udp_diag_dump, | 157 | .dump = udp_diag_dump, |
151 | .dump_one = udp_diag_dump_one, | 158 | .dump_one = udp_diag_dump_one, |
159 | .idiag_get_info = udp_diag_get_info, | ||
152 | .idiag_type = IPPROTO_UDP, | 160 | .idiag_type = IPPROTO_UDP, |
153 | }; | 161 | }; |
154 | 162 | ||
@@ -167,6 +175,7 @@ static int udplite_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr * | |||
167 | static const struct inet_diag_handler udplite_diag_handler = { | 175 | static const struct inet_diag_handler udplite_diag_handler = { |
168 | .dump = udplite_diag_dump, | 176 | .dump = udplite_diag_dump, |
169 | .dump_one = udplite_diag_dump_one, | 177 | .dump_one = udplite_diag_dump_one, |
178 | .idiag_get_info = udp_diag_get_info, | ||
170 | .idiag_type = IPPROTO_UDPLITE, | 179 | .idiag_type = IPPROTO_UDPLITE, |
171 | }; | 180 | }; |
172 | 181 | ||
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 6a3bb6077e19..7d5cb975cc6f 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -803,8 +803,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp) | |||
803 | ip6_del_rt(rt); | 803 | ip6_del_rt(rt); |
804 | rt = NULL; | 804 | rt = NULL; |
805 | } else if (!(rt->rt6i_flags & RTF_EXPIRES)) { | 805 | } else if (!(rt->rt6i_flags & RTF_EXPIRES)) { |
806 | rt->dst.expires = expires; | 806 | rt6_set_expires(rt, expires); |
807 | rt->rt6i_flags |= RTF_EXPIRES; | ||
808 | } | 807 | } |
809 | } | 808 | } |
810 | dst_release(&rt->dst); | 809 | dst_release(&rt->dst); |
@@ -1887,11 +1886,9 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao) | |||
1887 | rt = NULL; | 1886 | rt = NULL; |
1888 | } else if (addrconf_finite_timeout(rt_expires)) { | 1887 | } else if (addrconf_finite_timeout(rt_expires)) { |
1889 | /* not infinity */ | 1888 | /* not infinity */ |
1890 | rt->dst.expires = jiffies + rt_expires; | 1889 | rt6_set_expires(rt, jiffies + rt_expires); |
1891 | rt->rt6i_flags |= RTF_EXPIRES; | ||
1892 | } else { | 1890 | } else { |
1893 | rt->rt6i_flags &= ~RTF_EXPIRES; | 1891 | rt6_clean_expires(rt); |
1894 | rt->dst.expires = 0; | ||
1895 | } | 1892 | } |
1896 | } else if (valid_lft) { | 1893 | } else if (valid_lft) { |
1897 | clock_t expires = 0; | 1894 | clock_t expires = 0; |
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 5b27fbcae346..93717435013e 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -673,11 +673,10 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, | |||
673 | &rt->rt6i_gateway)) { | 673 | &rt->rt6i_gateway)) { |
674 | if (!(iter->rt6i_flags & RTF_EXPIRES)) | 674 | if (!(iter->rt6i_flags & RTF_EXPIRES)) |
675 | return -EEXIST; | 675 | return -EEXIST; |
676 | iter->dst.expires = rt->dst.expires; | 676 | if (!(rt->rt6i_flags & RTF_EXPIRES)) |
677 | if (!(rt->rt6i_flags & RTF_EXPIRES)) { | 677 | rt6_clean_expires(iter); |
678 | iter->rt6i_flags &= ~RTF_EXPIRES; | 678 | else |
679 | iter->dst.expires = 0; | 679 | rt6_set_expires(iter, rt->dst.expires); |
680 | } | ||
681 | return -EEXIST; | 680 | return -EEXIST; |
682 | } | 681 | } |
683 | } | 682 | } |
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 16c33e308121..b2869cab2092 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -2044,7 +2044,7 @@ static int ip6_mc_add_src(struct inet6_dev *idev, const struct in6_addr *pmca, | |||
2044 | if (!delta) | 2044 | if (!delta) |
2045 | pmc->mca_sfcount[sfmode]--; | 2045 | pmc->mca_sfcount[sfmode]--; |
2046 | for (j=0; j<i; j++) | 2046 | for (j=0; j<i; j++) |
2047 | (void) ip6_mc_del1_src(pmc, sfmode, &psfsrc[i]); | 2047 | ip6_mc_del1_src(pmc, sfmode, &psfsrc[j]); |
2048 | } else if (isexclude != (pmc->mca_sfcount[MCAST_EXCLUDE] != 0)) { | 2048 | } else if (isexclude != (pmc->mca_sfcount[MCAST_EXCLUDE] != 0)) { |
2049 | struct ip6_sf_list *psf; | 2049 | struct ip6_sf_list *psf; |
2050 | 2050 | ||
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 3dcdb81ec3e8..176b469322ac 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -1264,8 +1264,7 @@ static void ndisc_router_discovery(struct sk_buff *skb) | |||
1264 | } | 1264 | } |
1265 | 1265 | ||
1266 | if (rt) | 1266 | if (rt) |
1267 | rt->dst.expires = jiffies + (HZ * lifetime); | 1267 | rt6_set_expires(rt, jiffies + (HZ * lifetime)); |
1268 | |||
1269 | if (ra_msg->icmph.icmp6_hop_limit) { | 1268 | if (ra_msg->icmph.icmp6_hop_limit) { |
1270 | in6_dev->cnf.hop_limit = ra_msg->icmph.icmp6_hop_limit; | 1269 | in6_dev->cnf.hop_limit = ra_msg->icmph.icmp6_hop_limit; |
1271 | if (rt) | 1270 | if (rt) |
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index 94874b0bdcdc..9d4e15559319 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c | |||
@@ -78,19 +78,6 @@ EXPORT_SYMBOL_GPL(ip6t_alloc_initial_table); | |||
78 | 78 | ||
79 | Hence the start of any table is given by get_table() below. */ | 79 | Hence the start of any table is given by get_table() below. */ |
80 | 80 | ||
81 | /* Check for an extension */ | ||
82 | int | ||
83 | ip6t_ext_hdr(u8 nexthdr) | ||
84 | { | ||
85 | return (nexthdr == IPPROTO_HOPOPTS) || | ||
86 | (nexthdr == IPPROTO_ROUTING) || | ||
87 | (nexthdr == IPPROTO_FRAGMENT) || | ||
88 | (nexthdr == IPPROTO_ESP) || | ||
89 | (nexthdr == IPPROTO_AH) || | ||
90 | (nexthdr == IPPROTO_NONE) || | ||
91 | (nexthdr == IPPROTO_DSTOPTS); | ||
92 | } | ||
93 | |||
94 | /* Returns whether matches rule or not. */ | 81 | /* Returns whether matches rule or not. */ |
95 | /* Performance critical - called for every packet */ | 82 | /* Performance critical - called for every packet */ |
96 | static inline bool | 83 | static inline bool |
@@ -2366,7 +2353,6 @@ int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, | |||
2366 | EXPORT_SYMBOL(ip6t_register_table); | 2353 | EXPORT_SYMBOL(ip6t_register_table); |
2367 | EXPORT_SYMBOL(ip6t_unregister_table); | 2354 | EXPORT_SYMBOL(ip6t_unregister_table); |
2368 | EXPORT_SYMBOL(ip6t_do_table); | 2355 | EXPORT_SYMBOL(ip6t_do_table); |
2369 | EXPORT_SYMBOL(ip6t_ext_hdr); | ||
2370 | EXPORT_SYMBOL(ipv6_find_hdr); | 2356 | EXPORT_SYMBOL(ipv6_find_hdr); |
2371 | 2357 | ||
2372 | module_init(ip6_tables_init); | 2358 | module_init(ip6_tables_init); |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 496b62712fe8..bc4888d902b2 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -62,7 +62,7 @@ | |||
62 | #include <linux/sysctl.h> | 62 | #include <linux/sysctl.h> |
63 | #endif | 63 | #endif |
64 | 64 | ||
65 | static struct rt6_info *ip6_rt_copy(const struct rt6_info *ort, | 65 | static struct rt6_info *ip6_rt_copy(struct rt6_info *ort, |
66 | const struct in6_addr *dest); | 66 | const struct in6_addr *dest); |
67 | static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie); | 67 | static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie); |
68 | static unsigned int ip6_default_advmss(const struct dst_entry *dst); | 68 | static unsigned int ip6_default_advmss(const struct dst_entry *dst); |
@@ -285,6 +285,10 @@ static void ip6_dst_destroy(struct dst_entry *dst) | |||
285 | rt->rt6i_idev = NULL; | 285 | rt->rt6i_idev = NULL; |
286 | in6_dev_put(idev); | 286 | in6_dev_put(idev); |
287 | } | 287 | } |
288 | |||
289 | if (!(rt->rt6i_flags & RTF_EXPIRES) && dst->from) | ||
290 | dst_release(dst->from); | ||
291 | |||
288 | if (peer) { | 292 | if (peer) { |
289 | rt->rt6i_peer = NULL; | 293 | rt->rt6i_peer = NULL; |
290 | inet_putpeer(peer); | 294 | inet_putpeer(peer); |
@@ -329,8 +333,17 @@ static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev, | |||
329 | 333 | ||
330 | static __inline__ int rt6_check_expired(const struct rt6_info *rt) | 334 | static __inline__ int rt6_check_expired(const struct rt6_info *rt) |
331 | { | 335 | { |
332 | return (rt->rt6i_flags & RTF_EXPIRES) && | 336 | struct rt6_info *ort = NULL; |
333 | time_after(jiffies, rt->dst.expires); | 337 | |
338 | if (rt->rt6i_flags & RTF_EXPIRES) { | ||
339 | if (time_after(jiffies, rt->dst.expires)) | ||
340 | return 1; | ||
341 | } else if (rt->dst.from) { | ||
342 | ort = (struct rt6_info *) rt->dst.from; | ||
343 | return (ort->rt6i_flags & RTF_EXPIRES) && | ||
344 | time_after(jiffies, ort->dst.expires); | ||
345 | } | ||
346 | return 0; | ||
334 | } | 347 | } |
335 | 348 | ||
336 | static inline int rt6_need_strict(const struct in6_addr *daddr) | 349 | static inline int rt6_need_strict(const struct in6_addr *daddr) |
@@ -620,12 +633,11 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len, | |||
620 | (rt->rt6i_flags & ~RTF_PREF_MASK) | RTF_PREF(pref); | 633 | (rt->rt6i_flags & ~RTF_PREF_MASK) | RTF_PREF(pref); |
621 | 634 | ||
622 | if (rt) { | 635 | if (rt) { |
623 | if (!addrconf_finite_timeout(lifetime)) { | 636 | if (!addrconf_finite_timeout(lifetime)) |
624 | rt->rt6i_flags &= ~RTF_EXPIRES; | 637 | rt6_clean_expires(rt); |
625 | } else { | 638 | else |
626 | rt->dst.expires = jiffies + HZ * lifetime; | 639 | rt6_set_expires(rt, jiffies + HZ * lifetime); |
627 | rt->rt6i_flags |= RTF_EXPIRES; | 640 | |
628 | } | ||
629 | dst_release(&rt->dst); | 641 | dst_release(&rt->dst); |
630 | } | 642 | } |
631 | return 0; | 643 | return 0; |
@@ -730,7 +742,7 @@ int ip6_ins_rt(struct rt6_info *rt) | |||
730 | return __ip6_ins_rt(rt, &info); | 742 | return __ip6_ins_rt(rt, &info); |
731 | } | 743 | } |
732 | 744 | ||
733 | static struct rt6_info *rt6_alloc_cow(const struct rt6_info *ort, | 745 | static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, |
734 | const struct in6_addr *daddr, | 746 | const struct in6_addr *daddr, |
735 | const struct in6_addr *saddr) | 747 | const struct in6_addr *saddr) |
736 | { | 748 | { |
@@ -881,6 +893,16 @@ static struct rt6_info *ip6_pol_route_input(struct net *net, struct fib6_table * | |||
881 | return ip6_pol_route(net, table, fl6->flowi6_iif, fl6, flags); | 893 | return ip6_pol_route(net, table, fl6->flowi6_iif, fl6, flags); |
882 | } | 894 | } |
883 | 895 | ||
896 | static struct dst_entry *ip6_route_input_lookup(struct net *net, | ||
897 | struct net_device *dev, | ||
898 | struct flowi6 *fl6, int flags) | ||
899 | { | ||
900 | if (rt6_need_strict(&fl6->daddr) && dev->type != ARPHRD_PIMREG) | ||
901 | flags |= RT6_LOOKUP_F_IFACE; | ||
902 | |||
903 | return fib6_rule_lookup(net, fl6, flags, ip6_pol_route_input); | ||
904 | } | ||
905 | |||
884 | void ip6_route_input(struct sk_buff *skb) | 906 | void ip6_route_input(struct sk_buff *skb) |
885 | { | 907 | { |
886 | const struct ipv6hdr *iph = ipv6_hdr(skb); | 908 | const struct ipv6hdr *iph = ipv6_hdr(skb); |
@@ -895,10 +917,7 @@ void ip6_route_input(struct sk_buff *skb) | |||
895 | .flowi6_proto = iph->nexthdr, | 917 | .flowi6_proto = iph->nexthdr, |
896 | }; | 918 | }; |
897 | 919 | ||
898 | if (rt6_need_strict(&iph->daddr) && skb->dev->type != ARPHRD_PIMREG) | 920 | skb_dst_set(skb, ip6_route_input_lookup(net, skb->dev, &fl6, flags)); |
899 | flags |= RT6_LOOKUP_F_IFACE; | ||
900 | |||
901 | skb_dst_set(skb, fib6_rule_lookup(net, &fl6, flags, ip6_pol_route_input)); | ||
902 | } | 921 | } |
903 | 922 | ||
904 | static struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table *table, | 923 | static struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table *table, |
@@ -947,10 +966,10 @@ struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_ori | |||
947 | rt->rt6i_idev = ort->rt6i_idev; | 966 | rt->rt6i_idev = ort->rt6i_idev; |
948 | if (rt->rt6i_idev) | 967 | if (rt->rt6i_idev) |
949 | in6_dev_hold(rt->rt6i_idev); | 968 | in6_dev_hold(rt->rt6i_idev); |
950 | rt->dst.expires = 0; | ||
951 | 969 | ||
952 | rt->rt6i_gateway = ort->rt6i_gateway; | 970 | rt->rt6i_gateway = ort->rt6i_gateway; |
953 | rt->rt6i_flags = ort->rt6i_flags & ~RTF_EXPIRES; | 971 | rt->rt6i_flags = ort->rt6i_flags; |
972 | rt6_clean_expires(rt); | ||
954 | rt->rt6i_metric = 0; | 973 | rt->rt6i_metric = 0; |
955 | 974 | ||
956 | memcpy(&rt->rt6i_dst, &ort->rt6i_dst, sizeof(struct rt6key)); | 975 | memcpy(&rt->rt6i_dst, &ort->rt6i_dst, sizeof(struct rt6key)); |
@@ -1012,10 +1031,9 @@ static void ip6_link_failure(struct sk_buff *skb) | |||
1012 | 1031 | ||
1013 | rt = (struct rt6_info *) skb_dst(skb); | 1032 | rt = (struct rt6_info *) skb_dst(skb); |
1014 | if (rt) { | 1033 | if (rt) { |
1015 | if (rt->rt6i_flags & RTF_CACHE) { | 1034 | if (rt->rt6i_flags & RTF_CACHE) |
1016 | dst_set_expires(&rt->dst, 0); | 1035 | rt6_update_expires(rt, 0); |
1017 | rt->rt6i_flags |= RTF_EXPIRES; | 1036 | else if (rt->rt6i_node && (rt->rt6i_flags & RTF_DEFAULT)) |
1018 | } else if (rt->rt6i_node && (rt->rt6i_flags & RTF_DEFAULT)) | ||
1019 | rt->rt6i_node->fn_sernum = -1; | 1037 | rt->rt6i_node->fn_sernum = -1; |
1020 | } | 1038 | } |
1021 | } | 1039 | } |
@@ -1282,9 +1300,12 @@ int ip6_route_add(struct fib6_config *cfg) | |||
1282 | } | 1300 | } |
1283 | 1301 | ||
1284 | rt->dst.obsolete = -1; | 1302 | rt->dst.obsolete = -1; |
1285 | rt->dst.expires = (cfg->fc_flags & RTF_EXPIRES) ? | 1303 | |
1286 | jiffies + clock_t_to_jiffies(cfg->fc_expires) : | 1304 | if (cfg->fc_flags & RTF_EXPIRES) |
1287 | 0; | 1305 | rt6_set_expires(rt, jiffies + |
1306 | clock_t_to_jiffies(cfg->fc_expires)); | ||
1307 | else | ||
1308 | rt6_clean_expires(rt); | ||
1288 | 1309 | ||
1289 | if (cfg->fc_protocol == RTPROT_UNSPEC) | 1310 | if (cfg->fc_protocol == RTPROT_UNSPEC) |
1290 | cfg->fc_protocol = RTPROT_BOOT; | 1311 | cfg->fc_protocol = RTPROT_BOOT; |
@@ -1729,8 +1750,8 @@ again: | |||
1729 | features |= RTAX_FEATURE_ALLFRAG; | 1750 | features |= RTAX_FEATURE_ALLFRAG; |
1730 | dst_metric_set(&rt->dst, RTAX_FEATURES, features); | 1751 | dst_metric_set(&rt->dst, RTAX_FEATURES, features); |
1731 | } | 1752 | } |
1732 | dst_set_expires(&rt->dst, net->ipv6.sysctl.ip6_rt_mtu_expires); | 1753 | rt6_update_expires(rt, net->ipv6.sysctl.ip6_rt_mtu_expires); |
1733 | rt->rt6i_flags |= RTF_MODIFIED|RTF_EXPIRES; | 1754 | rt->rt6i_flags |= RTF_MODIFIED; |
1734 | goto out; | 1755 | goto out; |
1735 | } | 1756 | } |
1736 | 1757 | ||
@@ -1758,9 +1779,8 @@ again: | |||
1758 | * which is 10 mins. After 10 mins the decreased pmtu is expired | 1779 | * which is 10 mins. After 10 mins the decreased pmtu is expired |
1759 | * and detecting PMTU increase will be automatically happened. | 1780 | * and detecting PMTU increase will be automatically happened. |
1760 | */ | 1781 | */ |
1761 | dst_set_expires(&nrt->dst, net->ipv6.sysctl.ip6_rt_mtu_expires); | 1782 | rt6_update_expires(nrt, net->ipv6.sysctl.ip6_rt_mtu_expires); |
1762 | nrt->rt6i_flags |= RTF_DYNAMIC|RTF_EXPIRES; | 1783 | nrt->rt6i_flags |= RTF_DYNAMIC; |
1763 | |||
1764 | ip6_ins_rt(nrt); | 1784 | ip6_ins_rt(nrt); |
1765 | } | 1785 | } |
1766 | out: | 1786 | out: |
@@ -1792,7 +1812,7 @@ void rt6_pmtu_discovery(const struct in6_addr *daddr, const struct in6_addr *sad | |||
1792 | * Misc support functions | 1812 | * Misc support functions |
1793 | */ | 1813 | */ |
1794 | 1814 | ||
1795 | static struct rt6_info *ip6_rt_copy(const struct rt6_info *ort, | 1815 | static struct rt6_info *ip6_rt_copy(struct rt6_info *ort, |
1796 | const struct in6_addr *dest) | 1816 | const struct in6_addr *dest) |
1797 | { | 1817 | { |
1798 | struct net *net = dev_net(ort->dst.dev); | 1818 | struct net *net = dev_net(ort->dst.dev); |
@@ -1812,10 +1832,14 @@ static struct rt6_info *ip6_rt_copy(const struct rt6_info *ort, | |||
1812 | if (rt->rt6i_idev) | 1832 | if (rt->rt6i_idev) |
1813 | in6_dev_hold(rt->rt6i_idev); | 1833 | in6_dev_hold(rt->rt6i_idev); |
1814 | rt->dst.lastuse = jiffies; | 1834 | rt->dst.lastuse = jiffies; |
1815 | rt->dst.expires = 0; | ||
1816 | 1835 | ||
1817 | rt->rt6i_gateway = ort->rt6i_gateway; | 1836 | rt->rt6i_gateway = ort->rt6i_gateway; |
1818 | rt->rt6i_flags = ort->rt6i_flags & ~RTF_EXPIRES; | 1837 | rt->rt6i_flags = ort->rt6i_flags; |
1838 | if ((ort->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) == | ||
1839 | (RTF_DEFAULT | RTF_ADDRCONF)) | ||
1840 | rt6_set_from(rt, ort); | ||
1841 | else | ||
1842 | rt6_clean_expires(rt); | ||
1819 | rt->rt6i_metric = 0; | 1843 | rt->rt6i_metric = 0; |
1820 | 1844 | ||
1821 | #ifdef CONFIG_IPV6_SUBTREES | 1845 | #ifdef CONFIG_IPV6_SUBTREES |
@@ -2537,7 +2561,7 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void | |||
2537 | struct sk_buff *skb; | 2561 | struct sk_buff *skb; |
2538 | struct rtmsg *rtm; | 2562 | struct rtmsg *rtm; |
2539 | struct flowi6 fl6; | 2563 | struct flowi6 fl6; |
2540 | int err, iif = 0; | 2564 | int err, iif = 0, oif = 0; |
2541 | 2565 | ||
2542 | err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv6_policy); | 2566 | err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv6_policy); |
2543 | if (err < 0) | 2567 | if (err < 0) |
@@ -2564,15 +2588,29 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void | |||
2564 | iif = nla_get_u32(tb[RTA_IIF]); | 2588 | iif = nla_get_u32(tb[RTA_IIF]); |
2565 | 2589 | ||
2566 | if (tb[RTA_OIF]) | 2590 | if (tb[RTA_OIF]) |
2567 | fl6.flowi6_oif = nla_get_u32(tb[RTA_OIF]); | 2591 | oif = nla_get_u32(tb[RTA_OIF]); |
2568 | 2592 | ||
2569 | if (iif) { | 2593 | if (iif) { |
2570 | struct net_device *dev; | 2594 | struct net_device *dev; |
2595 | int flags = 0; | ||
2596 | |||
2571 | dev = __dev_get_by_index(net, iif); | 2597 | dev = __dev_get_by_index(net, iif); |
2572 | if (!dev) { | 2598 | if (!dev) { |
2573 | err = -ENODEV; | 2599 | err = -ENODEV; |
2574 | goto errout; | 2600 | goto errout; |
2575 | } | 2601 | } |
2602 | |||
2603 | fl6.flowi6_iif = iif; | ||
2604 | |||
2605 | if (!ipv6_addr_any(&fl6.saddr)) | ||
2606 | flags |= RT6_LOOKUP_F_HAS_SADDR; | ||
2607 | |||
2608 | rt = (struct rt6_info *)ip6_route_input_lookup(net, dev, &fl6, | ||
2609 | flags); | ||
2610 | } else { | ||
2611 | fl6.flowi6_oif = oif; | ||
2612 | |||
2613 | rt = (struct rt6_info *)ip6_route_output(net, NULL, &fl6); | ||
2576 | } | 2614 | } |
2577 | 2615 | ||
2578 | skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); | 2616 | skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); |
@@ -2587,7 +2625,6 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void | |||
2587 | skb_reset_mac_header(skb); | 2625 | skb_reset_mac_header(skb); |
2588 | skb_reserve(skb, MAX_HEADER + sizeof(struct ipv6hdr)); | 2626 | skb_reserve(skb, MAX_HEADER + sizeof(struct ipv6hdr)); |
2589 | 2627 | ||
2590 | rt = (struct rt6_info*) ip6_route_output(net, NULL, &fl6); | ||
2591 | skb_dst_set(skb, &rt->dst); | 2628 | skb_dst_set(skb, &rt->dst); |
2592 | 2629 | ||
2593 | err = rt6_fill_node(net, skb, rt, &fl6.daddr, &fl6.saddr, iif, | 2630 | err = rt6_fill_node(net, skb, rt, &fl6.daddr, &fl6.saddr, iif, |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 12c6ece67f39..98256cf72f9d 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -1383,6 +1383,10 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1383 | tcp_mtup_init(newsk); | 1383 | tcp_mtup_init(newsk); |
1384 | tcp_sync_mss(newsk, dst_mtu(dst)); | 1384 | tcp_sync_mss(newsk, dst_mtu(dst)); |
1385 | newtp->advmss = dst_metric_advmss(dst); | 1385 | newtp->advmss = dst_metric_advmss(dst); |
1386 | if (tcp_sk(sk)->rx_opt.user_mss && | ||
1387 | tcp_sk(sk)->rx_opt.user_mss < newtp->advmss) | ||
1388 | newtp->advmss = tcp_sk(sk)->rx_opt.user_mss; | ||
1389 | |||
1386 | tcp_initialize_rcv_mss(newsk); | 1390 | tcp_initialize_rcv_mss(newsk); |
1387 | if (tcp_rsk(req)->snt_synack) | 1391 | if (tcp_rsk(req)->snt_synack) |
1388 | tcp_valid_rtt_meas(newsk, | 1392 | tcp_valid_rtt_meas(newsk, |
@@ -1645,7 +1649,7 @@ process: | |||
1645 | #ifdef CONFIG_NET_DMA | 1649 | #ifdef CONFIG_NET_DMA |
1646 | struct tcp_sock *tp = tcp_sk(sk); | 1650 | struct tcp_sock *tp = tcp_sk(sk); |
1647 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) | 1651 | if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) |
1648 | tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY); | 1652 | tp->ucopy.dma_chan = net_dma_find_channel(); |
1649 | if (tp->ucopy.dma_chan) | 1653 | if (tp->ucopy.dma_chan) |
1650 | ret = tcp_v6_do_rcv(sk, skb); | 1654 | ret = tcp_v6_do_rcv(sk, skb); |
1651 | else | 1655 | else |
diff --git a/net/key/af_key.c b/net/key/af_key.c index 11dbb2255ccb..7e5d927b576f 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
@@ -3480,7 +3480,7 @@ static int pfkey_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, | |||
3480 | 3480 | ||
3481 | /* Addresses to be used by KM for negotiation, if ext is available */ | 3481 | /* Addresses to be used by KM for negotiation, if ext is available */ |
3482 | if (k != NULL && (set_sadb_kmaddress(skb, k) < 0)) | 3482 | if (k != NULL && (set_sadb_kmaddress(skb, k) < 0)) |
3483 | return -EINVAL; | 3483 | goto err; |
3484 | 3484 | ||
3485 | /* selector src */ | 3485 | /* selector src */ |
3486 | set_sadb_address(skb, sasize_sel, SADB_EXT_ADDRESS_SRC, sel); | 3486 | set_sadb_address(skb, sasize_sel, SADB_EXT_ADDRESS_SRC, sel); |
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c index 55670ec3cd0f..6274f0be82b0 100644 --- a/net/l2tp/l2tp_ip.c +++ b/net/l2tp/l2tp_ip.c | |||
@@ -232,7 +232,7 @@ static void l2tp_ip_close(struct sock *sk, long timeout) | |||
232 | { | 232 | { |
233 | write_lock_bh(&l2tp_ip_lock); | 233 | write_lock_bh(&l2tp_ip_lock); |
234 | hlist_del_init(&sk->sk_bind_node); | 234 | hlist_del_init(&sk->sk_bind_node); |
235 | hlist_del_init(&sk->sk_node); | 235 | sk_del_node_init(sk); |
236 | write_unlock_bh(&l2tp_ip_lock); | 236 | write_unlock_bh(&l2tp_ip_lock); |
237 | sk_common_release(sk); | 237 | sk_common_release(sk); |
238 | } | 238 | } |
@@ -271,7 +271,8 @@ static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
271 | chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST) | 271 | chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST) |
272 | goto out; | 272 | goto out; |
273 | 273 | ||
274 | inet->inet_rcv_saddr = inet->inet_saddr = addr->l2tp_addr.s_addr; | 274 | if (addr->l2tp_addr.s_addr) |
275 | inet->inet_rcv_saddr = inet->inet_saddr = addr->l2tp_addr.s_addr; | ||
275 | if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST) | 276 | if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST) |
276 | inet->inet_saddr = 0; /* Use device */ | 277 | inet->inet_saddr = 0; /* Use device */ |
277 | sk_dst_reset(sk); | 278 | sk_dst_reset(sk); |
@@ -441,8 +442,9 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m | |||
441 | 442 | ||
442 | daddr = lip->l2tp_addr.s_addr; | 443 | daddr = lip->l2tp_addr.s_addr; |
443 | } else { | 444 | } else { |
445 | rc = -EDESTADDRREQ; | ||
444 | if (sk->sk_state != TCP_ESTABLISHED) | 446 | if (sk->sk_state != TCP_ESTABLISHED) |
445 | return -EDESTADDRREQ; | 447 | goto out; |
446 | 448 | ||
447 | daddr = inet->inet_daddr; | 449 | daddr = inet->inet_daddr; |
448 | connected = 1; | 450 | connected = 1; |
diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c index 1068f668ac4e..64d3ce5ea1a0 100644 --- a/net/mac80211/agg-rx.c +++ b/net/mac80211/agg-rx.c | |||
@@ -49,6 +49,8 @@ static void ieee80211_free_tid_rx(struct rcu_head *h) | |||
49 | container_of(h, struct tid_ampdu_rx, rcu_head); | 49 | container_of(h, struct tid_ampdu_rx, rcu_head); |
50 | int i; | 50 | int i; |
51 | 51 | ||
52 | del_timer_sync(&tid_rx->reorder_timer); | ||
53 | |||
52 | for (i = 0; i < tid_rx->buf_size; i++) | 54 | for (i = 0; i < tid_rx->buf_size; i++) |
53 | dev_kfree_skb(tid_rx->reorder_buf[i]); | 55 | dev_kfree_skb(tid_rx->reorder_buf[i]); |
54 | kfree(tid_rx->reorder_buf); | 56 | kfree(tid_rx->reorder_buf); |
@@ -91,7 +93,6 @@ void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid, | |||
91 | tid, WLAN_BACK_RECIPIENT, reason); | 93 | tid, WLAN_BACK_RECIPIENT, reason); |
92 | 94 | ||
93 | del_timer_sync(&tid_rx->session_timer); | 95 | del_timer_sync(&tid_rx->session_timer); |
94 | del_timer_sync(&tid_rx->reorder_timer); | ||
95 | 96 | ||
96 | call_rcu(&tid_rx->rcu_head, ieee80211_free_tid_rx); | 97 | call_rcu(&tid_rx->rcu_head, ieee80211_free_tid_rx); |
97 | } | 98 | } |
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c index cc5b7a6e7e0b..778e5916d7c3 100644 --- a/net/mac80211/debugfs.c +++ b/net/mac80211/debugfs.c | |||
@@ -15,12 +15,6 @@ | |||
15 | #include "rate.h" | 15 | #include "rate.h" |
16 | #include "debugfs.h" | 16 | #include "debugfs.h" |
17 | 17 | ||
18 | int mac80211_open_file_generic(struct inode *inode, struct file *file) | ||
19 | { | ||
20 | file->private_data = inode->i_private; | ||
21 | return 0; | ||
22 | } | ||
23 | |||
24 | #define DEBUGFS_FORMAT_BUFFER_SIZE 100 | 18 | #define DEBUGFS_FORMAT_BUFFER_SIZE 100 |
25 | 19 | ||
26 | int mac80211_format_buffer(char __user *userbuf, size_t count, | 20 | int mac80211_format_buffer(char __user *userbuf, size_t count, |
@@ -50,7 +44,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \ | |||
50 | #define DEBUGFS_READONLY_FILE_OPS(name) \ | 44 | #define DEBUGFS_READONLY_FILE_OPS(name) \ |
51 | static const struct file_operations name## _ops = { \ | 45 | static const struct file_operations name## _ops = { \ |
52 | .read = name## _read, \ | 46 | .read = name## _read, \ |
53 | .open = mac80211_open_file_generic, \ | 47 | .open = simple_open, \ |
54 | .llseek = generic_file_llseek, \ | 48 | .llseek = generic_file_llseek, \ |
55 | }; | 49 | }; |
56 | 50 | ||
@@ -93,7 +87,7 @@ static ssize_t reset_write(struct file *file, const char __user *user_buf, | |||
93 | 87 | ||
94 | static const struct file_operations reset_ops = { | 88 | static const struct file_operations reset_ops = { |
95 | .write = reset_write, | 89 | .write = reset_write, |
96 | .open = mac80211_open_file_generic, | 90 | .open = simple_open, |
97 | .llseek = noop_llseek, | 91 | .llseek = noop_llseek, |
98 | }; | 92 | }; |
99 | 93 | ||
@@ -254,7 +248,7 @@ static ssize_t stats_ ##name## _read(struct file *file, \ | |||
254 | \ | 248 | \ |
255 | static const struct file_operations stats_ ##name## _ops = { \ | 249 | static const struct file_operations stats_ ##name## _ops = { \ |
256 | .read = stats_ ##name## _read, \ | 250 | .read = stats_ ##name## _read, \ |
257 | .open = mac80211_open_file_generic, \ | 251 | .open = simple_open, \ |
258 | .llseek = generic_file_llseek, \ | 252 | .llseek = generic_file_llseek, \ |
259 | }; | 253 | }; |
260 | 254 | ||
diff --git a/net/mac80211/debugfs.h b/net/mac80211/debugfs.h index 7c87529630f5..9be4e6d71d00 100644 --- a/net/mac80211/debugfs.h +++ b/net/mac80211/debugfs.h | |||
@@ -3,7 +3,6 @@ | |||
3 | 3 | ||
4 | #ifdef CONFIG_MAC80211_DEBUGFS | 4 | #ifdef CONFIG_MAC80211_DEBUGFS |
5 | extern void debugfs_hw_add(struct ieee80211_local *local); | 5 | extern void debugfs_hw_add(struct ieee80211_local *local); |
6 | extern int mac80211_open_file_generic(struct inode *inode, struct file *file); | ||
7 | extern int mac80211_format_buffer(char __user *userbuf, size_t count, | 6 | extern int mac80211_format_buffer(char __user *userbuf, size_t count, |
8 | loff_t *ppos, char *fmt, ...); | 7 | loff_t *ppos, char *fmt, ...); |
9 | #else | 8 | #else |
diff --git a/net/mac80211/debugfs_key.c b/net/mac80211/debugfs_key.c index 59edcd95a58d..7932767bb482 100644 --- a/net/mac80211/debugfs_key.c +++ b/net/mac80211/debugfs_key.c | |||
@@ -30,7 +30,7 @@ static ssize_t key_##name##_read(struct file *file, \ | |||
30 | #define KEY_OPS(name) \ | 30 | #define KEY_OPS(name) \ |
31 | static const struct file_operations key_ ##name## _ops = { \ | 31 | static const struct file_operations key_ ##name## _ops = { \ |
32 | .read = key_##name##_read, \ | 32 | .read = key_##name##_read, \ |
33 | .open = mac80211_open_file_generic, \ | 33 | .open = simple_open, \ |
34 | .llseek = generic_file_llseek, \ | 34 | .llseek = generic_file_llseek, \ |
35 | } | 35 | } |
36 | 36 | ||
@@ -45,7 +45,7 @@ static const struct file_operations key_ ##name## _ops = { \ | |||
45 | #define KEY_CONF_OPS(name) \ | 45 | #define KEY_CONF_OPS(name) \ |
46 | static const struct file_operations key_ ##name## _ops = { \ | 46 | static const struct file_operations key_ ##name## _ops = { \ |
47 | .read = key_conf_##name##_read, \ | 47 | .read = key_conf_##name##_read, \ |
48 | .open = mac80211_open_file_generic, \ | 48 | .open = simple_open, \ |
49 | .llseek = generic_file_llseek, \ | 49 | .llseek = generic_file_llseek, \ |
50 | } | 50 | } |
51 | 51 | ||
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index a32eeda04aa3..30f99c344847 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c | |||
@@ -135,7 +135,7 @@ static ssize_t ieee80211_if_read_##name(struct file *file, \ | |||
135 | static const struct file_operations name##_ops = { \ | 135 | static const struct file_operations name##_ops = { \ |
136 | .read = ieee80211_if_read_##name, \ | 136 | .read = ieee80211_if_read_##name, \ |
137 | .write = (_write), \ | 137 | .write = (_write), \ |
138 | .open = mac80211_open_file_generic, \ | 138 | .open = simple_open, \ |
139 | .llseek = generic_file_llseek, \ | 139 | .llseek = generic_file_llseek, \ |
140 | } | 140 | } |
141 | 141 | ||
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c index 6d45804d09bc..832b2da5e4cd 100644 --- a/net/mac80211/debugfs_sta.c +++ b/net/mac80211/debugfs_sta.c | |||
@@ -33,7 +33,7 @@ static ssize_t sta_ ##name## _read(struct file *file, \ | |||
33 | #define STA_OPS(name) \ | 33 | #define STA_OPS(name) \ |
34 | static const struct file_operations sta_ ##name## _ops = { \ | 34 | static const struct file_operations sta_ ##name## _ops = { \ |
35 | .read = sta_##name##_read, \ | 35 | .read = sta_##name##_read, \ |
36 | .open = mac80211_open_file_generic, \ | 36 | .open = simple_open, \ |
37 | .llseek = generic_file_llseek, \ | 37 | .llseek = generic_file_llseek, \ |
38 | } | 38 | } |
39 | 39 | ||
@@ -41,7 +41,7 @@ static const struct file_operations sta_ ##name## _ops = { \ | |||
41 | static const struct file_operations sta_ ##name## _ops = { \ | 41 | static const struct file_operations sta_ ##name## _ops = { \ |
42 | .read = sta_##name##_read, \ | 42 | .read = sta_##name##_read, \ |
43 | .write = sta_##name##_write, \ | 43 | .write = sta_##name##_write, \ |
44 | .open = mac80211_open_file_generic, \ | 44 | .open = simple_open, \ |
45 | .llseek = generic_file_llseek, \ | 45 | .llseek = generic_file_llseek, \ |
46 | } | 46 | } |
47 | 47 | ||
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 33fd8d9f714e..cef7c29214a8 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
@@ -457,8 +457,8 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
457 | * fall back to HT20 if we don't use or use | 457 | * fall back to HT20 if we don't use or use |
458 | * the other extension channel | 458 | * the other extension channel |
459 | */ | 459 | */ |
460 | if ((channel_type == NL80211_CHAN_HT40MINUS || | 460 | if (!(channel_type == NL80211_CHAN_HT40MINUS || |
461 | channel_type == NL80211_CHAN_HT40PLUS) && | 461 | channel_type == NL80211_CHAN_HT40PLUS) || |
462 | channel_type != sdata->u.ibss.channel_type) | 462 | channel_type != sdata->u.ibss.channel_type) |
463 | sta_ht_cap_new.cap &= | 463 | sta_ht_cap_new.cap &= |
464 | ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; | 464 | ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index d9798a307f20..db8fae51714c 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -1210,7 +1210,7 @@ void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, | |||
1210 | struct sk_buff *skb); | 1210 | struct sk_buff *skb); |
1211 | void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata); | 1211 | void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata); |
1212 | void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata); | 1212 | void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata); |
1213 | void ieee80211_mgd_teardown(struct ieee80211_sub_if_data *sdata); | 1213 | void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata); |
1214 | 1214 | ||
1215 | /* IBSS code */ | 1215 | /* IBSS code */ |
1216 | void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local); | 1216 | void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local); |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 401c01f0731e..c20051b7ffcd 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -486,6 +486,8 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
486 | /* free all potentially still buffered bcast frames */ | 486 | /* free all potentially still buffered bcast frames */ |
487 | local->total_ps_buffered -= skb_queue_len(&sdata->u.ap.ps_bc_buf); | 487 | local->total_ps_buffered -= skb_queue_len(&sdata->u.ap.ps_bc_buf); |
488 | skb_queue_purge(&sdata->u.ap.ps_bc_buf); | 488 | skb_queue_purge(&sdata->u.ap.ps_bc_buf); |
489 | } else if (sdata->vif.type == NL80211_IFTYPE_STATION) { | ||
490 | ieee80211_mgd_stop(sdata); | ||
489 | } | 491 | } |
490 | 492 | ||
491 | if (going_down) | 493 | if (going_down) |
@@ -644,8 +646,6 @@ static void ieee80211_teardown_sdata(struct net_device *dev) | |||
644 | 646 | ||
645 | if (ieee80211_vif_is_mesh(&sdata->vif)) | 647 | if (ieee80211_vif_is_mesh(&sdata->vif)) |
646 | mesh_rmc_free(sdata); | 648 | mesh_rmc_free(sdata); |
647 | else if (sdata->vif.type == NL80211_IFTYPE_STATION) | ||
648 | ieee80211_mgd_teardown(sdata); | ||
649 | 649 | ||
650 | flushed = sta_info_flush(local, sdata); | 650 | flushed = sta_info_flush(local, sdata); |
651 | WARN_ON(flushed); | 651 | WARN_ON(flushed); |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index b581a24fa15c..16336480c631 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -102,9 +102,6 @@ int ieee80211_hw_config(struct ieee80211_local *local, u32 changed) | |||
102 | 102 | ||
103 | might_sleep(); | 103 | might_sleep(); |
104 | 104 | ||
105 | /* If this off-channel logic ever changes, ieee80211_on_oper_channel | ||
106 | * may need to change as well. | ||
107 | */ | ||
108 | offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL; | 105 | offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL; |
109 | if (local->scan_channel) { | 106 | if (local->scan_channel) { |
110 | chan = local->scan_channel; | 107 | chan = local->scan_channel; |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 576fb25456dd..20c680bfc3ae 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -3387,8 +3387,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, | |||
3387 | */ | 3387 | */ |
3388 | printk(KERN_DEBUG "%s: waiting for beacon from %pM\n", | 3388 | printk(KERN_DEBUG "%s: waiting for beacon from %pM\n", |
3389 | sdata->name, ifmgd->bssid); | 3389 | sdata->name, ifmgd->bssid); |
3390 | assoc_data->timeout = jiffies + | 3390 | assoc_data->timeout = TU_TO_EXP_TIME(req->bss->beacon_interval); |
3391 | TU_TO_EXP_TIME(req->bss->beacon_interval); | ||
3392 | } else { | 3391 | } else { |
3393 | assoc_data->have_beacon = true; | 3392 | assoc_data->have_beacon = true; |
3394 | assoc_data->sent_assoc = false; | 3393 | assoc_data->sent_assoc = false; |
@@ -3498,7 +3497,7 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, | |||
3498 | return 0; | 3497 | return 0; |
3499 | } | 3498 | } |
3500 | 3499 | ||
3501 | void ieee80211_mgd_teardown(struct ieee80211_sub_if_data *sdata) | 3500 | void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata) |
3502 | { | 3501 | { |
3503 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | 3502 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
3504 | 3503 | ||
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c index b4f7600a3e36..3313c117b322 100644 --- a/net/mac80211/rate.c +++ b/net/mac80211/rate.c | |||
@@ -145,7 +145,7 @@ static ssize_t rcname_read(struct file *file, char __user *userbuf, | |||
145 | 145 | ||
146 | static const struct file_operations rcname_ops = { | 146 | static const struct file_operations rcname_ops = { |
147 | .read = rcname_read, | 147 | .read = rcname_read, |
148 | .open = mac80211_open_file_generic, | 148 | .open = simple_open, |
149 | .llseek = default_llseek, | 149 | .llseek = default_llseek, |
150 | }; | 150 | }; |
151 | #endif | 151 | #endif |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index bcfe8c77c839..d64e285400aa 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -103,7 +103,7 @@ static void | |||
103 | ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, | 103 | ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, |
104 | struct sk_buff *skb, | 104 | struct sk_buff *skb, |
105 | struct ieee80211_rate *rate, | 105 | struct ieee80211_rate *rate, |
106 | int rtap_len) | 106 | int rtap_len, bool has_fcs) |
107 | { | 107 | { |
108 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | 108 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); |
109 | struct ieee80211_radiotap_header *rthdr; | 109 | struct ieee80211_radiotap_header *rthdr; |
@@ -134,7 +134,7 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, | |||
134 | } | 134 | } |
135 | 135 | ||
136 | /* IEEE80211_RADIOTAP_FLAGS */ | 136 | /* IEEE80211_RADIOTAP_FLAGS */ |
137 | if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS) | 137 | if (has_fcs && (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS)) |
138 | *pos |= IEEE80211_RADIOTAP_F_FCS; | 138 | *pos |= IEEE80211_RADIOTAP_F_FCS; |
139 | if (status->flag & (RX_FLAG_FAILED_FCS_CRC | RX_FLAG_FAILED_PLCP_CRC)) | 139 | if (status->flag & (RX_FLAG_FAILED_FCS_CRC | RX_FLAG_FAILED_PLCP_CRC)) |
140 | *pos |= IEEE80211_RADIOTAP_F_BADFCS; | 140 | *pos |= IEEE80211_RADIOTAP_F_BADFCS; |
@@ -294,7 +294,8 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb, | |||
294 | } | 294 | } |
295 | 295 | ||
296 | /* prepend radiotap information */ | 296 | /* prepend radiotap information */ |
297 | ieee80211_add_rx_radiotap_header(local, skb, rate, needed_headroom); | 297 | ieee80211_add_rx_radiotap_header(local, skb, rate, needed_headroom, |
298 | true); | ||
298 | 299 | ||
299 | skb_reset_mac_header(skb); | 300 | skb_reset_mac_header(skb); |
300 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 301 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
@@ -2571,7 +2572,8 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx, | |||
2571 | goto out_free_skb; | 2572 | goto out_free_skb; |
2572 | 2573 | ||
2573 | /* prepend radiotap information */ | 2574 | /* prepend radiotap information */ |
2574 | ieee80211_add_rx_radiotap_header(local, skb, rate, needed_headroom); | 2575 | ieee80211_add_rx_radiotap_header(local, skb, rate, needed_headroom, |
2576 | false); | ||
2575 | 2577 | ||
2576 | skb_set_mac_header(skb, 0); | 2578 | skb_set_mac_header(skb, 0); |
2577 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 2579 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 33cd16901378..c70e17677135 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -370,7 +370,7 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local) | |||
370 | */ | 370 | */ |
371 | drv_sw_scan_start(local); | 371 | drv_sw_scan_start(local); |
372 | 372 | ||
373 | local->leave_oper_channel_time = 0; | 373 | local->leave_oper_channel_time = jiffies; |
374 | local->next_scan_state = SCAN_DECISION; | 374 | local->next_scan_state = SCAN_DECISION; |
375 | local->scan_channel_idx = 0; | 375 | local->scan_channel_idx = 0; |
376 | 376 | ||
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 782a60198df4..e76facc69e95 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -1158,7 +1158,8 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata, | |||
1158 | tx->sta = rcu_dereference(sdata->u.vlan.sta); | 1158 | tx->sta = rcu_dereference(sdata->u.vlan.sta); |
1159 | if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr) | 1159 | if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr) |
1160 | return TX_DROP; | 1160 | return TX_DROP; |
1161 | } else if (info->flags & IEEE80211_TX_CTL_INJECTED) { | 1161 | } else if (info->flags & IEEE80211_TX_CTL_INJECTED || |
1162 | tx->sdata->control_port_protocol == tx->skb->protocol) { | ||
1162 | tx->sta = sta_info_get_bss(sdata, hdr->addr1); | 1163 | tx->sta = sta_info_get_bss(sdata, hdr->addr1); |
1163 | } | 1164 | } |
1164 | if (!tx->sta) | 1165 | if (!tx->sta) |
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c index 2555816e7788..00bdb1d9d690 100644 --- a/net/netfilter/ipvs/ip_vs_core.c +++ b/net/netfilter/ipvs/ip_vs_core.c | |||
@@ -1924,6 +1924,7 @@ protocol_fail: | |||
1924 | control_fail: | 1924 | control_fail: |
1925 | ip_vs_estimator_net_cleanup(net); | 1925 | ip_vs_estimator_net_cleanup(net); |
1926 | estimator_fail: | 1926 | estimator_fail: |
1927 | net->ipvs = NULL; | ||
1927 | return -ENOMEM; | 1928 | return -ENOMEM; |
1928 | } | 1929 | } |
1929 | 1930 | ||
@@ -1936,6 +1937,7 @@ static void __net_exit __ip_vs_cleanup(struct net *net) | |||
1936 | ip_vs_control_net_cleanup(net); | 1937 | ip_vs_control_net_cleanup(net); |
1937 | ip_vs_estimator_net_cleanup(net); | 1938 | ip_vs_estimator_net_cleanup(net); |
1938 | IP_VS_DBG(2, "ipvs netns %d released\n", net_ipvs(net)->gen); | 1939 | IP_VS_DBG(2, "ipvs netns %d released\n", net_ipvs(net)->gen); |
1940 | net->ipvs = NULL; | ||
1939 | } | 1941 | } |
1940 | 1942 | ||
1941 | static void __net_exit __ip_vs_dev_cleanup(struct net *net) | 1943 | static void __net_exit __ip_vs_dev_cleanup(struct net *net) |
@@ -1993,10 +1995,18 @@ static int __init ip_vs_init(void) | |||
1993 | goto cleanup_dev; | 1995 | goto cleanup_dev; |
1994 | } | 1996 | } |
1995 | 1997 | ||
1998 | ret = ip_vs_register_nl_ioctl(); | ||
1999 | if (ret < 0) { | ||
2000 | pr_err("can't register netlink/ioctl.\n"); | ||
2001 | goto cleanup_hooks; | ||
2002 | } | ||
2003 | |||
1996 | pr_info("ipvs loaded.\n"); | 2004 | pr_info("ipvs loaded.\n"); |
1997 | 2005 | ||
1998 | return ret; | 2006 | return ret; |
1999 | 2007 | ||
2008 | cleanup_hooks: | ||
2009 | nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops)); | ||
2000 | cleanup_dev: | 2010 | cleanup_dev: |
2001 | unregister_pernet_device(&ipvs_core_dev_ops); | 2011 | unregister_pernet_device(&ipvs_core_dev_ops); |
2002 | cleanup_sub: | 2012 | cleanup_sub: |
@@ -2012,6 +2022,7 @@ exit: | |||
2012 | 2022 | ||
2013 | static void __exit ip_vs_cleanup(void) | 2023 | static void __exit ip_vs_cleanup(void) |
2014 | { | 2024 | { |
2025 | ip_vs_unregister_nl_ioctl(); | ||
2015 | nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops)); | 2026 | nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops)); |
2016 | unregister_pernet_device(&ipvs_core_dev_ops); | 2027 | unregister_pernet_device(&ipvs_core_dev_ops); |
2017 | unregister_pernet_subsys(&ipvs_core_ops); /* free ip_vs struct */ | 2028 | unregister_pernet_subsys(&ipvs_core_ops); /* free ip_vs struct */ |
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index b3afe189af61..f5589987fc80 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
@@ -3680,7 +3680,7 @@ int __net_init ip_vs_control_net_init_sysctl(struct net *net) | |||
3680 | return 0; | 3680 | return 0; |
3681 | } | 3681 | } |
3682 | 3682 | ||
3683 | void __net_init ip_vs_control_net_cleanup_sysctl(struct net *net) | 3683 | void __net_exit ip_vs_control_net_cleanup_sysctl(struct net *net) |
3684 | { | 3684 | { |
3685 | struct netns_ipvs *ipvs = net_ipvs(net); | 3685 | struct netns_ipvs *ipvs = net_ipvs(net); |
3686 | 3686 | ||
@@ -3692,7 +3692,7 @@ void __net_init ip_vs_control_net_cleanup_sysctl(struct net *net) | |||
3692 | #else | 3692 | #else |
3693 | 3693 | ||
3694 | int __net_init ip_vs_control_net_init_sysctl(struct net *net) { return 0; } | 3694 | int __net_init ip_vs_control_net_init_sysctl(struct net *net) { return 0; } |
3695 | void __net_init ip_vs_control_net_cleanup_sysctl(struct net *net) { } | 3695 | void __net_exit ip_vs_control_net_cleanup_sysctl(struct net *net) { } |
3696 | 3696 | ||
3697 | #endif | 3697 | #endif |
3698 | 3698 | ||
@@ -3750,21 +3750,10 @@ void __net_exit ip_vs_control_net_cleanup(struct net *net) | |||
3750 | free_percpu(ipvs->tot_stats.cpustats); | 3750 | free_percpu(ipvs->tot_stats.cpustats); |
3751 | } | 3751 | } |
3752 | 3752 | ||
3753 | int __init ip_vs_control_init(void) | 3753 | int __init ip_vs_register_nl_ioctl(void) |
3754 | { | 3754 | { |
3755 | int idx; | ||
3756 | int ret; | 3755 | int ret; |
3757 | 3756 | ||
3758 | EnterFunction(2); | ||
3759 | |||
3760 | /* Initialize svc_table, ip_vs_svc_fwm_table, rs_table */ | ||
3761 | for(idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) { | ||
3762 | INIT_LIST_HEAD(&ip_vs_svc_table[idx]); | ||
3763 | INIT_LIST_HEAD(&ip_vs_svc_fwm_table[idx]); | ||
3764 | } | ||
3765 | |||
3766 | smp_wmb(); /* Do we really need it now ? */ | ||
3767 | |||
3768 | ret = nf_register_sockopt(&ip_vs_sockopts); | 3757 | ret = nf_register_sockopt(&ip_vs_sockopts); |
3769 | if (ret) { | 3758 | if (ret) { |
3770 | pr_err("cannot register sockopt.\n"); | 3759 | pr_err("cannot register sockopt.\n"); |
@@ -3776,28 +3765,47 @@ int __init ip_vs_control_init(void) | |||
3776 | pr_err("cannot register Generic Netlink interface.\n"); | 3765 | pr_err("cannot register Generic Netlink interface.\n"); |
3777 | goto err_genl; | 3766 | goto err_genl; |
3778 | } | 3767 | } |
3779 | |||
3780 | ret = register_netdevice_notifier(&ip_vs_dst_notifier); | ||
3781 | if (ret < 0) | ||
3782 | goto err_notf; | ||
3783 | |||
3784 | LeaveFunction(2); | ||
3785 | return 0; | 3768 | return 0; |
3786 | 3769 | ||
3787 | err_notf: | ||
3788 | ip_vs_genl_unregister(); | ||
3789 | err_genl: | 3770 | err_genl: |
3790 | nf_unregister_sockopt(&ip_vs_sockopts); | 3771 | nf_unregister_sockopt(&ip_vs_sockopts); |
3791 | err_sock: | 3772 | err_sock: |
3792 | return ret; | 3773 | return ret; |
3793 | } | 3774 | } |
3794 | 3775 | ||
3776 | void ip_vs_unregister_nl_ioctl(void) | ||
3777 | { | ||
3778 | ip_vs_genl_unregister(); | ||
3779 | nf_unregister_sockopt(&ip_vs_sockopts); | ||
3780 | } | ||
3781 | |||
3782 | int __init ip_vs_control_init(void) | ||
3783 | { | ||
3784 | int idx; | ||
3785 | int ret; | ||
3786 | |||
3787 | EnterFunction(2); | ||
3788 | |||
3789 | /* Initialize svc_table, ip_vs_svc_fwm_table, rs_table */ | ||
3790 | for (idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) { | ||
3791 | INIT_LIST_HEAD(&ip_vs_svc_table[idx]); | ||
3792 | INIT_LIST_HEAD(&ip_vs_svc_fwm_table[idx]); | ||
3793 | } | ||
3794 | |||
3795 | smp_wmb(); /* Do we really need it now ? */ | ||
3796 | |||
3797 | ret = register_netdevice_notifier(&ip_vs_dst_notifier); | ||
3798 | if (ret < 0) | ||
3799 | return ret; | ||
3800 | |||
3801 | LeaveFunction(2); | ||
3802 | return 0; | ||
3803 | } | ||
3804 | |||
3795 | 3805 | ||
3796 | void ip_vs_control_cleanup(void) | 3806 | void ip_vs_control_cleanup(void) |
3797 | { | 3807 | { |
3798 | EnterFunction(2); | 3808 | EnterFunction(2); |
3799 | unregister_netdevice_notifier(&ip_vs_dst_notifier); | 3809 | unregister_netdevice_notifier(&ip_vs_dst_notifier); |
3800 | ip_vs_genl_unregister(); | ||
3801 | nf_unregister_sockopt(&ip_vs_sockopts); | ||
3802 | LeaveFunction(2); | 3810 | LeaveFunction(2); |
3803 | } | 3811 | } |
diff --git a/net/netfilter/ipvs/ip_vs_ftp.c b/net/netfilter/ipvs/ip_vs_ftp.c index 538d74ee4f68..e39f693dd3e4 100644 --- a/net/netfilter/ipvs/ip_vs_ftp.c +++ b/net/netfilter/ipvs/ip_vs_ftp.c | |||
@@ -439,6 +439,8 @@ static int __net_init __ip_vs_ftp_init(struct net *net) | |||
439 | struct ip_vs_app *app; | 439 | struct ip_vs_app *app; |
440 | struct netns_ipvs *ipvs = net_ipvs(net); | 440 | struct netns_ipvs *ipvs = net_ipvs(net); |
441 | 441 | ||
442 | if (!ipvs) | ||
443 | return -ENOENT; | ||
442 | app = kmemdup(&ip_vs_ftp, sizeof(struct ip_vs_app), GFP_KERNEL); | 444 | app = kmemdup(&ip_vs_ftp, sizeof(struct ip_vs_app), GFP_KERNEL); |
443 | if (!app) | 445 | if (!app) |
444 | return -ENOMEM; | 446 | return -ENOMEM; |
diff --git a/net/netfilter/ipvs/ip_vs_lblc.c b/net/netfilter/ipvs/ip_vs_lblc.c index 0f16283fd058..caa43704e55e 100644 --- a/net/netfilter/ipvs/ip_vs_lblc.c +++ b/net/netfilter/ipvs/ip_vs_lblc.c | |||
@@ -551,6 +551,9 @@ static int __net_init __ip_vs_lblc_init(struct net *net) | |||
551 | { | 551 | { |
552 | struct netns_ipvs *ipvs = net_ipvs(net); | 552 | struct netns_ipvs *ipvs = net_ipvs(net); |
553 | 553 | ||
554 | if (!ipvs) | ||
555 | return -ENOENT; | ||
556 | |||
554 | if (!net_eq(net, &init_net)) { | 557 | if (!net_eq(net, &init_net)) { |
555 | ipvs->lblc_ctl_table = kmemdup(vs_vars_table, | 558 | ipvs->lblc_ctl_table = kmemdup(vs_vars_table, |
556 | sizeof(vs_vars_table), | 559 | sizeof(vs_vars_table), |
diff --git a/net/netfilter/ipvs/ip_vs_lblcr.c b/net/netfilter/ipvs/ip_vs_lblcr.c index eec797f8cce7..548bf37aa29e 100644 --- a/net/netfilter/ipvs/ip_vs_lblcr.c +++ b/net/netfilter/ipvs/ip_vs_lblcr.c | |||
@@ -745,6 +745,9 @@ static int __net_init __ip_vs_lblcr_init(struct net *net) | |||
745 | { | 745 | { |
746 | struct netns_ipvs *ipvs = net_ipvs(net); | 746 | struct netns_ipvs *ipvs = net_ipvs(net); |
747 | 747 | ||
748 | if (!ipvs) | ||
749 | return -ENOENT; | ||
750 | |||
748 | if (!net_eq(net, &init_net)) { | 751 | if (!net_eq(net, &init_net)) { |
749 | ipvs->lblcr_ctl_table = kmemdup(vs_vars_table, | 752 | ipvs->lblcr_ctl_table = kmemdup(vs_vars_table, |
750 | sizeof(vs_vars_table), | 753 | sizeof(vs_vars_table), |
diff --git a/net/netfilter/ipvs/ip_vs_proto.c b/net/netfilter/ipvs/ip_vs_proto.c index f843a8833250..ed835e67a07e 100644 --- a/net/netfilter/ipvs/ip_vs_proto.c +++ b/net/netfilter/ipvs/ip_vs_proto.c | |||
@@ -59,9 +59,6 @@ static int __used __init register_ip_vs_protocol(struct ip_vs_protocol *pp) | |||
59 | return 0; | 59 | return 0; |
60 | } | 60 | } |
61 | 61 | ||
62 | #if defined(CONFIG_IP_VS_PROTO_TCP) || defined(CONFIG_IP_VS_PROTO_UDP) || \ | ||
63 | defined(CONFIG_IP_VS_PROTO_SCTP) || defined(CONFIG_IP_VS_PROTO_AH) || \ | ||
64 | defined(CONFIG_IP_VS_PROTO_ESP) | ||
65 | /* | 62 | /* |
66 | * register an ipvs protocols netns related data | 63 | * register an ipvs protocols netns related data |
67 | */ | 64 | */ |
@@ -81,12 +78,18 @@ register_ip_vs_proto_netns(struct net *net, struct ip_vs_protocol *pp) | |||
81 | ipvs->proto_data_table[hash] = pd; | 78 | ipvs->proto_data_table[hash] = pd; |
82 | atomic_set(&pd->appcnt, 0); /* Init app counter */ | 79 | atomic_set(&pd->appcnt, 0); /* Init app counter */ |
83 | 80 | ||
84 | if (pp->init_netns != NULL) | 81 | if (pp->init_netns != NULL) { |
85 | pp->init_netns(net, pd); | 82 | int ret = pp->init_netns(net, pd); |
83 | if (ret) { | ||
84 | /* unlink an free proto data */ | ||
85 | ipvs->proto_data_table[hash] = pd->next; | ||
86 | kfree(pd); | ||
87 | return ret; | ||
88 | } | ||
89 | } | ||
86 | 90 | ||
87 | return 0; | 91 | return 0; |
88 | } | 92 | } |
89 | #endif | ||
90 | 93 | ||
91 | /* | 94 | /* |
92 | * unregister an ipvs protocol | 95 | * unregister an ipvs protocol |
@@ -316,22 +319,35 @@ ip_vs_tcpudp_debug_packet(int af, struct ip_vs_protocol *pp, | |||
316 | */ | 319 | */ |
317 | int __net_init ip_vs_protocol_net_init(struct net *net) | 320 | int __net_init ip_vs_protocol_net_init(struct net *net) |
318 | { | 321 | { |
322 | int i, ret; | ||
323 | static struct ip_vs_protocol *protos[] = { | ||
319 | #ifdef CONFIG_IP_VS_PROTO_TCP | 324 | #ifdef CONFIG_IP_VS_PROTO_TCP |
320 | register_ip_vs_proto_netns(net, &ip_vs_protocol_tcp); | 325 | &ip_vs_protocol_tcp, |
321 | #endif | 326 | #endif |
322 | #ifdef CONFIG_IP_VS_PROTO_UDP | 327 | #ifdef CONFIG_IP_VS_PROTO_UDP |
323 | register_ip_vs_proto_netns(net, &ip_vs_protocol_udp); | 328 | &ip_vs_protocol_udp, |
324 | #endif | 329 | #endif |
325 | #ifdef CONFIG_IP_VS_PROTO_SCTP | 330 | #ifdef CONFIG_IP_VS_PROTO_SCTP |
326 | register_ip_vs_proto_netns(net, &ip_vs_protocol_sctp); | 331 | &ip_vs_protocol_sctp, |
327 | #endif | 332 | #endif |
328 | #ifdef CONFIG_IP_VS_PROTO_AH | 333 | #ifdef CONFIG_IP_VS_PROTO_AH |
329 | register_ip_vs_proto_netns(net, &ip_vs_protocol_ah); | 334 | &ip_vs_protocol_ah, |
330 | #endif | 335 | #endif |
331 | #ifdef CONFIG_IP_VS_PROTO_ESP | 336 | #ifdef CONFIG_IP_VS_PROTO_ESP |
332 | register_ip_vs_proto_netns(net, &ip_vs_protocol_esp); | 337 | &ip_vs_protocol_esp, |
333 | #endif | 338 | #endif |
339 | }; | ||
340 | |||
341 | for (i = 0; i < ARRAY_SIZE(protos); i++) { | ||
342 | ret = register_ip_vs_proto_netns(net, protos[i]); | ||
343 | if (ret < 0) | ||
344 | goto cleanup; | ||
345 | } | ||
334 | return 0; | 346 | return 0; |
347 | |||
348 | cleanup: | ||
349 | ip_vs_protocol_net_cleanup(net); | ||
350 | return ret; | ||
335 | } | 351 | } |
336 | 352 | ||
337 | void __net_exit ip_vs_protocol_net_cleanup(struct net *net) | 353 | void __net_exit ip_vs_protocol_net_cleanup(struct net *net) |
diff --git a/net/netfilter/ipvs/ip_vs_proto_sctp.c b/net/netfilter/ipvs/ip_vs_proto_sctp.c index 1fbf7a2816f5..9f3fb751c491 100644 --- a/net/netfilter/ipvs/ip_vs_proto_sctp.c +++ b/net/netfilter/ipvs/ip_vs_proto_sctp.c | |||
@@ -1090,7 +1090,7 @@ out: | |||
1090 | * timeouts is netns related now. | 1090 | * timeouts is netns related now. |
1091 | * --------------------------------------------- | 1091 | * --------------------------------------------- |
1092 | */ | 1092 | */ |
1093 | static void __ip_vs_sctp_init(struct net *net, struct ip_vs_proto_data *pd) | 1093 | static int __ip_vs_sctp_init(struct net *net, struct ip_vs_proto_data *pd) |
1094 | { | 1094 | { |
1095 | struct netns_ipvs *ipvs = net_ipvs(net); | 1095 | struct netns_ipvs *ipvs = net_ipvs(net); |
1096 | 1096 | ||
@@ -1098,6 +1098,9 @@ static void __ip_vs_sctp_init(struct net *net, struct ip_vs_proto_data *pd) | |||
1098 | spin_lock_init(&ipvs->sctp_app_lock); | 1098 | spin_lock_init(&ipvs->sctp_app_lock); |
1099 | pd->timeout_table = ip_vs_create_timeout_table((int *)sctp_timeouts, | 1099 | pd->timeout_table = ip_vs_create_timeout_table((int *)sctp_timeouts, |
1100 | sizeof(sctp_timeouts)); | 1100 | sizeof(sctp_timeouts)); |
1101 | if (!pd->timeout_table) | ||
1102 | return -ENOMEM; | ||
1103 | return 0; | ||
1101 | } | 1104 | } |
1102 | 1105 | ||
1103 | static void __ip_vs_sctp_exit(struct net *net, struct ip_vs_proto_data *pd) | 1106 | static void __ip_vs_sctp_exit(struct net *net, struct ip_vs_proto_data *pd) |
diff --git a/net/netfilter/ipvs/ip_vs_proto_tcp.c b/net/netfilter/ipvs/ip_vs_proto_tcp.c index ef8641f7af83..cd609cc62721 100644 --- a/net/netfilter/ipvs/ip_vs_proto_tcp.c +++ b/net/netfilter/ipvs/ip_vs_proto_tcp.c | |||
@@ -677,7 +677,7 @@ void ip_vs_tcp_conn_listen(struct net *net, struct ip_vs_conn *cp) | |||
677 | * timeouts is netns related now. | 677 | * timeouts is netns related now. |
678 | * --------------------------------------------- | 678 | * --------------------------------------------- |
679 | */ | 679 | */ |
680 | static void __ip_vs_tcp_init(struct net *net, struct ip_vs_proto_data *pd) | 680 | static int __ip_vs_tcp_init(struct net *net, struct ip_vs_proto_data *pd) |
681 | { | 681 | { |
682 | struct netns_ipvs *ipvs = net_ipvs(net); | 682 | struct netns_ipvs *ipvs = net_ipvs(net); |
683 | 683 | ||
@@ -685,7 +685,10 @@ static void __ip_vs_tcp_init(struct net *net, struct ip_vs_proto_data *pd) | |||
685 | spin_lock_init(&ipvs->tcp_app_lock); | 685 | spin_lock_init(&ipvs->tcp_app_lock); |
686 | pd->timeout_table = ip_vs_create_timeout_table((int *)tcp_timeouts, | 686 | pd->timeout_table = ip_vs_create_timeout_table((int *)tcp_timeouts, |
687 | sizeof(tcp_timeouts)); | 687 | sizeof(tcp_timeouts)); |
688 | if (!pd->timeout_table) | ||
689 | return -ENOMEM; | ||
688 | pd->tcp_state_table = tcp_states; | 690 | pd->tcp_state_table = tcp_states; |
691 | return 0; | ||
689 | } | 692 | } |
690 | 693 | ||
691 | static void __ip_vs_tcp_exit(struct net *net, struct ip_vs_proto_data *pd) | 694 | static void __ip_vs_tcp_exit(struct net *net, struct ip_vs_proto_data *pd) |
diff --git a/net/netfilter/ipvs/ip_vs_proto_udp.c b/net/netfilter/ipvs/ip_vs_proto_udp.c index f4b7262896bb..2fedb2dcb3d1 100644 --- a/net/netfilter/ipvs/ip_vs_proto_udp.c +++ b/net/netfilter/ipvs/ip_vs_proto_udp.c | |||
@@ -467,7 +467,7 @@ udp_state_transition(struct ip_vs_conn *cp, int direction, | |||
467 | cp->timeout = pd->timeout_table[IP_VS_UDP_S_NORMAL]; | 467 | cp->timeout = pd->timeout_table[IP_VS_UDP_S_NORMAL]; |
468 | } | 468 | } |
469 | 469 | ||
470 | static void __udp_init(struct net *net, struct ip_vs_proto_data *pd) | 470 | static int __udp_init(struct net *net, struct ip_vs_proto_data *pd) |
471 | { | 471 | { |
472 | struct netns_ipvs *ipvs = net_ipvs(net); | 472 | struct netns_ipvs *ipvs = net_ipvs(net); |
473 | 473 | ||
@@ -475,6 +475,9 @@ static void __udp_init(struct net *net, struct ip_vs_proto_data *pd) | |||
475 | spin_lock_init(&ipvs->udp_app_lock); | 475 | spin_lock_init(&ipvs->udp_app_lock); |
476 | pd->timeout_table = ip_vs_create_timeout_table((int *)udp_timeouts, | 476 | pd->timeout_table = ip_vs_create_timeout_table((int *)udp_timeouts, |
477 | sizeof(udp_timeouts)); | 477 | sizeof(udp_timeouts)); |
478 | if (!pd->timeout_table) | ||
479 | return -ENOMEM; | ||
480 | return 0; | ||
478 | } | 481 | } |
479 | 482 | ||
480 | static void __udp_exit(struct net *net, struct ip_vs_proto_data *pd) | 483 | static void __udp_exit(struct net *net, struct ip_vs_proto_data *pd) |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index cbdb754dbb10..729f157a0efa 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -735,6 +735,7 @@ __nf_conntrack_alloc(struct net *net, u16 zone, | |||
735 | 735 | ||
736 | #ifdef CONFIG_NF_CONNTRACK_ZONES | 736 | #ifdef CONFIG_NF_CONNTRACK_ZONES |
737 | out_free: | 737 | out_free: |
738 | atomic_dec(&net->ct.count); | ||
738 | kmem_cache_free(net->ct.nf_conntrack_cachep, ct); | 739 | kmem_cache_free(net->ct.nf_conntrack_cachep, ct); |
739 | return ERR_PTR(-ENOMEM); | 740 | return ERR_PTR(-ENOMEM); |
740 | #endif | 741 | #endif |
@@ -1591,7 +1592,7 @@ static int nf_conntrack_init_net(struct net *net) | |||
1591 | return 0; | 1592 | return 0; |
1592 | 1593 | ||
1593 | err_timeout: | 1594 | err_timeout: |
1594 | nf_conntrack_timeout_fini(net); | 1595 | nf_conntrack_ecache_fini(net); |
1595 | err_ecache: | 1596 | err_ecache: |
1596 | nf_conntrack_tstamp_fini(net); | 1597 | nf_conntrack_tstamp_fini(net); |
1597 | err_tstamp: | 1598 | err_tstamp: |
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c index 361eade62a09..0d07a1dcf605 100644 --- a/net/netfilter/nf_conntrack_proto_tcp.c +++ b/net/netfilter/nf_conntrack_proto_tcp.c | |||
@@ -584,8 +584,8 @@ static bool tcp_in_window(const struct nf_conn *ct, | |||
584 | * Let's try to use the data from the packet. | 584 | * Let's try to use the data from the packet. |
585 | */ | 585 | */ |
586 | sender->td_end = end; | 586 | sender->td_end = end; |
587 | win <<= sender->td_scale; | 587 | swin = win << sender->td_scale; |
588 | sender->td_maxwin = (win == 0 ? 1 : win); | 588 | sender->td_maxwin = (swin == 0 ? 1 : swin); |
589 | sender->td_maxend = end + sender->td_maxwin; | 589 | sender->td_maxend = end + sender->td_maxwin; |
590 | /* | 590 | /* |
591 | * We haven't seen traffic in the other direction yet | 591 | * We haven't seen traffic in the other direction yet |
diff --git a/net/netfilter/nfnetlink_acct.c b/net/netfilter/nfnetlink_acct.c index 3eb348bfc4fb..d98c868c148b 100644 --- a/net/netfilter/nfnetlink_acct.c +++ b/net/netfilter/nfnetlink_acct.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/skbuff.h> | 12 | #include <linux/skbuff.h> |
13 | #include <linux/atomic.h> | ||
13 | #include <linux/netlink.h> | 14 | #include <linux/netlink.h> |
14 | #include <linux/rculist.h> | 15 | #include <linux/rculist.h> |
15 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
@@ -17,7 +18,6 @@ | |||
17 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
18 | #include <net/netlink.h> | 19 | #include <net/netlink.h> |
19 | #include <net/sock.h> | 20 | #include <net/sock.h> |
20 | #include <asm/atomic.h> | ||
21 | 21 | ||
22 | #include <linux/netfilter.h> | 22 | #include <linux/netfilter.h> |
23 | #include <linux/netfilter/nfnetlink.h> | 23 | #include <linux/netfilter/nfnetlink.h> |
diff --git a/net/netfilter/xt_CT.c b/net/netfilter/xt_CT.c index 0c8e43810ce3..3746d8b9a478 100644 --- a/net/netfilter/xt_CT.c +++ b/net/netfilter/xt_CT.c | |||
@@ -150,6 +150,17 @@ err1: | |||
150 | return ret; | 150 | return ret; |
151 | } | 151 | } |
152 | 152 | ||
153 | #ifdef CONFIG_NF_CONNTRACK_TIMEOUT | ||
154 | static void __xt_ct_tg_timeout_put(struct ctnl_timeout *timeout) | ||
155 | { | ||
156 | typeof(nf_ct_timeout_put_hook) timeout_put; | ||
157 | |||
158 | timeout_put = rcu_dereference(nf_ct_timeout_put_hook); | ||
159 | if (timeout_put) | ||
160 | timeout_put(timeout); | ||
161 | } | ||
162 | #endif | ||
163 | |||
153 | static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par) | 164 | static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par) |
154 | { | 165 | { |
155 | struct xt_ct_target_info_v1 *info = par->targinfo; | 166 | struct xt_ct_target_info_v1 *info = par->targinfo; |
@@ -158,7 +169,9 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par) | |||
158 | struct nf_conn *ct; | 169 | struct nf_conn *ct; |
159 | int ret = 0; | 170 | int ret = 0; |
160 | u8 proto; | 171 | u8 proto; |
161 | 172 | #ifdef CONFIG_NF_CONNTRACK_TIMEOUT | |
173 | struct ctnl_timeout *timeout; | ||
174 | #endif | ||
162 | if (info->flags & ~XT_CT_NOTRACK) | 175 | if (info->flags & ~XT_CT_NOTRACK) |
163 | return -EINVAL; | 176 | return -EINVAL; |
164 | 177 | ||
@@ -214,9 +227,8 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par) | |||
214 | } | 227 | } |
215 | 228 | ||
216 | #ifdef CONFIG_NF_CONNTRACK_TIMEOUT | 229 | #ifdef CONFIG_NF_CONNTRACK_TIMEOUT |
217 | if (info->timeout) { | 230 | if (info->timeout[0]) { |
218 | typeof(nf_ct_timeout_find_get_hook) timeout_find_get; | 231 | typeof(nf_ct_timeout_find_get_hook) timeout_find_get; |
219 | struct ctnl_timeout *timeout; | ||
220 | struct nf_conn_timeout *timeout_ext; | 232 | struct nf_conn_timeout *timeout_ext; |
221 | 233 | ||
222 | rcu_read_lock(); | 234 | rcu_read_lock(); |
@@ -245,7 +257,7 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par) | |||
245 | pr_info("Timeout policy `%s' can only be " | 257 | pr_info("Timeout policy `%s' can only be " |
246 | "used by L3 protocol number %d\n", | 258 | "used by L3 protocol number %d\n", |
247 | info->timeout, timeout->l3num); | 259 | info->timeout, timeout->l3num); |
248 | goto err4; | 260 | goto err5; |
249 | } | 261 | } |
250 | /* Make sure the timeout policy matches any existing | 262 | /* Make sure the timeout policy matches any existing |
251 | * protocol tracker, otherwise default to generic. | 263 | * protocol tracker, otherwise default to generic. |
@@ -258,13 +270,13 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par) | |||
258 | "used by L4 protocol number %d\n", | 270 | "used by L4 protocol number %d\n", |
259 | info->timeout, | 271 | info->timeout, |
260 | timeout->l4proto->l4proto); | 272 | timeout->l4proto->l4proto); |
261 | goto err4; | 273 | goto err5; |
262 | } | 274 | } |
263 | timeout_ext = nf_ct_timeout_ext_add(ct, timeout, | 275 | timeout_ext = nf_ct_timeout_ext_add(ct, timeout, |
264 | GFP_KERNEL); | 276 | GFP_ATOMIC); |
265 | if (timeout_ext == NULL) { | 277 | if (timeout_ext == NULL) { |
266 | ret = -ENOMEM; | 278 | ret = -ENOMEM; |
267 | goto err4; | 279 | goto err5; |
268 | } | 280 | } |
269 | } else { | 281 | } else { |
270 | ret = -ENOENT; | 282 | ret = -ENOENT; |
@@ -281,8 +293,12 @@ out: | |||
281 | info->ct = ct; | 293 | info->ct = ct; |
282 | return 0; | 294 | return 0; |
283 | 295 | ||
296 | #ifdef CONFIG_NF_CONNTRACK_TIMEOUT | ||
297 | err5: | ||
298 | __xt_ct_tg_timeout_put(timeout); | ||
284 | err4: | 299 | err4: |
285 | rcu_read_unlock(); | 300 | rcu_read_unlock(); |
301 | #endif | ||
286 | err3: | 302 | err3: |
287 | nf_conntrack_free(ct); | 303 | nf_conntrack_free(ct); |
288 | err2: | 304 | err2: |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 32bb75324e76..faa48f70b7c9 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -829,12 +829,19 @@ int netlink_attachskb(struct sock *sk, struct sk_buff *skb, | |||
829 | return 0; | 829 | return 0; |
830 | } | 830 | } |
831 | 831 | ||
832 | int netlink_sendskb(struct sock *sk, struct sk_buff *skb) | 832 | static int __netlink_sendskb(struct sock *sk, struct sk_buff *skb) |
833 | { | 833 | { |
834 | int len = skb->len; | 834 | int len = skb->len; |
835 | 835 | ||
836 | skb_queue_tail(&sk->sk_receive_queue, skb); | 836 | skb_queue_tail(&sk->sk_receive_queue, skb); |
837 | sk->sk_data_ready(sk, len); | 837 | sk->sk_data_ready(sk, len); |
838 | return len; | ||
839 | } | ||
840 | |||
841 | int netlink_sendskb(struct sock *sk, struct sk_buff *skb) | ||
842 | { | ||
843 | int len = __netlink_sendskb(sk, skb); | ||
844 | |||
838 | sock_put(sk); | 845 | sock_put(sk); |
839 | return len; | 846 | return len; |
840 | } | 847 | } |
@@ -957,8 +964,7 @@ static int netlink_broadcast_deliver(struct sock *sk, struct sk_buff *skb) | |||
957 | if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf && | 964 | if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf && |
958 | !test_bit(0, &nlk->state)) { | 965 | !test_bit(0, &nlk->state)) { |
959 | skb_set_owner_r(skb, sk); | 966 | skb_set_owner_r(skb, sk); |
960 | skb_queue_tail(&sk->sk_receive_queue, skb); | 967 | __netlink_sendskb(sk, skb); |
961 | sk->sk_data_ready(sk, skb->len); | ||
962 | return atomic_read(&sk->sk_rmem_alloc) > (sk->sk_rcvbuf >> 1); | 968 | return atomic_read(&sk->sk_rmem_alloc) > (sk->sk_rcvbuf >> 1); |
963 | } | 969 | } |
964 | return -1; | 970 | return -1; |
@@ -1698,10 +1704,8 @@ static int netlink_dump(struct sock *sk) | |||
1698 | 1704 | ||
1699 | if (sk_filter(sk, skb)) | 1705 | if (sk_filter(sk, skb)) |
1700 | kfree_skb(skb); | 1706 | kfree_skb(skb); |
1701 | else { | 1707 | else |
1702 | skb_queue_tail(&sk->sk_receive_queue, skb); | 1708 | __netlink_sendskb(sk, skb); |
1703 | sk->sk_data_ready(sk, skb->len); | ||
1704 | } | ||
1705 | return 0; | 1709 | return 0; |
1706 | } | 1710 | } |
1707 | 1711 | ||
@@ -1715,10 +1719,8 @@ static int netlink_dump(struct sock *sk) | |||
1715 | 1719 | ||
1716 | if (sk_filter(sk, skb)) | 1720 | if (sk_filter(sk, skb)) |
1717 | kfree_skb(skb); | 1721 | kfree_skb(skb); |
1718 | else { | 1722 | else |
1719 | skb_queue_tail(&sk->sk_receive_queue, skb); | 1723 | __netlink_sendskb(sk, skb); |
1720 | sk->sk_data_ready(sk, skb->len); | ||
1721 | } | ||
1722 | 1724 | ||
1723 | if (cb->done) | 1725 | if (cb->done) |
1724 | cb->done(cb); | 1726 | cb->done(cb); |
diff --git a/net/nfc/llcp/commands.c b/net/nfc/llcp/commands.c index 7b76eb7192f3..ef10ffcb4b6f 100644 --- a/net/nfc/llcp/commands.c +++ b/net/nfc/llcp/commands.c | |||
@@ -474,7 +474,7 @@ int nfc_llcp_send_i_frame(struct nfc_llcp_sock *sock, | |||
474 | 474 | ||
475 | while (remaining_len > 0) { | 475 | while (remaining_len > 0) { |
476 | 476 | ||
477 | frag_len = min_t(u16, local->remote_miu, remaining_len); | 477 | frag_len = min_t(size_t, local->remote_miu, remaining_len); |
478 | 478 | ||
479 | pr_debug("Fragment %zd bytes remaining %zd", | 479 | pr_debug("Fragment %zd bytes remaining %zd", |
480 | frag_len, remaining_len); | 480 | frag_len, remaining_len); |
@@ -497,7 +497,7 @@ int nfc_llcp_send_i_frame(struct nfc_llcp_sock *sock, | |||
497 | release_sock(sk); | 497 | release_sock(sk); |
498 | 498 | ||
499 | remaining_len -= frag_len; | 499 | remaining_len -= frag_len; |
500 | msg_ptr += len; | 500 | msg_ptr += frag_len; |
501 | } | 501 | } |
502 | 502 | ||
503 | kfree(msg_data); | 503 | kfree(msg_data); |
diff --git a/net/phonet/pep.c b/net/phonet/pep.c index 9f60008740e3..9726fe684ab8 100644 --- a/net/phonet/pep.c +++ b/net/phonet/pep.c | |||
@@ -1130,6 +1130,9 @@ static int pep_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
1130 | int flags = msg->msg_flags; | 1130 | int flags = msg->msg_flags; |
1131 | int err, done; | 1131 | int err, done; |
1132 | 1132 | ||
1133 | if (len > USHRT_MAX) | ||
1134 | return -EMSGSIZE; | ||
1135 | |||
1133 | if ((msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_NOSIGNAL| | 1136 | if ((msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_NOSIGNAL| |
1134 | MSG_CMSG_COMPAT)) || | 1137 | MSG_CMSG_COMPAT)) || |
1135 | !(msg->msg_flags & MSG_EOR)) | 1138 | !(msg->msg_flags & MSG_EOR)) |
diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c index 9b9a85ecc4c7..bf5cf69c820a 100644 --- a/net/phonet/pn_dev.c +++ b/net/phonet/pn_dev.c | |||
@@ -331,23 +331,6 @@ static int __net_init phonet_init_net(struct net *net) | |||
331 | 331 | ||
332 | static void __net_exit phonet_exit_net(struct net *net) | 332 | static void __net_exit phonet_exit_net(struct net *net) |
333 | { | 333 | { |
334 | struct phonet_net *pnn = phonet_pernet(net); | ||
335 | struct net_device *dev; | ||
336 | unsigned i; | ||
337 | |||
338 | rtnl_lock(); | ||
339 | for_each_netdev(net, dev) | ||
340 | phonet_device_destroy(dev); | ||
341 | |||
342 | for (i = 0; i < 64; i++) { | ||
343 | dev = pnn->routes.table[i]; | ||
344 | if (dev) { | ||
345 | rtm_phonet_notify(RTM_DELROUTE, dev, i); | ||
346 | dev_put(dev); | ||
347 | } | ||
348 | } | ||
349 | rtnl_unlock(); | ||
350 | |||
351 | proc_net_remove(net, "phonet"); | 334 | proc_net_remove(net, "phonet"); |
352 | } | 335 | } |
353 | 336 | ||
@@ -361,7 +344,7 @@ static struct pernet_operations phonet_net_ops = { | |||
361 | /* Initialize Phonet devices list */ | 344 | /* Initialize Phonet devices list */ |
362 | int __init phonet_device_init(void) | 345 | int __init phonet_device_init(void) |
363 | { | 346 | { |
364 | int err = register_pernet_device(&phonet_net_ops); | 347 | int err = register_pernet_subsys(&phonet_net_ops); |
365 | if (err) | 348 | if (err) |
366 | return err; | 349 | return err; |
367 | 350 | ||
@@ -377,7 +360,7 @@ void phonet_device_exit(void) | |||
377 | { | 360 | { |
378 | rtnl_unregister_all(PF_PHONET); | 361 | rtnl_unregister_all(PF_PHONET); |
379 | unregister_netdevice_notifier(&phonet_device_notifier); | 362 | unregister_netdevice_notifier(&phonet_device_notifier); |
380 | unregister_pernet_device(&phonet_net_ops); | 363 | unregister_pernet_subsys(&phonet_net_ops); |
381 | proc_net_remove(&init_net, "pnresource"); | 364 | proc_net_remove(&init_net, "pnresource"); |
382 | } | 365 | } |
383 | 366 | ||
diff --git a/net/rose/rose_dev.c b/net/rose/rose_dev.c index 1ab8689726ec..906cc05bba63 100644 --- a/net/rose/rose_dev.c +++ b/net/rose/rose_dev.c | |||
@@ -95,11 +95,11 @@ static int rose_set_mac_address(struct net_device *dev, void *addr) | |||
95 | struct sockaddr *sa = addr; | 95 | struct sockaddr *sa = addr; |
96 | int err; | 96 | int err; |
97 | 97 | ||
98 | if (!memcpy(dev->dev_addr, sa->sa_data, dev->addr_len)) | 98 | if (!memcmp(dev->dev_addr, sa->sa_data, dev->addr_len)) |
99 | return 0; | 99 | return 0; |
100 | 100 | ||
101 | if (dev->flags & IFF_UP) { | 101 | if (dev->flags & IFF_UP) { |
102 | err = rose_add_loopback_node((rose_address *)dev->dev_addr); | 102 | err = rose_add_loopback_node((rose_address *)sa->sa_data); |
103 | if (err) | 103 | if (err) |
104 | return err; | 104 | return err; |
105 | 105 | ||
diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c index 0b15236be7b6..8179494c269a 100644 --- a/net/sched/sch_gred.c +++ b/net/sched/sch_gred.c | |||
@@ -565,11 +565,8 @@ static int gred_dump(struct Qdisc *sch, struct sk_buff *skb) | |||
565 | opt.packets = q->packetsin; | 565 | opt.packets = q->packetsin; |
566 | opt.bytesin = q->bytesin; | 566 | opt.bytesin = q->bytesin; |
567 | 567 | ||
568 | if (gred_wred_mode(table)) { | 568 | if (gred_wred_mode(table)) |
569 | q->vars.qidlestart = | 569 | gred_load_wred_set(table, q); |
570 | table->tab[table->def]->vars.qidlestart; | ||
571 | q->vars.qavg = table->tab[table->def]->vars.qavg; | ||
572 | } | ||
573 | 570 | ||
574 | opt.qave = red_calc_qavg(&q->parms, &q->vars, q->vars.qavg); | 571 | opt.qave = red_calc_qavg(&q->parms, &q->vars, q->vars.qavg); |
575 | 572 | ||
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 5da548fa7ae9..ebd22966f748 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c | |||
@@ -408,10 +408,8 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
408 | if (q->corrupt && q->corrupt >= get_crandom(&q->corrupt_cor)) { | 408 | if (q->corrupt && q->corrupt >= get_crandom(&q->corrupt_cor)) { |
409 | if (!(skb = skb_unshare(skb, GFP_ATOMIC)) || | 409 | if (!(skb = skb_unshare(skb, GFP_ATOMIC)) || |
410 | (skb->ip_summed == CHECKSUM_PARTIAL && | 410 | (skb->ip_summed == CHECKSUM_PARTIAL && |
411 | skb_checksum_help(skb))) { | 411 | skb_checksum_help(skb))) |
412 | sch->qstats.drops++; | 412 | return qdisc_drop(skb, sch); |
413 | return NET_XMIT_DROP; | ||
414 | } | ||
415 | 413 | ||
416 | skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8); | 414 | skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8); |
417 | } | 415 | } |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 06b42b7f5a02..92ba71dfe080 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -4133,9 +4133,10 @@ static int sctp_getsockopt_disable_fragments(struct sock *sk, int len, | |||
4133 | static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval, | 4133 | static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval, |
4134 | int __user *optlen) | 4134 | int __user *optlen) |
4135 | { | 4135 | { |
4136 | if (len < sizeof(struct sctp_event_subscribe)) | 4136 | if (len <= 0) |
4137 | return -EINVAL; | 4137 | return -EINVAL; |
4138 | len = sizeof(struct sctp_event_subscribe); | 4138 | if (len > sizeof(struct sctp_event_subscribe)) |
4139 | len = sizeof(struct sctp_event_subscribe); | ||
4139 | if (put_user(len, optlen)) | 4140 | if (put_user(len, optlen)) |
4140 | return -EFAULT; | 4141 | return -EFAULT; |
4141 | if (copy_to_user(optval, &sctp_sk(sk)->subscribe, len)) | 4142 | if (copy_to_user(optval, &sctp_sk(sk)->subscribe, len)) |
diff --git a/net/socket.c b/net/socket.c index 484cc6953fc6..851edcd6b098 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -811,9 +811,9 @@ static ssize_t sock_sendpage(struct file *file, struct page *page, | |||
811 | 811 | ||
812 | sock = file->private_data; | 812 | sock = file->private_data; |
813 | 813 | ||
814 | flags = !(file->f_flags & O_NONBLOCK) ? 0 : MSG_DONTWAIT; | 814 | flags = (file->f_flags & O_NONBLOCK) ? MSG_DONTWAIT : 0; |
815 | if (more) | 815 | /* more is a combination of MSG_MORE and MSG_SENDPAGE_NOTLAST */ |
816 | flags |= MSG_MORE; | 816 | flags |= more; |
817 | 817 | ||
818 | return kernel_sendpage(sock, page, offset, size, flags); | 818 | return kernel_sendpage(sock, page, offset, size, flags); |
819 | } | 819 | } |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 67972462a543..adf2990acebf 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -176,16 +176,22 @@ rpc_setup_pipedir(struct rpc_clnt *clnt, const char *dir_name) | |||
176 | return 0; | 176 | return 0; |
177 | } | 177 | } |
178 | 178 | ||
179 | static int __rpc_pipefs_event(struct rpc_clnt *clnt, unsigned long event, | 179 | static inline int rpc_clnt_skip_event(struct rpc_clnt *clnt, unsigned long event) |
180 | struct super_block *sb) | 180 | { |
181 | if (((event == RPC_PIPEFS_MOUNT) && clnt->cl_dentry) || | ||
182 | ((event == RPC_PIPEFS_UMOUNT) && !clnt->cl_dentry)) | ||
183 | return 1; | ||
184 | return 0; | ||
185 | } | ||
186 | |||
187 | static int __rpc_clnt_handle_event(struct rpc_clnt *clnt, unsigned long event, | ||
188 | struct super_block *sb) | ||
181 | { | 189 | { |
182 | struct dentry *dentry; | 190 | struct dentry *dentry; |
183 | int err = 0; | 191 | int err = 0; |
184 | 192 | ||
185 | switch (event) { | 193 | switch (event) { |
186 | case RPC_PIPEFS_MOUNT: | 194 | case RPC_PIPEFS_MOUNT: |
187 | if (clnt->cl_program->pipe_dir_name == NULL) | ||
188 | break; | ||
189 | dentry = rpc_setup_pipedir_sb(sb, clnt, | 195 | dentry = rpc_setup_pipedir_sb(sb, clnt, |
190 | clnt->cl_program->pipe_dir_name); | 196 | clnt->cl_program->pipe_dir_name); |
191 | BUG_ON(dentry == NULL); | 197 | BUG_ON(dentry == NULL); |
@@ -208,6 +214,20 @@ static int __rpc_pipefs_event(struct rpc_clnt *clnt, unsigned long event, | |||
208 | return err; | 214 | return err; |
209 | } | 215 | } |
210 | 216 | ||
217 | static int __rpc_pipefs_event(struct rpc_clnt *clnt, unsigned long event, | ||
218 | struct super_block *sb) | ||
219 | { | ||
220 | int error = 0; | ||
221 | |||
222 | for (;; clnt = clnt->cl_parent) { | ||
223 | if (!rpc_clnt_skip_event(clnt, event)) | ||
224 | error = __rpc_clnt_handle_event(clnt, event, sb); | ||
225 | if (error || clnt == clnt->cl_parent) | ||
226 | break; | ||
227 | } | ||
228 | return error; | ||
229 | } | ||
230 | |||
211 | static struct rpc_clnt *rpc_get_client_for_event(struct net *net, int event) | 231 | static struct rpc_clnt *rpc_get_client_for_event(struct net *net, int event) |
212 | { | 232 | { |
213 | struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); | 233 | struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); |
@@ -215,10 +235,12 @@ static struct rpc_clnt *rpc_get_client_for_event(struct net *net, int event) | |||
215 | 235 | ||
216 | spin_lock(&sn->rpc_client_lock); | 236 | spin_lock(&sn->rpc_client_lock); |
217 | list_for_each_entry(clnt, &sn->all_clients, cl_clients) { | 237 | list_for_each_entry(clnt, &sn->all_clients, cl_clients) { |
218 | if (((event == RPC_PIPEFS_MOUNT) && clnt->cl_dentry) || | 238 | if (clnt->cl_program->pipe_dir_name == NULL) |
219 | ((event == RPC_PIPEFS_UMOUNT) && !clnt->cl_dentry)) | 239 | break; |
240 | if (rpc_clnt_skip_event(clnt, event)) | ||
241 | continue; | ||
242 | if (atomic_inc_not_zero(&clnt->cl_count) == 0) | ||
220 | continue; | 243 | continue; |
221 | atomic_inc(&clnt->cl_count); | ||
222 | spin_unlock(&sn->rpc_client_lock); | 244 | spin_unlock(&sn->rpc_client_lock); |
223 | return clnt; | 245 | return clnt; |
224 | } | 246 | } |
@@ -257,6 +279,14 @@ void rpc_clients_notifier_unregister(void) | |||
257 | return rpc_pipefs_notifier_unregister(&rpc_clients_block); | 279 | return rpc_pipefs_notifier_unregister(&rpc_clients_block); |
258 | } | 280 | } |
259 | 281 | ||
282 | static void rpc_clnt_set_nodename(struct rpc_clnt *clnt, const char *nodename) | ||
283 | { | ||
284 | clnt->cl_nodelen = strlen(nodename); | ||
285 | if (clnt->cl_nodelen > UNX_MAXNODENAME) | ||
286 | clnt->cl_nodelen = UNX_MAXNODENAME; | ||
287 | memcpy(clnt->cl_nodename, nodename, clnt->cl_nodelen); | ||
288 | } | ||
289 | |||
260 | static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, struct rpc_xprt *xprt) | 290 | static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, struct rpc_xprt *xprt) |
261 | { | 291 | { |
262 | const struct rpc_program *program = args->program; | 292 | const struct rpc_program *program = args->program; |
@@ -337,10 +367,7 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, stru | |||
337 | } | 367 | } |
338 | 368 | ||
339 | /* save the nodename */ | 369 | /* save the nodename */ |
340 | clnt->cl_nodelen = strlen(init_utsname()->nodename); | 370 | rpc_clnt_set_nodename(clnt, utsname()->nodename); |
341 | if (clnt->cl_nodelen > UNX_MAXNODENAME) | ||
342 | clnt->cl_nodelen = UNX_MAXNODENAME; | ||
343 | memcpy(clnt->cl_nodename, init_utsname()->nodename, clnt->cl_nodelen); | ||
344 | rpc_register_client(clnt); | 371 | rpc_register_client(clnt); |
345 | return clnt; | 372 | return clnt; |
346 | 373 | ||
@@ -499,6 +526,7 @@ rpc_clone_client(struct rpc_clnt *clnt) | |||
499 | err = rpc_setup_pipedir(new, clnt->cl_program->pipe_dir_name); | 526 | err = rpc_setup_pipedir(new, clnt->cl_program->pipe_dir_name); |
500 | if (err != 0) | 527 | if (err != 0) |
501 | goto out_no_path; | 528 | goto out_no_path; |
529 | rpc_clnt_set_nodename(new, utsname()->nodename); | ||
502 | if (new->cl_auth) | 530 | if (new->cl_auth) |
503 | atomic_inc(&new->cl_auth->au_count); | 531 | atomic_inc(&new->cl_auth->au_count); |
504 | atomic_inc(&clnt->cl_count); | 532 | atomic_inc(&clnt->cl_count); |
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 0af37fc46818..3b62cf288031 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -1126,19 +1126,20 @@ rpc_fill_super(struct super_block *sb, void *data, int silent) | |||
1126 | return -ENOMEM; | 1126 | return -ENOMEM; |
1127 | dprintk("RPC: sending pipefs MOUNT notification for net %p%s\n", net, | 1127 | dprintk("RPC: sending pipefs MOUNT notification for net %p%s\n", net, |
1128 | NET_NAME(net)); | 1128 | NET_NAME(net)); |
1129 | sn->pipefs_sb = sb; | ||
1129 | err = blocking_notifier_call_chain(&rpc_pipefs_notifier_list, | 1130 | err = blocking_notifier_call_chain(&rpc_pipefs_notifier_list, |
1130 | RPC_PIPEFS_MOUNT, | 1131 | RPC_PIPEFS_MOUNT, |
1131 | sb); | 1132 | sb); |
1132 | if (err) | 1133 | if (err) |
1133 | goto err_depopulate; | 1134 | goto err_depopulate; |
1134 | sb->s_fs_info = get_net(net); | 1135 | sb->s_fs_info = get_net(net); |
1135 | sn->pipefs_sb = sb; | ||
1136 | return 0; | 1136 | return 0; |
1137 | 1137 | ||
1138 | err_depopulate: | 1138 | err_depopulate: |
1139 | blocking_notifier_call_chain(&rpc_pipefs_notifier_list, | 1139 | blocking_notifier_call_chain(&rpc_pipefs_notifier_list, |
1140 | RPC_PIPEFS_UMOUNT, | 1140 | RPC_PIPEFS_UMOUNT, |
1141 | sb); | 1141 | sb); |
1142 | sn->pipefs_sb = NULL; | ||
1142 | __rpc_depopulate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF); | 1143 | __rpc_depopulate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF); |
1143 | return err; | 1144 | return err; |
1144 | } | 1145 | } |
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c index 8adfc88e793a..3d6498af9adc 100644 --- a/net/sunrpc/sunrpc_syms.c +++ b/net/sunrpc/sunrpc_syms.c | |||
@@ -75,20 +75,21 @@ static struct pernet_operations sunrpc_net_ops = { | |||
75 | static int __init | 75 | static int __init |
76 | init_sunrpc(void) | 76 | init_sunrpc(void) |
77 | { | 77 | { |
78 | int err = register_rpc_pipefs(); | 78 | int err = rpc_init_mempool(); |
79 | if (err) | 79 | if (err) |
80 | goto out; | 80 | goto out; |
81 | err = rpc_init_mempool(); | ||
82 | if (err) | ||
83 | goto out2; | ||
84 | err = rpcauth_init_module(); | 81 | err = rpcauth_init_module(); |
85 | if (err) | 82 | if (err) |
86 | goto out3; | 83 | goto out2; |
87 | 84 | ||
88 | cache_initialize(); | 85 | cache_initialize(); |
89 | 86 | ||
90 | err = register_pernet_subsys(&sunrpc_net_ops); | 87 | err = register_pernet_subsys(&sunrpc_net_ops); |
91 | if (err) | 88 | if (err) |
89 | goto out3; | ||
90 | |||
91 | err = register_rpc_pipefs(); | ||
92 | if (err) | ||
92 | goto out4; | 93 | goto out4; |
93 | #ifdef RPC_DEBUG | 94 | #ifdef RPC_DEBUG |
94 | rpc_register_sysctl(); | 95 | rpc_register_sysctl(); |
@@ -98,11 +99,11 @@ init_sunrpc(void) | |||
98 | return 0; | 99 | return 0; |
99 | 100 | ||
100 | out4: | 101 | out4: |
101 | rpcauth_remove_module(); | 102 | unregister_pernet_subsys(&sunrpc_net_ops); |
102 | out3: | 103 | out3: |
103 | rpc_destroy_mempool(); | 104 | rpcauth_remove_module(); |
104 | out2: | 105 | out2: |
105 | unregister_rpc_pipefs(); | 106 | rpc_destroy_mempool(); |
106 | out: | 107 | out: |
107 | return err; | 108 | return err; |
108 | } | 109 | } |
diff --git a/net/wireless/debugfs.c b/net/wireless/debugfs.c index 39765bcfb472..920cabe0461b 100644 --- a/net/wireless/debugfs.c +++ b/net/wireless/debugfs.c | |||
@@ -13,12 +13,6 @@ | |||
13 | #include "core.h" | 13 | #include "core.h" |
14 | #include "debugfs.h" | 14 | #include "debugfs.h" |
15 | 15 | ||
16 | static int cfg80211_open_file_generic(struct inode *inode, struct file *file) | ||
17 | { | ||
18 | file->private_data = inode->i_private; | ||
19 | return 0; | ||
20 | } | ||
21 | |||
22 | #define DEBUGFS_READONLY_FILE(name, buflen, fmt, value...) \ | 16 | #define DEBUGFS_READONLY_FILE(name, buflen, fmt, value...) \ |
23 | static ssize_t name## _read(struct file *file, char __user *userbuf, \ | 17 | static ssize_t name## _read(struct file *file, char __user *userbuf, \ |
24 | size_t count, loff_t *ppos) \ | 18 | size_t count, loff_t *ppos) \ |
@@ -33,7 +27,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \ | |||
33 | \ | 27 | \ |
34 | static const struct file_operations name## _ops = { \ | 28 | static const struct file_operations name## _ops = { \ |
35 | .read = name## _read, \ | 29 | .read = name## _read, \ |
36 | .open = cfg80211_open_file_generic, \ | 30 | .open = simple_open, \ |
37 | .llseek = generic_file_llseek, \ | 31 | .llseek = generic_file_llseek, \ |
38 | }; | 32 | }; |
39 | 33 | ||
@@ -102,7 +96,7 @@ static ssize_t ht40allow_map_read(struct file *file, | |||
102 | 96 | ||
103 | static const struct file_operations ht40allow_map_ops = { | 97 | static const struct file_operations ht40allow_map_ops = { |
104 | .read = ht40allow_map_read, | 98 | .read = ht40allow_map_read, |
105 | .open = cfg80211_open_file_generic, | 99 | .open = simple_open, |
106 | .llseek = default_llseek, | 100 | .llseek = default_llseek, |
107 | }; | 101 | }; |
108 | 102 | ||
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 4c1eb9472ddb..f432c57af05d 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -1294,6 +1294,11 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
1294 | goto bad_res; | 1294 | goto bad_res; |
1295 | } | 1295 | } |
1296 | 1296 | ||
1297 | if (!netif_running(netdev)) { | ||
1298 | result = -ENETDOWN; | ||
1299 | goto bad_res; | ||
1300 | } | ||
1301 | |||
1297 | nla_for_each_nested(nl_txq_params, | 1302 | nla_for_each_nested(nl_txq_params, |
1298 | info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS], | 1303 | info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS], |
1299 | rem_txq_params) { | 1304 | rem_txq_params) { |
@@ -2386,7 +2391,9 @@ nla_put_failure: | |||
2386 | } | 2391 | } |
2387 | 2392 | ||
2388 | static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq, | 2393 | static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq, |
2389 | int flags, struct net_device *dev, | 2394 | int flags, |
2395 | struct cfg80211_registered_device *rdev, | ||
2396 | struct net_device *dev, | ||
2390 | const u8 *mac_addr, struct station_info *sinfo) | 2397 | const u8 *mac_addr, struct station_info *sinfo) |
2391 | { | 2398 | { |
2392 | void *hdr; | 2399 | void *hdr; |
@@ -2425,12 +2432,18 @@ static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq, | |||
2425 | if (sinfo->filled & STATION_INFO_PLINK_STATE) | 2432 | if (sinfo->filled & STATION_INFO_PLINK_STATE) |
2426 | NLA_PUT_U8(msg, NL80211_STA_INFO_PLINK_STATE, | 2433 | NLA_PUT_U8(msg, NL80211_STA_INFO_PLINK_STATE, |
2427 | sinfo->plink_state); | 2434 | sinfo->plink_state); |
2428 | if (sinfo->filled & STATION_INFO_SIGNAL) | 2435 | switch (rdev->wiphy.signal_type) { |
2429 | NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL, | 2436 | case CFG80211_SIGNAL_TYPE_MBM: |
2430 | sinfo->signal); | 2437 | if (sinfo->filled & STATION_INFO_SIGNAL) |
2431 | if (sinfo->filled & STATION_INFO_SIGNAL_AVG) | 2438 | NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL, |
2432 | NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL_AVG, | 2439 | sinfo->signal); |
2433 | sinfo->signal_avg); | 2440 | if (sinfo->filled & STATION_INFO_SIGNAL_AVG) |
2441 | NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL_AVG, | ||
2442 | sinfo->signal_avg); | ||
2443 | break; | ||
2444 | default: | ||
2445 | break; | ||
2446 | } | ||
2434 | if (sinfo->filled & STATION_INFO_TX_BITRATE) { | 2447 | if (sinfo->filled & STATION_INFO_TX_BITRATE) { |
2435 | if (!nl80211_put_sta_rate(msg, &sinfo->txrate, | 2448 | if (!nl80211_put_sta_rate(msg, &sinfo->txrate, |
2436 | NL80211_STA_INFO_TX_BITRATE)) | 2449 | NL80211_STA_INFO_TX_BITRATE)) |
@@ -2523,7 +2536,7 @@ static int nl80211_dump_station(struct sk_buff *skb, | |||
2523 | if (nl80211_send_station(skb, | 2536 | if (nl80211_send_station(skb, |
2524 | NETLINK_CB(cb->skb).pid, | 2537 | NETLINK_CB(cb->skb).pid, |
2525 | cb->nlh->nlmsg_seq, NLM_F_MULTI, | 2538 | cb->nlh->nlmsg_seq, NLM_F_MULTI, |
2526 | netdev, mac_addr, | 2539 | dev, netdev, mac_addr, |
2527 | &sinfo) < 0) | 2540 | &sinfo) < 0) |
2528 | goto out; | 2541 | goto out; |
2529 | 2542 | ||
@@ -2568,7 +2581,7 @@ static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info) | |||
2568 | return -ENOMEM; | 2581 | return -ENOMEM; |
2569 | 2582 | ||
2570 | if (nl80211_send_station(msg, info->snd_pid, info->snd_seq, 0, | 2583 | if (nl80211_send_station(msg, info->snd_pid, info->snd_seq, 0, |
2571 | dev, mac_addr, &sinfo) < 0) { | 2584 | rdev, dev, mac_addr, &sinfo) < 0) { |
2572 | nlmsg_free(msg); | 2585 | nlmsg_free(msg); |
2573 | return -ENOBUFS; | 2586 | return -ENOBUFS; |
2574 | } | 2587 | } |
@@ -6376,7 +6389,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6376 | .doit = nl80211_get_key, | 6389 | .doit = nl80211_get_key, |
6377 | .policy = nl80211_policy, | 6390 | .policy = nl80211_policy, |
6378 | .flags = GENL_ADMIN_PERM, | 6391 | .flags = GENL_ADMIN_PERM, |
6379 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6392 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6380 | NL80211_FLAG_NEED_RTNL, | 6393 | NL80211_FLAG_NEED_RTNL, |
6381 | }, | 6394 | }, |
6382 | { | 6395 | { |
@@ -6408,7 +6421,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6408 | .policy = nl80211_policy, | 6421 | .policy = nl80211_policy, |
6409 | .flags = GENL_ADMIN_PERM, | 6422 | .flags = GENL_ADMIN_PERM, |
6410 | .doit = nl80211_set_beacon, | 6423 | .doit = nl80211_set_beacon, |
6411 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6424 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6412 | NL80211_FLAG_NEED_RTNL, | 6425 | NL80211_FLAG_NEED_RTNL, |
6413 | }, | 6426 | }, |
6414 | { | 6427 | { |
@@ -6416,7 +6429,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6416 | .policy = nl80211_policy, | 6429 | .policy = nl80211_policy, |
6417 | .flags = GENL_ADMIN_PERM, | 6430 | .flags = GENL_ADMIN_PERM, |
6418 | .doit = nl80211_start_ap, | 6431 | .doit = nl80211_start_ap, |
6419 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6432 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6420 | NL80211_FLAG_NEED_RTNL, | 6433 | NL80211_FLAG_NEED_RTNL, |
6421 | }, | 6434 | }, |
6422 | { | 6435 | { |
@@ -6424,7 +6437,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6424 | .policy = nl80211_policy, | 6437 | .policy = nl80211_policy, |
6425 | .flags = GENL_ADMIN_PERM, | 6438 | .flags = GENL_ADMIN_PERM, |
6426 | .doit = nl80211_stop_ap, | 6439 | .doit = nl80211_stop_ap, |
6427 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6440 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6428 | NL80211_FLAG_NEED_RTNL, | 6441 | NL80211_FLAG_NEED_RTNL, |
6429 | }, | 6442 | }, |
6430 | { | 6443 | { |
@@ -6440,7 +6453,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6440 | .doit = nl80211_set_station, | 6453 | .doit = nl80211_set_station, |
6441 | .policy = nl80211_policy, | 6454 | .policy = nl80211_policy, |
6442 | .flags = GENL_ADMIN_PERM, | 6455 | .flags = GENL_ADMIN_PERM, |
6443 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6456 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6444 | NL80211_FLAG_NEED_RTNL, | 6457 | NL80211_FLAG_NEED_RTNL, |
6445 | }, | 6458 | }, |
6446 | { | 6459 | { |
@@ -6456,7 +6469,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6456 | .doit = nl80211_del_station, | 6469 | .doit = nl80211_del_station, |
6457 | .policy = nl80211_policy, | 6470 | .policy = nl80211_policy, |
6458 | .flags = GENL_ADMIN_PERM, | 6471 | .flags = GENL_ADMIN_PERM, |
6459 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6472 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6460 | NL80211_FLAG_NEED_RTNL, | 6473 | NL80211_FLAG_NEED_RTNL, |
6461 | }, | 6474 | }, |
6462 | { | 6475 | { |
@@ -6489,7 +6502,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6489 | .doit = nl80211_del_mpath, | 6502 | .doit = nl80211_del_mpath, |
6490 | .policy = nl80211_policy, | 6503 | .policy = nl80211_policy, |
6491 | .flags = GENL_ADMIN_PERM, | 6504 | .flags = GENL_ADMIN_PERM, |
6492 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6505 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6493 | NL80211_FLAG_NEED_RTNL, | 6506 | NL80211_FLAG_NEED_RTNL, |
6494 | }, | 6507 | }, |
6495 | { | 6508 | { |
@@ -6497,7 +6510,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6497 | .doit = nl80211_set_bss, | 6510 | .doit = nl80211_set_bss, |
6498 | .policy = nl80211_policy, | 6511 | .policy = nl80211_policy, |
6499 | .flags = GENL_ADMIN_PERM, | 6512 | .flags = GENL_ADMIN_PERM, |
6500 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6513 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6501 | NL80211_FLAG_NEED_RTNL, | 6514 | NL80211_FLAG_NEED_RTNL, |
6502 | }, | 6515 | }, |
6503 | { | 6516 | { |
@@ -6523,7 +6536,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6523 | .doit = nl80211_get_mesh_config, | 6536 | .doit = nl80211_get_mesh_config, |
6524 | .policy = nl80211_policy, | 6537 | .policy = nl80211_policy, |
6525 | /* can be retrieved by unprivileged users */ | 6538 | /* can be retrieved by unprivileged users */ |
6526 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6539 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6527 | NL80211_FLAG_NEED_RTNL, | 6540 | NL80211_FLAG_NEED_RTNL, |
6528 | }, | 6541 | }, |
6529 | { | 6542 | { |
@@ -6656,7 +6669,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6656 | .doit = nl80211_setdel_pmksa, | 6669 | .doit = nl80211_setdel_pmksa, |
6657 | .policy = nl80211_policy, | 6670 | .policy = nl80211_policy, |
6658 | .flags = GENL_ADMIN_PERM, | 6671 | .flags = GENL_ADMIN_PERM, |
6659 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6672 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6660 | NL80211_FLAG_NEED_RTNL, | 6673 | NL80211_FLAG_NEED_RTNL, |
6661 | }, | 6674 | }, |
6662 | { | 6675 | { |
@@ -6664,7 +6677,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6664 | .doit = nl80211_setdel_pmksa, | 6677 | .doit = nl80211_setdel_pmksa, |
6665 | .policy = nl80211_policy, | 6678 | .policy = nl80211_policy, |
6666 | .flags = GENL_ADMIN_PERM, | 6679 | .flags = GENL_ADMIN_PERM, |
6667 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6680 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6668 | NL80211_FLAG_NEED_RTNL, | 6681 | NL80211_FLAG_NEED_RTNL, |
6669 | }, | 6682 | }, |
6670 | { | 6683 | { |
@@ -6672,7 +6685,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6672 | .doit = nl80211_flush_pmksa, | 6685 | .doit = nl80211_flush_pmksa, |
6673 | .policy = nl80211_policy, | 6686 | .policy = nl80211_policy, |
6674 | .flags = GENL_ADMIN_PERM, | 6687 | .flags = GENL_ADMIN_PERM, |
6675 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6688 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6676 | NL80211_FLAG_NEED_RTNL, | 6689 | NL80211_FLAG_NEED_RTNL, |
6677 | }, | 6690 | }, |
6678 | { | 6691 | { |
@@ -6832,7 +6845,7 @@ static struct genl_ops nl80211_ops[] = { | |||
6832 | .doit = nl80211_probe_client, | 6845 | .doit = nl80211_probe_client, |
6833 | .policy = nl80211_policy, | 6846 | .policy = nl80211_policy, |
6834 | .flags = GENL_ADMIN_PERM, | 6847 | .flags = GENL_ADMIN_PERM, |
6835 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | 6848 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | |
6836 | NL80211_FLAG_NEED_RTNL, | 6849 | NL80211_FLAG_NEED_RTNL, |
6837 | }, | 6850 | }, |
6838 | { | 6851 | { |
@@ -7596,7 +7609,8 @@ void nl80211_send_sta_event(struct cfg80211_registered_device *rdev, | |||
7596 | if (!msg) | 7609 | if (!msg) |
7597 | return; | 7610 | return; |
7598 | 7611 | ||
7599 | if (nl80211_send_station(msg, 0, 0, 0, dev, mac_addr, sinfo) < 0) { | 7612 | if (nl80211_send_station(msg, 0, 0, 0, |
7613 | rdev, dev, mac_addr, sinfo) < 0) { | ||
7600 | nlmsg_free(msg); | 7614 | nlmsg_free(msg); |
7601 | return; | 7615 | return; |
7602 | } | 7616 | } |
diff --git a/net/wireless/util.c b/net/wireless/util.c index 1b7a08df933c..957f25621617 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c | |||
@@ -989,7 +989,7 @@ int cfg80211_can_change_interface(struct cfg80211_registered_device *rdev, | |||
989 | if (rdev->wiphy.software_iftypes & BIT(iftype)) | 989 | if (rdev->wiphy.software_iftypes & BIT(iftype)) |
990 | continue; | 990 | continue; |
991 | for (j = 0; j < c->n_limits; j++) { | 991 | for (j = 0; j < c->n_limits; j++) { |
992 | if (!(limits[j].types & iftype)) | 992 | if (!(limits[j].types & BIT(iftype))) |
993 | continue; | 993 | continue; |
994 | if (limits[j].max < num[iftype]) | 994 | if (limits[j].max < num[iftype]) |
995 | goto cont; | 995 | goto cont; |
diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c index 0af7f54e4f61..af648e08e61b 100644 --- a/net/wireless/wext-core.c +++ b/net/wireless/wext-core.c | |||
@@ -780,8 +780,10 @@ static int ioctl_standard_iw_point(struct iw_point *iwp, unsigned int cmd, | |||
780 | if (cmd == SIOCSIWENCODEEXT) { | 780 | if (cmd == SIOCSIWENCODEEXT) { |
781 | struct iw_encode_ext *ee = (void *) extra; | 781 | struct iw_encode_ext *ee = (void *) extra; |
782 | 782 | ||
783 | if (iwp->length < sizeof(*ee) + ee->key_len) | 783 | if (iwp->length < sizeof(*ee) + ee->key_len) { |
784 | return -EFAULT; | 784 | err = -EFAULT; |
785 | goto out; | ||
786 | } | ||
785 | } | 787 | } |
786 | } | 788 | } |
787 | 789 | ||