Pull networking fixes from Jakub Kicinski: "Including fixes from can, wireless and netfilter. Current release - regressions: - af_unix: fix task hung while purging oob_skb in GC - pds_core: do not try to run health-thread in VF path Current release - new code bugs: - sched: act_mirred: don't zero blockid when net device is being deleted Previous releases - regressions: - netfilter: - nat: restore default DNAT behavior - nf_tables: fix bidirectional offload, broken when unidirectional offload support was added - openvswitch: limit the number of recursions from action sets - eth: i40e: do not allow untrusted VF to remove administratively set MAC address Previous releases - always broken: - tls: fix races and bugs in use of async crypto - mptcp: prevent data races on some of the main socket fields, fix races in fastopen handling - dpll: fix possible deadlock during netlink dump operation - dsa: lan966x: fix crash when adding interface under a lag when some of the ports are disabled - can: j1939: prevent deadlock by changing j1939_socks_lock to rwlock Misc: - a handful of fixes and reliability improvements for selftests - fix sysfs documentation missing net/ in paths - finish the work of squashing the missing MODULE_DESCRIPTION() warnings in networking" * tag 'net-6.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (92 commits) net: fill in MODULE_DESCRIPTION()s for missing arcnet net: fill in MODULE_DESCRIPTION()s for mdio_devres net: fill in MODULE_DESCRIPTION()s for ppp net: fill in MODULE_DESCRIPTION()s for fddik/skfp net: fill in MODULE_DESCRIPTION()s for plip net: fill in MODULE_DESCRIPTION()s for ieee802154/fakelb net: fill in MODULE_DESCRIPTION()s for xen-netback net: ravb: Count packets instead of descriptors in GbEth RX path pppoe: Fix memory leak in pppoe_sendmsg() net: sctp: fix skb leak in sctp_inq_free() net: bcmasp: Handle RX buffer allocation failure net-timestamp: make sk_tskey more predictable in error path selftests: tls: increase the wait in poll_partial_rec_async ice: Add check for lport extraction to LAG init netfilter: nf_tables: fix bidirectional offload regression netfilter: nat: restore default DNAT behavior netfilter: nft_set_pipapo: fix missing : in kdoc igc: Remove temporary workaround igb: Fix string truncation warnings in igb_set_fw_version can: netlink: Fix TDCO calculation using the old data bittiming ...
Showing the changes to net (53 of 129 files). Show all
Unified · Split
| @@ -179,4 +179,5 @@ static void __exit lowpan_module_exit(void) · 178 unmodified lines | |||
| 179 | module_init(lowpan_module_init); | 179 | module_init(lowpan_module_init); |
| 180 | module_exit(lowpan_module_exit); | 180 | module_exit(lowpan_module_exit); |
| 181 | 181 | ||
| 182 | MODULE_DESCRIPTION("IPv6 over Low-Power Wireless Personal Area Network core module"); | ||
| 182 | MODULE_LICENSE("GPL"); | 183 | MODULE_LICENSE("GPL"); |
| @@ -1532,4 +1532,5 @@ static void __exit atm_mpoa_cleanup(void) · 1531 unmodified lines | |||
| 1532 | module_init(atm_mpoa_init); | 1532 | module_init(atm_mpoa_init); |
| 1533 | module_exit(atm_mpoa_cleanup); | 1533 | module_exit(atm_mpoa_cleanup); |
| 1534 | 1534 | ||
| 1535 | MODULE_DESCRIPTION("Multi-Protocol Over ATM (MPOA) driver"); | ||
| 1535 | MODULE_LICENSE("GPL"); | 1536 | MODULE_LICENSE("GPL"); |
| @@ -86,7 +86,7 @@ struct j1939_priv { · 85 unmodified lines | |||
| 86 | unsigned int tp_max_packet_size; | 86 | unsigned int tp_max_packet_size; |
| 87 | 87 | ||
| 88 | /* lock for j1939_socks list */ | 88 | /* lock for j1939_socks list */ |
| 89 | spinlock_t j1939_socks_lock; | 89 | rwlock_t j1939_socks_lock; |
| 90 | struct list_head j1939_socks; | 90 | struct list_head j1939_socks; |
| 91 | 91 | ||
| 92 | struct kref rx_kref; | 92 | struct kref rx_kref; |
| @@ -301,6 +301,7 @@ struct j1939_sock { · 208 unmodified lines | |||
| 301 | 301 | ||
| 302 | int ifindex; | 302 | int ifindex; |
| 303 | struct j1939_addr addr; | 303 | struct j1939_addr addr; |
| 304 | spinlock_t filters_lock; | ||
| 304 | struct j1939_filter *filters; | 305 | struct j1939_filter *filters; |
| 305 | int nfilters; | 306 | int nfilters; |
| 306 | pgn_t pgn_rx_filter; | 307 | pgn_t pgn_rx_filter; |
| @@ -274,7 +274,7 @@ struct j1939_priv *j1939_netdev_start(struct net_device *ndev) · 273 unmodified lines | |||
| 274 | return ERR_PTR(-ENOMEM); | 274 | return ERR_PTR(-ENOMEM); |
| 275 | 275 | ||
| 276 | j1939_tp_init(priv); | 276 | j1939_tp_init(priv); |
| 277 | spin_lock_init(&priv->j1939_socks_lock); | 277 | rwlock_init(&priv->j1939_socks_lock); |
| 278 | INIT_LIST_HEAD(&priv->j1939_socks); | 278 | INIT_LIST_HEAD(&priv->j1939_socks); |
| 279 | 279 | ||
| 280 | mutex_lock(&j1939_netdev_lock); | 280 | mutex_lock(&j1939_netdev_lock); |
| @@ -80,16 +80,16 @@ static void j1939_jsk_add(struct j1939_priv *priv, struct j1939_sock *jsk) · 79 unmodified lines | |||
| 80 | jsk->state |= J1939_SOCK_BOUND; | 80 | jsk->state |= J1939_SOCK_BOUND; |
| 81 | j1939_priv_get(priv); | 81 | j1939_priv_get(priv); |
| 82 | 82 | ||
| 83 | spin_lock_bh(&priv->j1939_socks_lock); | 83 | write_lock_bh(&priv->j1939_socks_lock); |
| 84 | list_add_tail(&jsk->list, &priv->j1939_socks); | 84 | list_add_tail(&jsk->list, &priv->j1939_socks); |
| 85 | spin_unlock_bh(&priv->j1939_socks_lock); | 85 | write_unlock_bh(&priv->j1939_socks_lock); |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | static void j1939_jsk_del(struct j1939_priv *priv, struct j1939_sock *jsk) | 88 | static void j1939_jsk_del(struct j1939_priv *priv, struct j1939_sock *jsk) |
| 89 | { | 89 | { |
| 90 | spin_lock_bh(&priv->j1939_socks_lock); | 90 | write_lock_bh(&priv->j1939_socks_lock); |
| 91 | list_del_init(&jsk->list); | 91 | list_del_init(&jsk->list); |
| 92 | spin_unlock_bh(&priv->j1939_socks_lock); | 92 | write_unlock_bh(&priv->j1939_socks_lock); |
| 93 | 93 | ||
| 94 | j1939_priv_put(priv); | 94 | j1939_priv_put(priv); |
| 95 | jsk->state &= ~J1939_SOCK_BOUND; | 95 | jsk->state &= ~J1939_SOCK_BOUND; |
| @@ -262,12 +262,17 @@ static bool j1939_sk_match_dst(struct j1939_sock *jsk, · 166 unmodified lines | |||
| 262 | static bool j1939_sk_match_filter(struct j1939_sock *jsk, | 262 | static bool j1939_sk_match_filter(struct j1939_sock *jsk, |
| 263 | const struct j1939_sk_buff_cb *skcb) | 263 | const struct j1939_sk_buff_cb *skcb) |
| 264 | { | 264 | { |
| 265 | const struct j1939_filter *f = jsk->filters; | 265 | const struct j1939_filter *f; |
| 266 | int nfilter = jsk->nfilters; | 266 | int nfilter; |
| 267 | |||
| 268 | spin_lock_bh(&jsk->filters_lock); | ||
| 269 | |||
| 270 | f = jsk->filters; | ||
| 271 | nfilter = jsk->nfilters; | ||
| 267 | 272 | ||
| 268 | if (!nfilter) | 273 | if (!nfilter) |
| 269 | /* receive all when no filters are assigned */ | 274 | /* receive all when no filters are assigned */ |
| 270 | return true; | 275 | goto filter_match_found; |
| 271 | 276 | ||
| 272 | for (; nfilter; ++f, --nfilter) { | 277 | for (; nfilter; ++f, --nfilter) { |
| 273 | if ((skcb->addr.pgn & f->pgn_mask) != f->pgn) | 278 | if ((skcb->addr.pgn & f->pgn_mask) != f->pgn) |
| @@ -276,9 +281,15 @@ static bool j1939_sk_match_filter(struct j1939_sock *jsk, · 2 unmodified lines | |||
| 276 | continue; | 281 | continue; |
| 277 | if ((skcb->addr.src_name & f->name_mask) != f->name) | 282 | if ((skcb->addr.src_name & f->name_mask) != f->name) |
| 278 | continue; | 283 | continue; |
| 279 | return true; | 284 | goto filter_match_found; |
| 280 | } | 285 | } |
| 286 | |||
| 287 | spin_unlock_bh(&jsk->filters_lock); | ||
| 281 | return false; | 288 | return false; |
| 289 | |||
| 290 | filter_match_found: | ||
| 291 | spin_unlock_bh(&jsk->filters_lock); | ||
| 292 | return true; | ||
| 282 | } | 293 | } |
| 283 | 294 | ||
| 284 | static bool j1939_sk_recv_match_one(struct j1939_sock *jsk, | 295 | static bool j1939_sk_recv_match_one(struct j1939_sock *jsk, |
| @@ -329,13 +340,13 @@ bool j1939_sk_recv_match(struct j1939_priv *priv, struct j1939_sk_buff_cb *skcb) · 44 unmodified lines | |||
| 329 | struct j1939_sock *jsk; | 340 | struct j1939_sock *jsk; |
| 330 | bool match = false; | 341 | bool match = false; |
| 331 | 342 | ||
| 332 | spin_lock_bh(&priv->j1939_socks_lock); | 343 | read_lock_bh(&priv->j1939_socks_lock); |
| 333 | list_for_each_entry(jsk, &priv->j1939_socks, list) { | 344 | list_for_each_entry(jsk, &priv->j1939_socks, list) { |
| 334 | match = j1939_sk_recv_match_one(jsk, skcb); | 345 | match = j1939_sk_recv_match_one(jsk, skcb); |
| 335 | if (match) | 346 | if (match) |
| 336 | break; | 347 | break; |
| 337 | } | 348 | } |
| 338 | spin_unlock_bh(&priv->j1939_socks_lock); | 349 | read_unlock_bh(&priv->j1939_socks_lock); |
| 339 | 350 | ||
| 340 | return match; | 351 | return match; |
| 341 | } | 352 | } |
| @@ -344,11 +355,11 @@ void j1939_sk_recv(struct j1939_priv *priv, struct sk_buff *skb) · 2 unmodified lines | |||
| 344 | { | 355 | { |
| 345 | struct j1939_sock *jsk; | 356 | struct j1939_sock *jsk; |
| 346 | 357 | ||
| 347 | spin_lock_bh(&priv->j1939_socks_lock); | 358 | read_lock_bh(&priv->j1939_socks_lock); |
| 348 | list_for_each_entry(jsk, &priv->j1939_socks, list) { | 359 | list_for_each_entry(jsk, &priv->j1939_socks, list) { |
| 349 | j1939_sk_recv_one(jsk, skb); | 360 | j1939_sk_recv_one(jsk, skb); |
| 350 | } | 361 | } |
| 351 | spin_unlock_bh(&priv->j1939_socks_lock); | 362 | read_unlock_bh(&priv->j1939_socks_lock); |
| 352 | } | 363 | } |
| 353 | 364 | ||
| 354 | static void j1939_sk_sock_destruct(struct sock *sk) | 365 | static void j1939_sk_sock_destruct(struct sock *sk) |
| @@ -401,6 +412,7 @@ static int j1939_sk_init(struct sock *sk) · 46 unmodified lines | |||
| 401 | atomic_set(&jsk->skb_pending, 0); | 412 | atomic_set(&jsk->skb_pending, 0); |
| 402 | spin_lock_init(&jsk->sk_session_queue_lock); | 413 | spin_lock_init(&jsk->sk_session_queue_lock); |
| 403 | INIT_LIST_HEAD(&jsk->sk_session_queue); | 414 | INIT_LIST_HEAD(&jsk->sk_session_queue); |
| 415 | spin_lock_init(&jsk->filters_lock); | ||
| 404 | 416 | ||
| 405 | /* j1939_sk_sock_destruct() depends on SOCK_RCU_FREE flag */ | 417 | /* j1939_sk_sock_destruct() depends on SOCK_RCU_FREE flag */ |
| 406 | sock_set_flag(sk, SOCK_RCU_FREE); | 418 | sock_set_flag(sk, SOCK_RCU_FREE); |
| @@ -703,9 +715,11 @@ static int j1939_sk_setsockopt(struct socket *sock, int level, int optname, · 296 unmodified lines | |||
| 703 | } | 715 | } |
| 704 | 716 | ||
| 705 | lock_sock(&jsk->sk); | 717 | lock_sock(&jsk->sk); |
| 718 | spin_lock_bh(&jsk->filters_lock); | ||
| 706 | ofilters = jsk->filters; | 719 | ofilters = jsk->filters; |
| 707 | jsk->filters = filters; | 720 | jsk->filters = filters; |
| 708 | jsk->nfilters = count; | 721 | jsk->nfilters = count; |
| 722 | spin_unlock_bh(&jsk->filters_lock); | ||
| 709 | release_sock(&jsk->sk); | 723 | release_sock(&jsk->sk); |
| 710 | kfree(ofilters); | 724 | kfree(ofilters); |
| 711 | return 0; | 725 | return 0; |
| @@ -1080,12 +1094,12 @@ void j1939_sk_errqueue(struct j1939_session *session, · 368 unmodified lines | |||
| 1080 | } | 1094 | } |
| 1081 | 1095 | ||
| 1082 | /* spread RX notifications to all sockets subscribed to this session */ | 1096 | /* spread RX notifications to all sockets subscribed to this session */ |
| 1083 | spin_lock_bh(&priv->j1939_socks_lock); | 1097 | read_lock_bh(&priv->j1939_socks_lock); |
| 1084 | list_for_each_entry(jsk, &priv->j1939_socks, list) { | 1098 | list_for_each_entry(jsk, &priv->j1939_socks, list) { |
| 1085 | if (j1939_sk_recv_match_one(jsk, &session->skcb)) | 1099 | if (j1939_sk_recv_match_one(jsk, &session->skcb)) |
| 1086 | __j1939_sk_errqueue(session, &jsk->sk, type); | 1100 | __j1939_sk_errqueue(session, &jsk->sk, type); |
| 1087 | } | 1101 | } |
| 1088 | spin_unlock_bh(&priv->j1939_socks_lock); | 1102 | read_unlock_bh(&priv->j1939_socks_lock); |
| 1089 | }; | 1103 | }; |
| 1090 | 1104 | ||
| 1091 | void j1939_sk_send_loop_abort(struct sock *sk, int err) | 1105 | void j1939_sk_send_loop_abort(struct sock *sk, int err) |
| @@ -1273,7 +1287,7 @@ void j1939_sk_netdev_event_netdown(struct j1939_priv *priv) · 181 unmodified lines | |||
| 1273 | struct j1939_sock *jsk; | 1287 | struct j1939_sock *jsk; |
| 1274 | int error_code = ENETDOWN; | 1288 | int error_code = ENETDOWN; |
| 1275 | 1289 | ||
| 1276 | spin_lock_bh(&priv->j1939_socks_lock); | 1290 | read_lock_bh(&priv->j1939_socks_lock); |
| 1277 | list_for_each_entry(jsk, &priv->j1939_socks, list) { | 1291 | list_for_each_entry(jsk, &priv->j1939_socks, list) { |
| 1278 | jsk->sk.sk_err = error_code; | 1292 | jsk->sk.sk_err = error_code; |
| 1279 | if (!sock_flag(&jsk->sk, SOCK_DEAD)) | 1293 | if (!sock_flag(&jsk->sk, SOCK_DEAD)) |
| @@ -1281,7 +1295,7 @@ void j1939_sk_netdev_event_netdown(struct j1939_priv *priv) · 1 unmodified line | |||
| 1281 | 1295 | ||
| 1282 | j1939_sk_queue_drop_all(priv, jsk, error_code); | 1296 | j1939_sk_queue_drop_all(priv, jsk, error_code); |
| 1283 | } | 1297 | } |
| 1284 | spin_unlock_bh(&priv->j1939_socks_lock); | 1298 | read_unlock_bh(&priv->j1939_socks_lock); |
| 1285 | } | 1299 | } |
| 1286 | 1300 | ||
| 1287 | static int j1939_sk_no_ioctlcmd(struct socket *sock, unsigned int cmd, | 1301 | static int j1939_sk_no_ioctlcmd(struct socket *sock, unsigned int cmd, |
| @@ -336,7 +336,7 @@ int netdev_name_node_alt_create(struct net_device *dev, const char *name) · 335 unmodified lines | |||
| 336 | return -ENOMEM; | 336 | return -ENOMEM; |
| 337 | netdev_name_node_add(net, name_node); | 337 | netdev_name_node_add(net, name_node); |
| 338 | /* The node that holds dev->name acts as a head of per-device list. */ | 338 | /* The node that holds dev->name acts as a head of per-device list. */ |
| 339 | list_add_tail(&name_node->list, &dev->name_node->list); | 339 | list_add_tail_rcu(&name_node->list, &dev->name_node->list); |
| 340 | 340 | ||
| 341 | return 0; | 341 | return 0; |
| 342 | } | 342 | } |
| @@ -11652,11 +11652,12 @@ static void __init net_dev_struct_check(void) · 11309 unmodified lines | |||
| 11652 | CACHELINE_ASSERT_GROUP_SIZE(struct net_device, net_device_read_tx, 160); | 11652 | CACHELINE_ASSERT_GROUP_SIZE(struct net_device, net_device_read_tx, 160); |
| 11653 | 11653 | ||
| 11654 | /* TXRX read-mostly hotpath */ | 11654 | /* TXRX read-mostly hotpath */ |
| 11655 | CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_txrx, lstats); | ||
| 11655 | CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_txrx, flags); | 11656 | CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_txrx, flags); |
| 11656 | CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_txrx, hard_header_len); | 11657 | CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_txrx, hard_header_len); |
| 11657 | CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_txrx, features); | 11658 | CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_txrx, features); |
| 11658 | CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_txrx, ip6_ptr); | 11659 | CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_txrx, ip6_ptr); |
| 11659 | CACHELINE_ASSERT_GROUP_SIZE(struct net_device, net_device_read_txrx, 30); | 11660 | CACHELINE_ASSERT_GROUP_SIZE(struct net_device, net_device_read_txrx, 38); |
| 11660 | 11661 | ||
| 11661 | /* RX read-mostly hotpath */ | 11662 | /* RX read-mostly hotpath */ |
| 11662 | CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_rx, ptype_specific); | 11663 | CACHELINE_ASSERT_GROUP_MEMBER(struct net_device, net_device_read_rx, ptype_specific); |
| @@ -1020,14 +1020,17 @@ static size_t rtnl_xdp_size(void) · 1019 unmodified lines | |||
| 1020 | static size_t rtnl_prop_list_size(const struct net_device *dev) | 1020 | static size_t rtnl_prop_list_size(const struct net_device *dev) |
| 1021 | { | 1021 | { |
| 1022 | struct netdev_name_node *name_node; | 1022 | struct netdev_name_node *name_node; |
| 1023 | size_t size; | 1023 | unsigned int cnt = 0; |
| 1024 | |||
| 1025 | rcu_read_lock(); | ||
| 1026 | list_for_each_entry_rcu(name_node, &dev->name_node->list, list) | ||
| 1027 | cnt++; | ||
| 1028 | rcu_read_unlock(); | ||
| 1024 | 1029 | ||
| 1025 | if (list_empty(&dev->name_node->list)) | 1030 | if (!cnt) |
| 1026 | return 0; | 1031 | return 0; |
| 1027 | size = nla_total_size(0); | 1032 | |
| 1028 | list_for_each_entry(name_node, &dev->name_node->list, list) | 1033 | return nla_total_size(0) + cnt * nla_total_size(ALTIFNAMSIZ); |
| 1029 | size += nla_total_size(ALTIFNAMSIZ); | ||
| 1030 | return size; | ||
| 1031 | } | 1034 | } |
| 1032 | 1035 | ||
| 1033 | static size_t rtnl_proto_down_size(const struct net_device *dev) | 1036 | static size_t rtnl_proto_down_size(const struct net_device *dev) |
| @@ -471,7 +471,10 @@ static void handshake_req_destroy_test1(struct kunit *test) · 470 unmodified lines | |||
| 471 | handshake_req_cancel(sock->sk); | 471 | handshake_req_cancel(sock->sk); |
| 472 | 472 | ||
| 473 | /* Act */ | 473 | /* Act */ |
| 474 | fput(filp); | 474 | /* Ensure the close/release/put process has run to |
| 475 | * completion before checking the result. | ||
| 476 | */ | ||
| 477 | __fput_sync(filp); | ||
| 475 | 478 | ||
| 476 | /* Assert */ | 479 | /* Assert */ |
| 477 | KUNIT_EXPECT_PTR_EQ(test, handshake_req_destroy_test, req); | 480 | KUNIT_EXPECT_PTR_EQ(test, handshake_req_destroy_test, req); |
| @@ -597,5 +597,6 @@ static void __exit ah4_fini(void) · 596 unmodified lines | |||
| 597 | 597 | ||
| 598 | module_init(ah4_init); | 598 | module_init(ah4_init); |
| 599 | module_exit(ah4_fini); | 599 | module_exit(ah4_fini); |
| 600 | MODULE_DESCRIPTION("IPv4 AH transformation library"); | ||
| 600 | MODULE_LICENSE("GPL"); | 601 | MODULE_LICENSE("GPL"); |
| 601 | MODULE_ALIAS_XFRM_TYPE(AF_INET, XFRM_PROTO_AH); | 602 | MODULE_ALIAS_XFRM_TYPE(AF_INET, XFRM_PROTO_AH); |
| @@ -1247,5 +1247,6 @@ static void __exit esp4_fini(void) · 1246 unmodified lines | |||
| 1247 | 1247 | ||
| 1248 | module_init(esp4_init); | 1248 | module_init(esp4_init); |
| 1249 | module_exit(esp4_fini); | 1249 | module_exit(esp4_fini); |
| 1250 | MODULE_DESCRIPTION("IPv4 ESP transformation library"); | ||
| 1250 | MODULE_LICENSE("GPL"); | 1251 | MODULE_LICENSE("GPL"); |
| 1251 | MODULE_ALIAS_XFRM_TYPE(AF_INET, XFRM_PROTO_ESP); | 1252 | MODULE_ALIAS_XFRM_TYPE(AF_INET, XFRM_PROTO_ESP); |
| @@ -1793,6 +1793,7 @@ static void __exit ipgre_fini(void) · 1792 unmodified lines | |||
| 1793 | 1793 | ||
| 1794 | module_init(ipgre_init); | 1794 | module_init(ipgre_init); |
| 1795 | module_exit(ipgre_fini); | 1795 | module_exit(ipgre_fini); |
| 1796 | MODULE_DESCRIPTION("IPv4 GRE tunnels over IP library"); | ||
| 1796 | MODULE_LICENSE("GPL"); | 1797 | MODULE_LICENSE("GPL"); |
| 1797 | MODULE_ALIAS_RTNL_LINK("gre"); | 1798 | MODULE_ALIAS_RTNL_LINK("gre"); |
| 1798 | MODULE_ALIAS_RTNL_LINK("gretap"); | 1799 | MODULE_ALIAS_RTNL_LINK("gretap"); |
| @@ -972,8 +972,8 @@ static int __ip_append_data(struct sock *sk, · 971 unmodified lines | |||
| 972 | unsigned int maxfraglen, fragheaderlen, maxnonfragsize; | 972 | unsigned int maxfraglen, fragheaderlen, maxnonfragsize; |
| 973 | int csummode = CHECKSUM_NONE; | 973 | int csummode = CHECKSUM_NONE; |
| 974 | struct rtable *rt = (struct rtable *)cork->dst; | 974 | struct rtable *rt = (struct rtable *)cork->dst; |
| 975 | bool paged, hold_tskey, extra_uref = false; | ||
| 975 | unsigned int wmem_alloc_delta = 0; | 976 | unsigned int wmem_alloc_delta = 0; |
| 976 | bool paged, extra_uref = false; | ||
| 977 | u32 tskey = 0; | 977 | u32 tskey = 0; |
| 978 | 978 | ||
| 979 | skb = skb_peek_tail(queue); | 979 | skb = skb_peek_tail(queue); |
| @@ -982,10 +982,6 @@ static int __ip_append_data(struct sock *sk, · 2 unmodified lines | |||
| 982 | mtu = cork->gso_size ? IP_MAX_MTU : cork->fragsize; | 982 | mtu = cork->gso_size ? IP_MAX_MTU : cork->fragsize; |
| 983 | paged = !!cork->gso_size; | 983 | paged = !!cork->gso_size; |
| 984 | 984 | ||
| 985 | if (cork->tx_flags & SKBTX_ANY_TSTAMP && | ||
| 986 | READ_ONCE(sk->sk_tsflags) & SOF_TIMESTAMPING_OPT_ID) | ||
| 987 | tskey = atomic_inc_return(&sk->sk_tskey) - 1; | ||
| 988 | |||
| 989 | hh_len = LL_RESERVED_SPACE(rt->dst.dev); | 985 | hh_len = LL_RESERVED_SPACE(rt->dst.dev); |
| 990 | 986 | ||
| 991 | fragheaderlen = sizeof(struct iphdr) + (opt ? opt->optlen : 0); | 987 | fragheaderlen = sizeof(struct iphdr) + (opt ? opt->optlen : 0); |
| @@ -1052,6 +1048,11 @@ static int __ip_append_data(struct sock *sk, · 60 unmodified lines | |||
| 1052 | 1048 | ||
| 1053 | cork->length += length; | 1049 | cork->length += length; |
| 1054 | 1050 | ||
| 1051 | hold_tskey = cork->tx_flags & SKBTX_ANY_TSTAMP && | ||
| 1052 | READ_ONCE(sk->sk_tsflags) & SOF_TIMESTAMPING_OPT_ID; | ||
| 1053 | if (hold_tskey) | ||
| 1054 | tskey = atomic_inc_return(&sk->sk_tskey) - 1; | ||
| 1055 | |||
| 1055 | /* So, what's going on in the loop below? | 1056 | /* So, what's going on in the loop below? |
| 1056 | * | 1057 | * |
| 1057 | * We use calculated fragment length to generate chained skb, | 1058 | * We use calculated fragment length to generate chained skb, |
| @@ -1274,6 +1275,8 @@ error: · 216 unmodified lines | |||
| 1274 | cork->length -= length; | 1275 | cork->length -= length; |
| 1275 | IP_INC_STATS(sock_net(sk), IPSTATS_MIB_OUTDISCARDS); | 1276 | IP_INC_STATS(sock_net(sk), IPSTATS_MIB_OUTDISCARDS); |
| 1276 | refcount_add(wmem_alloc_delta, &sk->sk_wmem_alloc); | 1277 | refcount_add(wmem_alloc_delta, &sk->sk_wmem_alloc); |
| 1278 | if (hold_tskey) | ||
| 1279 | atomic_dec(&sk->sk_tskey); | ||
| 1277 | return err; | 1280 | return err; |
| 1278 | } | 1281 | } |
| 1279 | 1282 | ||
| @@ -1298,4 +1298,5 @@ void ip_tunnel_setup(struct net_device *dev, unsigned int net_id) · 1297 unmodified lines | |||
| 1298 | } | 1298 | } |
| 1299 | EXPORT_SYMBOL_GPL(ip_tunnel_setup); | 1299 | EXPORT_SYMBOL_GPL(ip_tunnel_setup); |
| 1300 | 1300 | ||
| 1301 | MODULE_DESCRIPTION("IPv4 tunnel implementation library"); | ||
| 1301 | MODULE_LICENSE("GPL"); | 1302 | MODULE_LICENSE("GPL"); |
| @@ -721,6 +721,7 @@ static void __exit vti_fini(void) · 720 unmodified lines | |||
| 721 | 721 | ||
| 722 | module_init(vti_init); | 722 | module_init(vti_init); |
| 723 | module_exit(vti_fini); | 723 | module_exit(vti_fini); |
| 724 | MODULE_DESCRIPTION("Virtual (secure) IP tunneling library"); | ||
| 724 | MODULE_LICENSE("GPL"); | 725 | MODULE_LICENSE("GPL"); |
| 725 | MODULE_ALIAS_RTNL_LINK("vti"); | 726 | MODULE_ALIAS_RTNL_LINK("vti"); |
| 726 | MODULE_ALIAS_NETDEV("ip_vti0"); | 727 | MODULE_ALIAS_NETDEV("ip_vti0"); |
| @@ -658,6 +658,7 @@ static void __exit ipip_fini(void) · 657 unmodified lines | |||
| 658 | 658 | ||
| 659 | module_init(ipip_init); | 659 | module_init(ipip_init); |
| 660 | module_exit(ipip_fini); | 660 | module_exit(ipip_fini); |
| 661 | MODULE_DESCRIPTION("IP/IP protocol decoder library"); | ||
| 661 | MODULE_LICENSE("GPL"); | 662 | MODULE_LICENSE("GPL"); |
| 662 | MODULE_ALIAS_RTNL_LINK("ipip"); | 663 | MODULE_ALIAS_RTNL_LINK("ipip"); |
| 663 | MODULE_ALIAS_NETDEV("tunl0"); | 664 | MODULE_ALIAS_NETDEV("tunl0"); |
| @@ -4615,7 +4615,8 @@ static void __init tcp_struct_check(void) · 4614 unmodified lines | |||
| 4615 | CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, prr_out); | 4615 | CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, prr_out); |
| 4616 | CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, lost_out); | 4616 | CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, lost_out); |
| 4617 | CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, sacked_out); | 4617 | CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, sacked_out); |
| 4618 | CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_read_txrx, 31); | 4618 | CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, scaling_ratio); |
| 4619 | CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_read_txrx, 32); | ||
| 4619 | 4620 | ||
| 4620 | /* RX read-mostly hotpath cache lines */ | 4621 | /* RX read-mostly hotpath cache lines */ |
| 4621 | CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, copied_seq); | 4622 | CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, copied_seq); |
| @@ -294,4 +294,5 @@ static void __exit tunnel4_fini(void) · 293 unmodified lines | |||
| 294 | 294 | ||
| 295 | module_init(tunnel4_init); | 295 | module_init(tunnel4_init); |
| 296 | module_exit(tunnel4_fini); | 296 | module_exit(tunnel4_fini); |
| 297 | MODULE_DESCRIPTION("IPv4 XFRM tunnel library"); | ||
| 297 | MODULE_LICENSE("GPL"); | 298 | MODULE_LICENSE("GPL"); |
| @@ -253,4 +253,5 @@ struct rtable *udp_tunnel_dst_lookup(struct sk_buff *skb, · 252 unmodified lines | |||
| 253 | } | 253 | } |
| 254 | EXPORT_SYMBOL_GPL(udp_tunnel_dst_lookup); | 254 | EXPORT_SYMBOL_GPL(udp_tunnel_dst_lookup); |
| 255 | 255 | ||
| 256 | MODULE_DESCRIPTION("IPv4 Foo over UDP tunnel driver"); | ||
| 256 | MODULE_LICENSE("GPL"); | 257 | MODULE_LICENSE("GPL"); |
| @@ -114,5 +114,6 @@ static void __exit ipip_fini(void) · 113 unmodified lines | |||
| 114 | 114 | ||
| 115 | module_init(ipip_init); | 115 | module_init(ipip_init); |
| 116 | module_exit(ipip_fini); | 116 | module_exit(ipip_fini); |
| 117 | MODULE_DESCRIPTION("IPv4 XFRM tunnel driver"); | ||
| 117 | MODULE_LICENSE("GPL"); | 118 | MODULE_LICENSE("GPL"); |
| 118 | MODULE_ALIAS_XFRM_TYPE(AF_INET, XFRM_PROTO_IPIP); | 119 | MODULE_ALIAS_XFRM_TYPE(AF_INET, XFRM_PROTO_IPIP); |
| @@ -800,5 +800,6 @@ static void __exit ah6_fini(void) · 799 unmodified lines | |||
| 800 | module_init(ah6_init); | 800 | module_init(ah6_init); |
| 801 | module_exit(ah6_fini); | 801 | module_exit(ah6_fini); |
| 802 | 802 | ||
| 803 | MODULE_DESCRIPTION("IPv6 AH transformation helpers"); | ||
| 803 | MODULE_LICENSE("GPL"); | 804 | MODULE_LICENSE("GPL"); |
| 804 | MODULE_ALIAS_XFRM_TYPE(AF_INET6, XFRM_PROTO_AH); | 805 | MODULE_ALIAS_XFRM_TYPE(AF_INET6, XFRM_PROTO_AH); |
| @@ -1301,5 +1301,6 @@ static void __exit esp6_fini(void) · 1300 unmodified lines | |||
| 1301 | module_init(esp6_init); | 1301 | module_init(esp6_init); |
| 1302 | module_exit(esp6_fini); | 1302 | module_exit(esp6_fini); |
| 1303 | 1303 | ||
| 1304 | MODULE_DESCRIPTION("IPv6 ESP transformation helpers"); | ||
| 1304 | MODULE_LICENSE("GPL"); | 1305 | MODULE_LICENSE("GPL"); |
| 1305 | MODULE_ALIAS_XFRM_TYPE(AF_INET6, XFRM_PROTO_ESP); | 1306 | MODULE_ALIAS_XFRM_TYPE(AF_INET6, XFRM_PROTO_ESP); |
| @@ -1424,11 +1424,11 @@ static int __ip6_append_data(struct sock *sk, · 1423 unmodified lines | |||
| 1424 | bool zc = false; | 1424 | bool zc = false; |
| 1425 | u32 tskey = 0; | 1425 | u32 tskey = 0; |
| 1426 | struct rt6_info *rt = (struct rt6_info *)cork->dst; | 1426 | struct rt6_info *rt = (struct rt6_info *)cork->dst; |
| 1427 | bool paged, hold_tskey, extra_uref = false; | ||
| 1427 | struct ipv6_txoptions *opt = v6_cork->opt; | 1428 | struct ipv6_txoptions *opt = v6_cork->opt; |
| 1428 | int csummode = CHECKSUM_NONE; | 1429 | int csummode = CHECKSUM_NONE; |
| 1429 | unsigned int maxnonfragsize, headersize; | 1430 | unsigned int maxnonfragsize, headersize; |
| 1430 | unsigned int wmem_alloc_delta = 0; | 1431 | unsigned int wmem_alloc_delta = 0; |
| 1431 | bool paged, extra_uref = false; | ||
| 1432 | 1432 | ||
| 1433 | skb = skb_peek_tail(queue); | 1433 | skb = skb_peek_tail(queue); |
| 1434 | if (!skb) { | 1434 | if (!skb) { |
| @@ -1440,10 +1440,6 @@ static int __ip6_append_data(struct sock *sk, · 5 unmodified lines | |||
| 1440 | mtu = cork->gso_size ? IP6_MAX_MTU : cork->fragsize; | 1440 | mtu = cork->gso_size ? IP6_MAX_MTU : cork->fragsize; |
| 1441 | orig_mtu = mtu; | 1441 | orig_mtu = mtu; |
| 1442 | 1442 | ||
| 1443 | if (cork->tx_flags & SKBTX_ANY_TSTAMP && | ||
| 1444 | READ_ONCE(sk->sk_tsflags) & SOF_TIMESTAMPING_OPT_ID) | ||
| 1445 | tskey = atomic_inc_return(&sk->sk_tskey) - 1; | ||
| 1446 | |||
| 1447 | hh_len = LL_RESERVED_SPACE(rt->dst.dev); | 1443 | hh_len = LL_RESERVED_SPACE(rt->dst.dev); |
| 1448 | 1444 | ||
| 1449 | fragheaderlen = sizeof(struct ipv6hdr) + rt->rt6i_nfheader_len + | 1445 | fragheaderlen = sizeof(struct ipv6hdr) + rt->rt6i_nfheader_len + |
| @@ -1538,6 +1534,11 @@ emsgsize: · 88 unmodified lines | |||
| 1538 | flags &= ~MSG_SPLICE_PAGES; | 1534 | flags &= ~MSG_SPLICE_PAGES; |
| 1539 | } | 1535 | } |
| 1540 | 1536 | ||
| 1537 | hold_tskey = cork->tx_flags & SKBTX_ANY_TSTAMP && | ||
| 1538 | READ_ONCE(sk->sk_tsflags) & SOF_TIMESTAMPING_OPT_ID; | ||
| 1539 | if (hold_tskey) | ||
| 1540 | tskey = atomic_inc_return(&sk->sk_tskey) - 1; | ||
| 1541 | |||
| 1541 | /* | 1542 | /* |
| 1542 | * Let's try using as much space as possible. | 1543 | * Let's try using as much space as possible. |
| 1543 | * Use MTU if total length of the message fits into the MTU. | 1544 | * Use MTU if total length of the message fits into the MTU. |
| @@ -1794,6 +1795,8 @@ error: · 250 unmodified lines | |||
| 1794 | cork->length -= length; | 1795 | cork->length -= length; |
| 1795 | IP6_INC_STATS(sock_net(sk), rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS); | 1796 | IP6_INC_STATS(sock_net(sk), rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS); |
| 1796 | refcount_add(wmem_alloc_delta, &sk->sk_wmem_alloc); | 1797 | refcount_add(wmem_alloc_delta, &sk->sk_wmem_alloc); |
| 1798 | if (hold_tskey) | ||
| 1799 | atomic_dec(&sk->sk_tskey); | ||
| 1797 | return err; | 1800 | return err; |
| 1798 | } | 1801 | } |
| 1799 | 1802 | ||
| @@ -182,4 +182,5 @@ struct dst_entry *udp_tunnel6_dst_lookup(struct sk_buff *skb, · 181 unmodified lines | |||
| 182 | } | 182 | } |
| 183 | EXPORT_SYMBOL_GPL(udp_tunnel6_dst_lookup); | 183 | EXPORT_SYMBOL_GPL(udp_tunnel6_dst_lookup); |
| 184 | 184 | ||
| 185 | MODULE_DESCRIPTION("IPv6 Foo over UDP tunnel driver"); | ||
| 185 | MODULE_LICENSE("GPL"); | 186 | MODULE_LICENSE("GPL"); |
| @@ -405,6 +405,7 @@ static void __exit mip6_fini(void) · 404 unmodified lines | |||
| 405 | module_init(mip6_init); | 405 | module_init(mip6_init); |
| 406 | module_exit(mip6_fini); | 406 | module_exit(mip6_fini); |
| 407 | 407 | ||
| 408 | MODULE_DESCRIPTION("IPv6 Mobility driver"); | ||
| 408 | MODULE_LICENSE("GPL"); | 409 | MODULE_LICENSE("GPL"); |
| 409 | MODULE_ALIAS_XFRM_TYPE(AF_INET6, XFRM_PROTO_DSTOPTS); | 410 | MODULE_ALIAS_XFRM_TYPE(AF_INET6, XFRM_PROTO_DSTOPTS); |
| 410 | MODULE_ALIAS_XFRM_TYPE(AF_INET6, XFRM_PROTO_ROUTING); | 411 | MODULE_ALIAS_XFRM_TYPE(AF_INET6, XFRM_PROTO_ROUTING); |
| @@ -1956,6 +1956,7 @@ xfrm_tunnel_failed: · 1955 unmodified lines | |||
| 1956 | 1956 | ||
| 1957 | module_init(sit_init); | 1957 | module_init(sit_init); |
| 1958 | module_exit(sit_cleanup); | 1958 | module_exit(sit_cleanup); |
| 1959 | MODULE_DESCRIPTION("IPv6-in-IPv4 tunnel SIT driver"); | ||
| 1959 | MODULE_LICENSE("GPL"); | 1960 | MODULE_LICENSE("GPL"); |
| 1960 | MODULE_ALIAS_RTNL_LINK("sit"); | 1961 | MODULE_ALIAS_RTNL_LINK("sit"); |
| 1961 | MODULE_ALIAS_NETDEV("sit0"); | 1962 | MODULE_ALIAS_NETDEV("sit0"); |
| @@ -302,4 +302,5 @@ static void __exit tunnel6_fini(void) · 301 unmodified lines | |||
| 302 | 302 | ||
| 303 | module_init(tunnel6_init); | 303 | module_init(tunnel6_init); |
| 304 | module_exit(tunnel6_fini); | 304 | module_exit(tunnel6_fini); |
| 305 | MODULE_DESCRIPTION("IP-in-IPv6 tunnel driver"); | ||
| 305 | MODULE_LICENSE("GPL"); | 306 | MODULE_LICENSE("GPL"); |
| @@ -401,5 +401,6 @@ static void __exit xfrm6_tunnel_fini(void) · 400 unmodified lines | |||
| 401 | 401 | ||
| 402 | module_init(xfrm6_tunnel_init); | 402 | module_init(xfrm6_tunnel_init); |
| 403 | module_exit(xfrm6_tunnel_fini); | 403 | module_exit(xfrm6_tunnel_fini); |
| 404 | MODULE_DESCRIPTION("IPv6 XFRM tunnel driver"); | ||
| 404 | MODULE_LICENSE("GPL"); | 405 | MODULE_LICENSE("GPL"); |
| 405 | MODULE_ALIAS_XFRM_TYPE(AF_INET6, XFRM_PROTO_IPV6); | 406 | MODULE_ALIAS_XFRM_TYPE(AF_INET6, XFRM_PROTO_IPV6); |
| @@ -3924,5 +3924,6 @@ out_unregister_key_proto: · 3923 unmodified lines | |||
| 3924 | 3924 | ||
| 3925 | module_init(ipsec_pfkey_init); | 3925 | module_init(ipsec_pfkey_init); |
| 3926 | module_exit(ipsec_pfkey_exit); | 3926 | module_exit(ipsec_pfkey_exit); |
| 3927 | MODULE_DESCRIPTION("PF_KEY socket helpers"); | ||
| 3927 | MODULE_LICENSE("GPL"); | 3928 | MODULE_LICENSE("GPL"); |
| 3928 | MODULE_ALIAS_NETPROTO(PF_KEY); | 3929 | MODULE_ALIAS_NETPROTO(PF_KEY); |
| @@ -5,7 +5,7 @@ · 4 unmodified lines | |||
| 5 | * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> | 5 | * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> |
| 6 | * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> | 6 | * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> |
| 7 | * Copyright 2013-2014 Intel Mobile Communications GmbH | 7 | * Copyright 2013-2014 Intel Mobile Communications GmbH |
| 8 | * Copyright (C) 2018-2022 Intel Corporation | 8 | * Copyright (C) 2018-2024 Intel Corporation |
| 9 | * | 9 | * |
| 10 | * Transmit and frame generation functions. | 10 | * Transmit and frame generation functions. |
| 11 | */ | 11 | */ |
| @@ -3927,6 +3927,7 @@ begin: · 3915 unmodified lines | |||
| 3927 | goto begin; | 3927 | goto begin; |
| 3928 | 3928 | ||
| 3929 | skb = __skb_dequeue(&tx.skbs); | 3929 | skb = __skb_dequeue(&tx.skbs); |
| 3930 | info = IEEE80211_SKB_CB(skb); | ||
| 3930 | 3931 | ||
| 3931 | if (!skb_queue_empty(&tx.skbs)) { | 3932 | if (!skb_queue_empty(&tx.skbs)) { |
| 3932 | spin_lock_bh(&fq->lock); | 3933 | spin_lock_bh(&fq->lock); |
| @@ -3971,7 +3972,7 @@ begin: · 38 unmodified lines | |||
| 3971 | } | 3972 | } |
| 3972 | 3973 | ||
| 3973 | encap_out: | 3974 | encap_out: |
| 3974 | IEEE80211_SKB_CB(skb)->control.vif = vif; | 3975 | info->control.vif = vif; |
| 3975 | 3976 | ||
| 3976 | if (tx.sta && | 3977 | if (tx.sta && |
| 3977 | wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) { | 3978 | wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) { |
| @@ -59,13 +59,12 @@ void mptcp_fastopen_subflow_synack_set_params(struct mptcp_subflow_context *subf · 58 unmodified lines | |||
| 59 | mptcp_data_unlock(sk); | 59 | mptcp_data_unlock(sk); |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | void mptcp_fastopen_gen_msk_ackseq(struct mptcp_sock *msk, struct mptcp_subflow_context *subflow, | 62 | void __mptcp_fastopen_gen_msk_ackseq(struct mptcp_sock *msk, struct mptcp_subflow_context *subflow, |
| 63 | const struct mptcp_options_received *mp_opt) | 63 | const struct mptcp_options_received *mp_opt) |
| 64 | { | 64 | { |
| 65 | struct sock *sk = (struct sock *)msk; | 65 | struct sock *sk = (struct sock *)msk; |
| 66 | struct sk_buff *skb; | 66 | struct sk_buff *skb; |
| 67 | 67 | ||
| 68 | mptcp_data_lock(sk); | ||
| 69 | skb = skb_peek_tail(&sk->sk_receive_queue); | 68 | skb = skb_peek_tail(&sk->sk_receive_queue); |
| 70 | if (skb) { | 69 | if (skb) { |
| 71 | WARN_ON_ONCE(MPTCP_SKB_CB(skb)->end_seq); | 70 | WARN_ON_ONCE(MPTCP_SKB_CB(skb)->end_seq); |
| @@ -77,5 +76,4 @@ void mptcp_fastopen_gen_msk_ackseq(struct mptcp_sock *msk, struct mptcp_subflow_ · 5 unmodified lines | |||
| 77 | } | 76 | } |
| 78 | 77 | ||
| 79 | pr_debug("msk=%p ack_seq=%llx", msk, msk->ack_seq); | 78 | pr_debug("msk=%p ack_seq=%llx", msk, msk->ack_seq); |
| 80 | mptcp_data_unlock(sk); | ||
| 81 | } | 79 | } |
| @@ -962,9 +962,7 @@ static bool check_fully_established(struct mptcp_sock *msk, struct sock *ssk, · 961 unmodified lines | |||
| 962 | /* subflows are fully established as soon as we get any | 962 | /* subflows are fully established as soon as we get any |
| 963 | * additional ack, including ADD_ADDR. | 963 | * additional ack, including ADD_ADDR. |
| 964 | */ | 964 | */ |
| 965 | subflow->fully_established = 1; | 965 | goto set_fully_established; |
| 966 | WRITE_ONCE(msk->fully_established, true); | ||
| 967 | goto check_notify; | ||
| 968 | } | 966 | } |
| 969 | 967 | ||
| 970 | /* If the first established packet does not contain MP_CAPABLE + data | 968 | /* If the first established packet does not contain MP_CAPABLE + data |
| @@ -986,7 +984,10 @@ static bool check_fully_established(struct mptcp_sock *msk, struct sock *ssk, · 15 unmodified lines | |||
| 986 | set_fully_established: | 984 | set_fully_established: |
| 987 | if (unlikely(!READ_ONCE(msk->pm.server_side))) | 985 | if (unlikely(!READ_ONCE(msk->pm.server_side))) |
| 988 | pr_warn_once("bogus mpc option on established client sk"); | 986 | pr_warn_once("bogus mpc option on established client sk"); |
| 989 | mptcp_subflow_fully_established(subflow, mp_opt); | 987 | |
| 988 | mptcp_data_lock((struct sock *)msk); | ||
| 989 | __mptcp_subflow_fully_established(msk, subflow, mp_opt); | ||
| 990 | mptcp_data_unlock((struct sock *)msk); | ||
| 990 | 991 | ||
| 991 | check_notify: | 992 | check_notify: |
| 992 | /* if the subflow is not already linked into the conn_list, we can't | 993 | /* if the subflow is not already linked into the conn_list, we can't |
| @@ -130,10 +130,21 @@ int mptcp_userspace_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk, · 129 unmodified lines | |||
| 130 | int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk, | 130 | int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk, |
| 131 | struct mptcp_addr_info *skc) | 131 | struct mptcp_addr_info *skc) |
| 132 | { | 132 | { |
| 133 | struct mptcp_pm_addr_entry new_entry; | 133 | struct mptcp_pm_addr_entry *entry = NULL, *e, new_entry; |
| 134 | __be16 msk_sport = ((struct inet_sock *) | 134 | __be16 msk_sport = ((struct inet_sock *) |
| 135 | inet_sk((struct sock *)msk))->inet_sport; | 135 | inet_sk((struct sock *)msk))->inet_sport; |
| 136 | 136 | ||
| 137 | spin_lock_bh(&msk->pm.lock); | ||
| 138 | list_for_each_entry(e, &msk->pm.userspace_pm_local_addr_list, list) { | ||
| 139 | if (mptcp_addresses_equal(&e->addr, skc, false)) { | ||
| 140 | entry = e; | ||
| 141 | break; | ||
| 142 | } | ||
| 143 | } | ||
| 144 | spin_unlock_bh(&msk->pm.lock); | ||
| 145 | if (entry) | ||
| 146 | return entry->addr.id; | ||
| 147 | |||
| 137 | memset(&new_entry, 0, sizeof(struct mptcp_pm_addr_entry)); | 148 | memset(&new_entry, 0, sizeof(struct mptcp_pm_addr_entry)); |
| 138 | new_entry.addr = *skc; | 149 | new_entry.addr = *skc; |
| 139 | new_entry.addr.id = 0; | 150 | new_entry.addr.id = 0; |
| @@ -1505,8 +1505,11 @@ static void mptcp_update_post_push(struct mptcp_sock *msk, · 1504 unmodified lines | |||
| 1505 | 1505 | ||
| 1506 | void mptcp_check_and_set_pending(struct sock *sk) | 1506 | void mptcp_check_and_set_pending(struct sock *sk) |
| 1507 | { | 1507 | { |
| 1508 | if (mptcp_send_head(sk)) | 1508 | if (mptcp_send_head(sk)) { |
| 1509 | mptcp_sk(sk)->push_pending |= BIT(MPTCP_PUSH_PENDING); | 1509 | mptcp_data_lock(sk); |
| 1510 | mptcp_sk(sk)->cb_flags |= BIT(MPTCP_PUSH_PENDING); | ||
| 1511 | mptcp_data_unlock(sk); | ||
| 1512 | } | ||
| 1510 | } | 1513 | } |
| 1511 | 1514 | ||
| 1512 | static int __subflow_push_pending(struct sock *sk, struct sock *ssk, | 1515 | static int __subflow_push_pending(struct sock *sk, struct sock *ssk, |
| @@ -1960,6 +1963,9 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied) · 447 unmodified lines | |||
| 1960 | if (copied <= 0) | 1963 | if (copied <= 0) |
| 1961 | return; | 1964 | return; |
| 1962 | 1965 | ||
| 1966 | if (!msk->rcvspace_init) | ||
| 1967 | mptcp_rcv_space_init(msk, msk->first); | ||
| 1968 | |||
| 1963 | msk->rcvq_space.copied += copied; | 1969 | msk->rcvq_space.copied += copied; |
| 1964 | 1970 | ||
| 1965 | mstamp = div_u64(tcp_clock_ns(), NSEC_PER_USEC); | 1971 | mstamp = div_u64(tcp_clock_ns(), NSEC_PER_USEC); |
| @@ -3142,7 +3148,6 @@ static int mptcp_disconnect(struct sock *sk, int flags) · 1176 unmodified lines | |||
| 3142 | mptcp_destroy_common(msk, MPTCP_CF_FASTCLOSE); | 3148 | mptcp_destroy_common(msk, MPTCP_CF_FASTCLOSE); |
| 3143 | WRITE_ONCE(msk->flags, 0); | 3149 | WRITE_ONCE(msk->flags, 0); |
| 3144 | msk->cb_flags = 0; | 3150 | msk->cb_flags = 0; |
| 3145 | msk->push_pending = 0; | ||
| 3146 | msk->recovery = false; | 3151 | msk->recovery = false; |
| 3147 | msk->can_ack = false; | 3152 | msk->can_ack = false; |
| 3148 | msk->fully_established = false; | 3153 | msk->fully_established = false; |
| @@ -3158,6 +3163,7 @@ static int mptcp_disconnect(struct sock *sk, int flags) · 9 unmodified lines | |||
| 3158 | msk->bytes_received = 0; | 3163 | msk->bytes_received = 0; |
| 3159 | msk->bytes_sent = 0; | 3164 | msk->bytes_sent = 0; |
| 3160 | msk->bytes_retrans = 0; | 3165 | msk->bytes_retrans = 0; |
| 3166 | msk->rcvspace_init = 0; | ||
| 3161 | 3167 | ||
| 3162 | WRITE_ONCE(sk->sk_shutdown, 0); | 3168 | WRITE_ONCE(sk->sk_shutdown, 0); |
| 3163 | sk_error_report(sk); | 3169 | sk_error_report(sk); |
| @@ -3180,6 +3186,7 @@ struct sock *mptcp_sk_clone_init(const struct sock *sk, · 16 unmodified lines | |||
| 3180 | { | 3186 | { |
| 3181 | struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); | 3187 | struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); |
| 3182 | struct sock *nsk = sk_clone_lock(sk, GFP_ATOMIC); | 3188 | struct sock *nsk = sk_clone_lock(sk, GFP_ATOMIC); |
| 3189 | struct mptcp_subflow_context *subflow; | ||
| 3183 | struct mptcp_sock *msk; | 3190 | struct mptcp_sock *msk; |
| 3184 | 3191 | ||
| 3185 | if (!nsk) | 3192 | if (!nsk) |
| @@ -3220,7 +3227,8 @@ struct sock *mptcp_sk_clone_init(const struct sock *sk, · 34 unmodified lines | |||
| 3220 | 3227 | ||
| 3221 | /* The msk maintain a ref to each subflow in the connections list */ | 3228 | /* The msk maintain a ref to each subflow in the connections list */ |
| 3222 | WRITE_ONCE(msk->first, ssk); | 3229 | WRITE_ONCE(msk->first, ssk); |
| 3223 | list_add(&mptcp_subflow_ctx(ssk)->node, &msk->conn_list); | 3230 | subflow = mptcp_subflow_ctx(ssk); |
| 3231 | list_add(&subflow->node, &msk->conn_list); | ||
| 3224 | sock_hold(ssk); | 3232 | sock_hold(ssk); |
| 3225 | 3233 | ||
| 3226 | /* new mpc subflow takes ownership of the newly | 3234 | /* new mpc subflow takes ownership of the newly |
| @@ -3235,6 +3243,9 @@ struct sock *mptcp_sk_clone_init(const struct sock *sk, · 8 unmodified lines | |||
| 3235 | __mptcp_propagate_sndbuf(nsk, ssk); | 3243 | __mptcp_propagate_sndbuf(nsk, ssk); |
| 3236 | 3244 | ||
| 3237 | mptcp_rcv_space_init(msk, ssk); | 3245 | mptcp_rcv_space_init(msk, ssk); |
| 3246 | |||
| 3247 | if (mp_opt->suboptions & OPTION_MPTCP_MPC_ACK) | ||
| 3248 | __mptcp_subflow_fully_established(msk, subflow, mp_opt); | ||
| 3238 | bh_unlock_sock(nsk); | 3249 | bh_unlock_sock(nsk); |
| 3239 | 3250 | ||
| 3240 | /* note: the newly allocated socket refcount is 2 now */ | 3251 | /* note: the newly allocated socket refcount is 2 now */ |
| @@ -3245,6 +3256,7 @@ void mptcp_rcv_space_init(struct mptcp_sock *msk, const struct sock *ssk) · 4 unmodified lines | |||
| 3245 | { | 3256 | { |
| 3246 | const struct tcp_sock *tp = tcp_sk(ssk); | 3257 | const struct tcp_sock *tp = tcp_sk(ssk); |
| 3247 | 3258 | ||
| 3259 | msk->rcvspace_init = 1; | ||
| 3248 | msk->rcvq_space.copied = 0; | 3260 | msk->rcvq_space.copied = 0; |
| 3249 | msk->rcvq_space.rtt_us = 0; | 3261 | msk->rcvq_space.rtt_us = 0; |
| 3250 | 3262 | ||
| @@ -3255,8 +3267,6 @@ void mptcp_rcv_space_init(struct mptcp_sock *msk, const struct sock *ssk) · 4 unmodified lines | |||
| 3255 | TCP_INIT_CWND * tp->advmss); | 3267 | TCP_INIT_CWND * tp->advmss); |
| 3256 | if (msk->rcvq_space.space == 0) | 3268 | if (msk->rcvq_space.space == 0) |
| 3257 | msk->rcvq_space.space = TCP_INIT_CWND * TCP_MSS_DEFAULT; | 3269 | msk->rcvq_space.space = TCP_INIT_CWND * TCP_MSS_DEFAULT; |
| 3258 | |||
| 3259 | WRITE_ONCE(msk->wnd_end, msk->snd_nxt + tcp_sk(ssk)->snd_wnd); | ||
| 3260 | } | 3270 | } |
| 3261 | 3271 | ||
| 3262 | void mptcp_destroy_common(struct mptcp_sock *msk, unsigned int flags) | 3272 | void mptcp_destroy_common(struct mptcp_sock *msk, unsigned int flags) |
| @@ -3330,8 +3340,7 @@ static void mptcp_release_cb(struct sock *sk) · 67 unmodified lines | |||
| 3330 | struct mptcp_sock *msk = mptcp_sk(sk); | 3340 | struct mptcp_sock *msk = mptcp_sk(sk); |
| 3331 | 3341 | ||
| 3332 | for (;;) { | 3342 | for (;;) { |
| 3333 | unsigned long flags = (msk->cb_flags & MPTCP_FLAGS_PROCESS_CTX_NEED) | | 3343 | unsigned long flags = (msk->cb_flags & MPTCP_FLAGS_PROCESS_CTX_NEED); |
| 3334 | msk->push_pending; | ||
| 3335 | struct list_head join_list; | 3344 | struct list_head join_list; |
| 3336 | 3345 | ||
| 3337 | if (!flags) | 3346 | if (!flags) |
| @@ -3347,7 +3356,6 @@ static void mptcp_release_cb(struct sock *sk) · 9 unmodified lines | |||
| 3347 | * datapath acquires the msk socket spinlock while helding | 3356 | * datapath acquires the msk socket spinlock while helding |
| 3348 | * the subflow socket lock | 3357 | * the subflow socket lock |
| 3349 | */ | 3358 | */ |
| 3350 | msk->push_pending = 0; | ||
| 3351 | msk->cb_flags &= ~flags; | 3359 | msk->cb_flags &= ~flags; |
| 3352 | spin_unlock_bh(&sk->sk_lock.slock); | 3360 | spin_unlock_bh(&sk->sk_lock.slock); |
| 3353 | 3361 | ||
| @@ -3475,13 +3483,8 @@ void mptcp_finish_connect(struct sock *ssk) · 121 unmodified lines | |||
| 3475 | * accessing the field below | 3483 | * accessing the field below |
| 3476 | */ | 3484 | */ |
| 3477 | WRITE_ONCE(msk->local_key, subflow->local_key); | 3485 | WRITE_ONCE(msk->local_key, subflow->local_key); |
| 3478 | WRITE_ONCE(msk->write_seq, subflow->idsn + 1); | ||
| 3479 | WRITE_ONCE(msk->snd_nxt, msk->write_seq); | ||
| 3480 | WRITE_ONCE(msk->snd_una, msk->write_seq); | ||
| 3481 | 3486 | ||
| 3482 | mptcp_pm_new_connection(msk, ssk, 0); | 3487 | mptcp_pm_new_connection(msk, ssk, 0); |
| 3483 | |||
| 3484 | mptcp_rcv_space_init(msk, ssk); | ||
| 3485 | } | 3488 | } |
| 3486 | 3489 | ||
| 3487 | void mptcp_sock_graft(struct sock *sk, struct socket *parent) | 3490 | void mptcp_sock_graft(struct sock *sk, struct socket *parent) |
| @@ -286,7 +286,6 @@ struct mptcp_sock { · 285 unmodified lines | |||
| 286 | int rmem_released; | 286 | int rmem_released; |
| 287 | unsigned long flags; | 287 | unsigned long flags; |
| 288 | unsigned long cb_flags; | 288 | unsigned long cb_flags; |
| 289 | unsigned long push_pending; | ||
| 290 | bool recovery; /* closing subflow write queue reinjected */ | 289 | bool recovery; /* closing subflow write queue reinjected */ |
| 291 | bool can_ack; | 290 | bool can_ack; |
| 292 | bool fully_established; | 291 | bool fully_established; |
| @@ -305,7 +304,8 @@ struct mptcp_sock { · 12 unmodified lines | |||
| 305 | nodelay:1, | 304 | nodelay:1, |
| 306 | fastopening:1, | 305 | fastopening:1, |
| 307 | in_accept_queue:1, | 306 | in_accept_queue:1, |
| 308 | free_first:1; | 307 | free_first:1, |
| 308 | rcvspace_init:1; | ||
| 309 | struct work_struct work; | 309 | struct work_struct work; |
| 310 | struct sk_buff *ooo_last_skb; | 310 | struct sk_buff *ooo_last_skb; |
| 311 | struct rb_root out_of_order_queue; | 311 | struct rb_root out_of_order_queue; |
| @@ -622,8 +622,9 @@ unsigned int mptcp_stale_loss_cnt(const struct net *net); · 310 unmodified lines | |||
| 622 | unsigned int mptcp_close_timeout(const struct sock *sk); | 622 | unsigned int mptcp_close_timeout(const struct sock *sk); |
| 623 | int mptcp_get_pm_type(const struct net *net); | 623 | int mptcp_get_pm_type(const struct net *net); |
| 624 | const char *mptcp_get_scheduler(const struct net *net); | 624 | const char *mptcp_get_scheduler(const struct net *net); |
| 625 | void mptcp_subflow_fully_established(struct mptcp_subflow_context *subflow, | 625 | void __mptcp_subflow_fully_established(struct mptcp_sock *msk, |
| 626 | const struct mptcp_options_received *mp_opt); | 626 | struct mptcp_subflow_context *subflow, |
| 627 | const struct mptcp_options_received *mp_opt); | ||
| 627 | bool __mptcp_retransmit_pending_data(struct sock *sk); | 628 | bool __mptcp_retransmit_pending_data(struct sock *sk); |
| 628 | void mptcp_check_and_set_pending(struct sock *sk); | 629 | void mptcp_check_and_set_pending(struct sock *sk); |
| 629 | void __mptcp_push_pending(struct sock *sk, unsigned int flags); | 630 | void __mptcp_push_pending(struct sock *sk, unsigned int flags); |
| @@ -952,8 +953,8 @@ void mptcp_event_pm_listener(const struct sock *ssk, · 322 unmodified lines | |||
| 952 | enum mptcp_event_type event); | 953 | enum mptcp_event_type event); |
| 953 | bool mptcp_userspace_pm_active(const struct mptcp_sock *msk); | 954 | bool mptcp_userspace_pm_active(const struct mptcp_sock *msk); |
| 954 | 955 | ||
| 955 | void mptcp_fastopen_gen_msk_ackseq(struct mptcp_sock *msk, struct mptcp_subflow_context *subflow, | 956 | void __mptcp_fastopen_gen_msk_ackseq(struct mptcp_sock *msk, struct mptcp_subflow_context *subflow, |
| 956 | const struct mptcp_options_received *mp_opt); | 957 | const struct mptcp_options_received *mp_opt); |
| 957 | void mptcp_fastopen_subflow_synack_set_params(struct mptcp_subflow_context *subflow, | 958 | void mptcp_fastopen_subflow_synack_set_params(struct mptcp_subflow_context *subflow, |
| 958 | struct request_sock *req); | 959 | struct request_sock *req); |
| 959 | 960 | ||
| @@ -1128,7 +1129,8 @@ static inline bool subflow_simultaneous_connect(struct sock *sk) · 168 unmodified lines | |||
| 1128 | { | 1129 | { |
| 1129 | struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); | 1130 | struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); |
| 1130 | 1131 | ||
| 1131 | return (1 << sk->sk_state) & (TCPF_ESTABLISHED | TCPF_FIN_WAIT1) && | 1132 | return (1 << sk->sk_state) & |
| 1133 | (TCPF_ESTABLISHED | TCPF_FIN_WAIT1 | TCPF_FIN_WAIT2 | TCPF_CLOSING) && | ||
| 1132 | is_active_ssk(subflow) && | 1134 | is_active_ssk(subflow) && |
| 1133 | !subflow->conn_finished; | 1135 | !subflow->conn_finished; |
| 1134 | } | 1136 | } |
| @@ -421,29 +421,26 @@ static bool subflow_use_different_dport(struct mptcp_sock *msk, const struct soc · 420 unmodified lines | |||
| 421 | 421 | ||
| 422 | void __mptcp_sync_state(struct sock *sk, int state) | 422 | void __mptcp_sync_state(struct sock *sk, int state) |
| 423 | { | 423 | { |
| 424 | struct mptcp_subflow_context *subflow; | ||
| 424 | struct mptcp_sock *msk = mptcp_sk(sk); | 425 | struct mptcp_sock *msk = mptcp_sk(sk); |
| 426 | struct sock *ssk = msk->first; | ||
| 427 | |||
| 428 | subflow = mptcp_subflow_ctx(ssk); | ||
| 429 | __mptcp_propagate_sndbuf(sk, ssk); | ||
| 430 | if (!msk->rcvspace_init) | ||
| 431 | mptcp_rcv_space_init(msk, ssk); | ||
| 425 | 432 | ||
| 426 | __mptcp_propagate_sndbuf(sk, msk->first); | ||
| 427 | if (sk->sk_state == TCP_SYN_SENT) { | 433 | if (sk->sk_state == TCP_SYN_SENT) { |
| 434 | /* subflow->idsn is always available is TCP_SYN_SENT state, | ||
| 435 | * even for the FASTOPEN scenarios | ||
| 436 | */ | ||
| 437 | WRITE_ONCE(msk->write_seq, subflow->idsn + 1); | ||
| 438 | WRITE_ONCE(msk->snd_nxt, msk->write_seq); | ||
| 428 | mptcp_set_state(sk, state); | 439 | mptcp_set_state(sk, state); |
| 429 | sk->sk_state_change(sk); | 440 | sk->sk_state_change(sk); |
| 430 | } | 441 | } |
| 431 | } | 442 | } |
| 432 | 443 | ||
| 433 | static void mptcp_propagate_state(struct sock *sk, struct sock *ssk) | ||
| 434 | { | ||
| 435 | struct mptcp_sock *msk = mptcp_sk(sk); | ||
| 436 | |||
| 437 | mptcp_data_lock(sk); | ||
| 438 | if (!sock_owned_by_user(sk)) { | ||
| 439 | __mptcp_sync_state(sk, ssk->sk_state); | ||
| 440 | } else { | ||
| 441 | msk->pending_state = ssk->sk_state; | ||
| 442 | __set_bit(MPTCP_SYNC_STATE, &msk->cb_flags); | ||
| 443 | } | ||
| 444 | mptcp_data_unlock(sk); | ||
| 445 | } | ||
| 446 | |||
| 447 | static void subflow_set_remote_key(struct mptcp_sock *msk, | 444 | static void subflow_set_remote_key(struct mptcp_sock *msk, |
| 448 | struct mptcp_subflow_context *subflow, | 445 | struct mptcp_subflow_context *subflow, |
| 449 | const struct mptcp_options_received *mp_opt) | 446 | const struct mptcp_options_received *mp_opt) |
| @@ -465,6 +462,31 @@ static void subflow_set_remote_key(struct mptcp_sock *msk, · 15 unmodified lines | |||
| 465 | atomic64_set(&msk->rcv_wnd_sent, subflow->iasn); | 462 | atomic64_set(&msk->rcv_wnd_sent, subflow->iasn); |
| 466 | } | 463 | } |
| 467 | 464 | ||
| 465 | static void mptcp_propagate_state(struct sock *sk, struct sock *ssk, | ||
| 466 | struct mptcp_subflow_context *subflow, | ||
| 467 | const struct mptcp_options_received *mp_opt) | ||
| 468 | { | ||
| 469 | struct mptcp_sock *msk = mptcp_sk(sk); | ||
| 470 | |||
| 471 | mptcp_data_lock(sk); | ||
| 472 | if (mp_opt) { | ||
| 473 | /* Options are available only in the non fallback cases | ||
| 474 | * avoid updating rx path fields otherwise | ||
| 475 | */ | ||
| 476 | WRITE_ONCE(msk->snd_una, subflow->idsn + 1); | ||
| 477 | WRITE_ONCE(msk->wnd_end, subflow->idsn + 1 + tcp_sk(ssk)->snd_wnd); | ||
| 478 | subflow_set_remote_key(msk, subflow, mp_opt); | ||
| 479 | } | ||
| 480 | |||
| 481 | if (!sock_owned_by_user(sk)) { | ||
| 482 | __mptcp_sync_state(sk, ssk->sk_state); | ||
| 483 | } else { | ||
| 484 | msk->pending_state = ssk->sk_state; | ||
| 485 | __set_bit(MPTCP_SYNC_STATE, &msk->cb_flags); | ||
| 486 | } | ||
| 487 | mptcp_data_unlock(sk); | ||
| 488 | } | ||
| 489 | |||
| 468 | static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) | 490 | static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) |
| 469 | { | 491 | { |
| 470 | struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); | 492 | struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); |
| @@ -499,10 +521,9 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) · 28 unmodified lines | |||
| 499 | if (mp_opt.deny_join_id0) | 521 | if (mp_opt.deny_join_id0) |
| 500 | WRITE_ONCE(msk->pm.remote_deny_join_id0, true); | 522 | WRITE_ONCE(msk->pm.remote_deny_join_id0, true); |
| 501 | subflow->mp_capable = 1; | 523 | subflow->mp_capable = 1; |
| 502 | subflow_set_remote_key(msk, subflow, &mp_opt); | ||
| 503 | MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPCAPABLEACTIVEACK); | 524 | MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPCAPABLEACTIVEACK); |
| 504 | mptcp_finish_connect(sk); | 525 | mptcp_finish_connect(sk); |
| 505 | mptcp_propagate_state(parent, sk); | 526 | mptcp_propagate_state(parent, sk, subflow, &mp_opt); |
| 506 | } else if (subflow->request_join) { | 527 | } else if (subflow->request_join) { |
| 507 | u8 hmac[SHA256_DIGEST_SIZE]; | 528 | u8 hmac[SHA256_DIGEST_SIZE]; |
| 508 | 529 | ||
| @@ -545,8 +566,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) · 36 unmodified lines | |||
| 545 | } | 566 | } |
| 546 | } else if (mptcp_check_fallback(sk)) { | 567 | } else if (mptcp_check_fallback(sk)) { |
| 547 | fallback: | 568 | fallback: |
| 548 | mptcp_rcv_space_init(msk, sk); | 569 | mptcp_propagate_state(parent, sk, subflow, NULL); |
| 549 | mptcp_propagate_state(parent, sk); | ||
| 550 | } | 570 | } |
| 551 | return; | 571 | return; |
| 552 | 572 | ||
| @@ -731,17 +751,16 @@ void mptcp_subflow_drop_ctx(struct sock *ssk) · 178 unmodified lines | |||
| 731 | kfree_rcu(ctx, rcu); | 751 | kfree_rcu(ctx, rcu); |
| 732 | } | 752 | } |
| 733 | 753 | ||
| 734 | void mptcp_subflow_fully_established(struct mptcp_subflow_context *subflow, | 754 | void __mptcp_subflow_fully_established(struct mptcp_sock *msk, |
| 735 | const struct mptcp_options_received *mp_opt) | 755 | struct mptcp_subflow_context *subflow, |
| 756 | const struct mptcp_options_received *mp_opt) | ||
| 736 | { | 757 | { |
| 737 | struct mptcp_sock *msk = mptcp_sk(subflow->conn); | ||
| 738 | |||
| 739 | subflow_set_remote_key(msk, subflow, mp_opt); | 758 | subflow_set_remote_key(msk, subflow, mp_opt); |
| 740 | subflow->fully_established = 1; | 759 | subflow->fully_established = 1; |
| 741 | WRITE_ONCE(msk->fully_established, true); | 760 | WRITE_ONCE(msk->fully_established, true); |
| 742 | 761 | ||
| 743 | if (subflow->is_mptfo) | 762 | if (subflow->is_mptfo) |
| 744 | mptcp_fastopen_gen_msk_ackseq(msk, subflow, mp_opt); | 763 | __mptcp_fastopen_gen_msk_ackseq(msk, subflow, mp_opt); |
| 745 | } | 764 | } |
| 746 | 765 | ||
| 747 | static struct sock *subflow_syn_recv_sock(const struct sock *sk, | 766 | static struct sock *subflow_syn_recv_sock(const struct sock *sk, |
| @@ -834,7 +853,6 @@ create_child: · 86 unmodified lines | |||
| 834 | * mpc option | 853 | * mpc option |
| 835 | */ | 854 | */ |
| 836 | if (mp_opt.suboptions & OPTION_MPTCP_MPC_ACK) { | 855 | if (mp_opt.suboptions & OPTION_MPTCP_MPC_ACK) { |
| 837 | mptcp_subflow_fully_established(ctx, &mp_opt); | ||
| 838 | mptcp_pm_fully_established(owner, child); | 856 | mptcp_pm_fully_established(owner, child); |
| 839 | ctx->pm_notified = 1; | 857 | ctx->pm_notified = 1; |
| 840 | } | 858 | } |
| @@ -1744,10 +1762,9 @@ static void subflow_state_change(struct sock *sk) · 903 unmodified lines | |||
| 1744 | msk = mptcp_sk(parent); | 1762 | msk = mptcp_sk(parent); |
| 1745 | if (subflow_simultaneous_connect(sk)) { | 1763 | if (subflow_simultaneous_connect(sk)) { |
| 1746 | mptcp_do_fallback(sk); | 1764 | mptcp_do_fallback(sk); |
| 1747 | mptcp_rcv_space_init(msk, sk); | ||
| 1748 | pr_fallback(msk); | 1765 | pr_fallback(msk); |
| 1749 | subflow->conn_finished = 1; | 1766 | subflow->conn_finished = 1; |
| 1750 | mptcp_propagate_state(parent, sk); | 1767 | mptcp_propagate_state(parent, sk, subflow, NULL); |
| 1751 | } | 1768 | } |
| 1752 | 1769 | ||
| 1753 | /* as recvmsg() does not acquire the subflow socket for ssk selection | 1770 | /* as recvmsg() does not acquire the subflow socket for ssk selection |
| @@ -551,8 +551,11 @@ static void nf_nat_l4proto_unique_tuple(struct nf_conntrack_tuple *tuple, · 550 unmodified lines | |||
| 551 | find_free_id: | 551 | find_free_id: |
| 552 | if (range->flags & NF_NAT_RANGE_PROTO_OFFSET) | 552 | if (range->flags & NF_NAT_RANGE_PROTO_OFFSET) |
| 553 | off = (ntohs(*keyptr) - ntohs(range->base_proto.all)); | 553 | off = (ntohs(*keyptr) - ntohs(range->base_proto.all)); |
| 554 | else | 554 | else if ((range->flags & NF_NAT_RANGE_PROTO_RANDOM_ALL) || |
| 555 | maniptype != NF_NAT_MANIP_DST) | ||
| 555 | off = get_random_u16(); | 556 | off = get_random_u16(); |
| 557 | else | ||
| 558 | off = 0; | ||
| 556 | 559 | ||
| 557 | attempts = range_size; | 560 | attempts = range_size; |
| 558 | if (attempts > NF_NAT_MAX_ATTEMPTS) | 561 | if (attempts > NF_NAT_MAX_ATTEMPTS) |
| @@ -361,6 +361,7 @@ static void nft_flow_offload_eval(const struct nft_expr *expr, · 360 unmodified lines | |||
| 361 | ct->proto.tcp.seen[1].flags |= IP_CT_TCP_FLAG_BE_LIBERAL; | 361 | ct->proto.tcp.seen[1].flags |= IP_CT_TCP_FLAG_BE_LIBERAL; |
| 362 | } | 362 | } |
| 363 | 363 | ||
| 364 | __set_bit(NF_FLOW_HW_BIDIRECTIONAL, &flow->flags); | ||
| 364 | ret = flow_offload_add(flowtable, flow); | 365 | ret = flow_offload_add(flowtable, flow); |
| 365 | if (ret < 0) | 366 | if (ret < 0) |
| 366 | goto err_flow_add; | 367 | goto err_flow_add; |
| @@ -144,10 +144,10 @@ struct nft_pipapo_scratch { · 143 unmodified lines | |||
| 144 | 144 | ||
| 145 | /** | 145 | /** |
| 146 | * struct nft_pipapo_match - Data used for lookup and matching | 146 | * struct nft_pipapo_match - Data used for lookup and matching |
| 147 | * @field_count Amount of fields in set | 147 | * @field_count: Amount of fields in set |
| 148 | * @scratch: Preallocated per-CPU maps for partial matching results | 148 | * @scratch: Preallocated per-CPU maps for partial matching results |
| 149 | * @bsize_max: Maximum lookup table bucket size of all fields, in longs | 149 | * @bsize_max: Maximum lookup table bucket size of all fields, in longs |
| 150 | * @rcu Matching data is swapped on commits | 150 | * @rcu: Matching data is swapped on commits |
| 151 | * @f: Fields, with lookup and mapping tables | 151 | * @f: Fields, with lookup and mapping tables |
| 152 | */ | 152 | */ |
| 153 | struct nft_pipapo_match { | 153 | struct nft_pipapo_match { |
| @@ -48,6 +48,7 @@ struct ovs_len_tbl { · 47 unmodified lines | |||
| 48 | 48 | ||
| 49 | #define OVS_ATTR_NESTED -1 | 49 | #define OVS_ATTR_NESTED -1 |
| 50 | #define OVS_ATTR_VARIABLE -2 | 50 | #define OVS_ATTR_VARIABLE -2 |
| 51 | #define OVS_COPY_ACTIONS_MAX_DEPTH 16 | ||
| 51 | 52 | ||
| 52 | static bool actions_may_change_flow(const struct nlattr *actions) | 53 | static bool actions_may_change_flow(const struct nlattr *actions) |
| 53 | { | 54 | { |
| @@ -2545,13 +2546,15 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr, · 2491 unmodified lines | |||
| 2545 | const struct sw_flow_key *key, | 2546 | const struct sw_flow_key *key, |
| 2546 | struct sw_flow_actions **sfa, | 2547 | struct sw_flow_actions **sfa, |
| 2547 | __be16 eth_type, __be16 vlan_tci, | 2548 | __be16 eth_type, __be16 vlan_tci, |
| 2548 | u32 mpls_label_count, bool log); | 2549 | u32 mpls_label_count, bool log, |
| 2550 | u32 depth); | ||
| 2549 | 2551 | ||
| 2550 | static int validate_and_copy_sample(struct net *net, const struct nlattr *attr, | 2552 | static int validate_and_copy_sample(struct net *net, const struct nlattr *attr, |
| 2551 | const struct sw_flow_key *key, | 2553 | const struct sw_flow_key *key, |
| 2552 | struct sw_flow_actions **sfa, | 2554 | struct sw_flow_actions **sfa, |
| 2553 | __be16 eth_type, __be16 vlan_tci, | 2555 | __be16 eth_type, __be16 vlan_tci, |
| 2554 | u32 mpls_label_count, bool log, bool last) | 2556 | u32 mpls_label_count, bool log, bool last, |
| 2557 | u32 depth) | ||
| 2555 | { | 2558 | { |
| 2556 | const struct nlattr *attrs[OVS_SAMPLE_ATTR_MAX + 1]; | 2559 | const struct nlattr *attrs[OVS_SAMPLE_ATTR_MAX + 1]; |
| 2557 | const struct nlattr *probability, *actions; | 2560 | const struct nlattr *probability, *actions; |
| @@ -2602,7 +2605,8 @@ static int validate_and_copy_sample(struct net *net, const struct nlattr *attr, · 44 unmodified lines | |||
| 2602 | return err; | 2605 | return err; |
| 2603 | 2606 | ||
| 2604 | err = __ovs_nla_copy_actions(net, actions, key, sfa, | 2607 | err = __ovs_nla_copy_actions(net, actions, key, sfa, |
| 2605 | eth_type, vlan_tci, mpls_label_count, log); | 2608 | eth_type, vlan_tci, mpls_label_count, log, |
| 2609 | depth + 1); | ||
| 2606 | 2610 | ||
| 2607 | if (err) | 2611 | if (err) |
| 2608 | return err; | 2612 | return err; |
| @@ -2617,7 +2621,8 @@ static int validate_and_copy_dec_ttl(struct net *net, · 8 unmodified lines | |||
| 2617 | const struct sw_flow_key *key, | 2621 | const struct sw_flow_key *key, |
| 2618 | struct sw_flow_actions **sfa, | 2622 | struct sw_flow_actions **sfa, |
| 2619 | __be16 eth_type, __be16 vlan_tci, | 2623 | __be16 eth_type, __be16 vlan_tci, |
| 2620 | u32 mpls_label_count, bool log) | 2624 | u32 mpls_label_count, bool log, |
| 2625 | u32 depth) | ||
| 2621 | { | 2626 | { |
| 2622 | const struct nlattr *attrs[OVS_DEC_TTL_ATTR_MAX + 1]; | 2627 | const struct nlattr *attrs[OVS_DEC_TTL_ATTR_MAX + 1]; |
| 2623 | int start, action_start, err, rem; | 2628 | int start, action_start, err, rem; |
| @@ -2660,7 +2665,8 @@ static int validate_and_copy_dec_ttl(struct net *net, · 36 unmodified lines | |||
| 2660 | return action_start; | 2665 | return action_start; |
| 2661 | 2666 | ||
| 2662 | err = __ovs_nla_copy_actions(net, actions, key, sfa, eth_type, | 2667 | err = __ovs_nla_copy_actions(net, actions, key, sfa, eth_type, |
| 2663 | vlan_tci, mpls_label_count, log); | 2668 | vlan_tci, mpls_label_count, log, |
| 2669 | depth + 1); | ||
| 2664 | if (err) | 2670 | if (err) |
| 2665 | return err; | 2671 | return err; |
| 2666 | 2672 | ||
| @@ -2674,7 +2680,8 @@ static int validate_and_copy_clone(struct net *net, · 7 unmodified lines | |||
| 2674 | const struct sw_flow_key *key, | 2680 | const struct sw_flow_key *key, |
| 2675 | struct sw_flow_actions **sfa, | 2681 | struct sw_flow_actions **sfa, |
| 2676 | __be16 eth_type, __be16 vlan_tci, | 2682 | __be16 eth_type, __be16 vlan_tci, |
| 2677 | u32 mpls_label_count, bool log, bool last) | 2683 | u32 mpls_label_count, bool log, bool last, |
| 2684 | u32 depth) | ||
| 2678 | { | 2685 | { |
| 2679 | int start, err; | 2686 | int start, err; |
| 2680 | u32 exec; | 2687 | u32 exec; |
| @@ -2694,7 +2701,8 @@ static int validate_and_copy_clone(struct net *net, · 13 unmodified lines | |||
| 2694 | return err; | 2701 | return err; |
| 2695 | 2702 | ||
| 2696 | err = __ovs_nla_copy_actions(net, attr, key, sfa, | 2703 | err = __ovs_nla_copy_actions(net, attr, key, sfa, |
| 2697 | eth_type, vlan_tci, mpls_label_count, log); | 2704 | eth_type, vlan_tci, mpls_label_count, log, |
| 2705 | depth + 1); | ||
| 2698 | if (err) | 2706 | if (err) |
| 2699 | return err; | 2707 | return err; |
| 2700 | 2708 | ||
| @@ -3063,7 +3071,7 @@ static int validate_and_copy_check_pkt_len(struct net *net, · 362 unmodified lines | |||
| 3063 | struct sw_flow_actions **sfa, | 3071 | struct sw_flow_actions **sfa, |
| 3064 | __be16 eth_type, __be16 vlan_tci, | 3072 | __be16 eth_type, __be16 vlan_tci, |
| 3065 | u32 mpls_label_count, | 3073 | u32 mpls_label_count, |
| 3066 | bool log, bool last) | 3074 | bool log, bool last, u32 depth) |
| 3067 | { | 3075 | { |
| 3068 | const struct nlattr *acts_if_greater, *acts_if_lesser_eq; | 3076 | const struct nlattr *acts_if_greater, *acts_if_lesser_eq; |
| 3069 | struct nlattr *a[OVS_CHECK_PKT_LEN_ATTR_MAX + 1]; | 3077 | struct nlattr *a[OVS_CHECK_PKT_LEN_ATTR_MAX + 1]; |
| @@ -3111,7 +3119,8 @@ static int validate_and_copy_check_pkt_len(struct net *net, · 41 unmodified lines | |||
| 3111 | return nested_acts_start; | 3119 | return nested_acts_start; |
| 3112 | 3120 | ||
| 3113 | err = __ovs_nla_copy_actions(net, acts_if_lesser_eq, key, sfa, | 3121 | err = __ovs_nla_copy_actions(net, acts_if_lesser_eq, key, sfa, |
| 3114 | eth_type, vlan_tci, mpls_label_count, log); | 3122 | eth_type, vlan_tci, mpls_label_count, log, |
| 3123 | depth + 1); | ||
| 3115 | 3124 | ||
| 3116 | if (err) | 3125 | if (err) |
| 3117 | return err; | 3126 | return err; |
| @@ -3124,7 +3133,8 @@ static int validate_and_copy_check_pkt_len(struct net *net, · 6 unmodified lines | |||
| 3124 | return nested_acts_start; | 3133 | return nested_acts_start; |
| 3125 | 3134 | ||
| 3126 | err = __ovs_nla_copy_actions(net, acts_if_greater, key, sfa, | 3135 | err = __ovs_nla_copy_actions(net, acts_if_greater, key, sfa, |
| 3127 | eth_type, vlan_tci, mpls_label_count, log); | 3136 | eth_type, vlan_tci, mpls_label_count, log, |
| 3137 | depth + 1); | ||
| 3128 | 3138 | ||
| 3129 | if (err) | 3139 | if (err) |
| 3130 | return err; | 3140 | return err; |
| @@ -3152,12 +3162,16 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr, · 21 unmodified lines | |||
| 3152 | const struct sw_flow_key *key, | 3162 | const struct sw_flow_key *key, |
| 3153 | struct sw_flow_actions **sfa, | 3163 | struct sw_flow_actions **sfa, |
| 3154 | __be16 eth_type, __be16 vlan_tci, | 3164 | __be16 eth_type, __be16 vlan_tci, |
| 3155 | u32 mpls_label_count, bool log) | 3165 | u32 mpls_label_count, bool log, |
| 3166 | u32 depth) | ||
| 3156 | { | 3167 | { |
| 3157 | u8 mac_proto = ovs_key_mac_proto(key); | 3168 | u8 mac_proto = ovs_key_mac_proto(key); |
| 3158 | const struct nlattr *a; | 3169 | const struct nlattr *a; |
| 3159 | int rem, err; | 3170 | int rem, err; |
| 3160 | 3171 | ||
| 3172 | if (depth > OVS_COPY_ACTIONS_MAX_DEPTH) | ||
| 3173 | return -EOVERFLOW; | ||
| 3174 | |||
| 3161 | nla_for_each_nested(a, attr, rem) { | 3175 | nla_for_each_nested(a, attr, rem) { |
| 3162 | /* Expected argument lengths, (u32)-1 for variable length. */ | 3176 | /* Expected argument lengths, (u32)-1 for variable length. */ |
| 3163 | static const u32 action_lens[OVS_ACTION_ATTR_MAX + 1] = { | 3177 | static const u32 action_lens[OVS_ACTION_ATTR_MAX + 1] = { |
| @@ -3355,7 +3369,7 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr, · 191 unmodified lines | |||
| 3355 | err = validate_and_copy_sample(net, a, key, sfa, | 3369 | err = validate_and_copy_sample(net, a, key, sfa, |
| 3356 | eth_type, vlan_tci, | 3370 | eth_type, vlan_tci, |
| 3357 | mpls_label_count, | 3371 | mpls_label_count, |
| 3358 | log, last); | 3372 | log, last, depth); |
| 3359 | if (err) | 3373 | if (err) |
| 3360 | return err; | 3374 | return err; |
| 3361 | skip_copy = true; | 3375 | skip_copy = true; |
| @@ -3426,7 +3440,7 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr, · 64 unmodified lines | |||
| 3426 | err = validate_and_copy_clone(net, a, key, sfa, | 3440 | err = validate_and_copy_clone(net, a, key, sfa, |
| 3427 | eth_type, vlan_tci, | 3441 | eth_type, vlan_tci, |
| 3428 | mpls_label_count, | 3442 | mpls_label_count, |
| 3429 | log, last); | 3443 | log, last, depth); |
| 3430 | if (err) | 3444 | if (err) |
| 3431 | return err; | 3445 | return err; |
| 3432 | skip_copy = true; | 3446 | skip_copy = true; |
| @@ -3440,7 +3454,8 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr, · 7 unmodified lines | |||
| 3440 | eth_type, | 3454 | eth_type, |
| 3441 | vlan_tci, | 3455 | vlan_tci, |
| 3442 | mpls_label_count, | 3456 | mpls_label_count, |
| 3443 | log, last); | 3457 | log, last, |
| 3458 | depth); | ||
| 3444 | if (err) | 3459 | if (err) |
| 3445 | return err; | 3460 | return err; |
| 3446 | skip_copy = true; | 3461 | skip_copy = true; |
| @@ -3450,7 +3465,8 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr, · 3 unmodified lines | |||
| 3450 | case OVS_ACTION_ATTR_DEC_TTL: | 3465 | case OVS_ACTION_ATTR_DEC_TTL: |
| 3451 | err = validate_and_copy_dec_ttl(net, a, key, sfa, | 3466 | err = validate_and_copy_dec_ttl(net, a, key, sfa, |
| 3452 | eth_type, vlan_tci, | 3467 | eth_type, vlan_tci, |
| 3453 | mpls_label_count, log); | 3468 | mpls_label_count, log, |
| 3469 | depth); | ||
| 3454 | if (err) | 3470 | if (err) |
| 3455 | return err; | 3471 | return err; |
| 3456 | skip_copy = true; | 3472 | skip_copy = true; |
| @@ -3495,7 +3511,8 @@ int ovs_nla_copy_actions(struct net *net, const struct nlattr *attr, · 38 unmodified lines | |||
| 3495 | 3511 | ||
| 3496 | (*sfa)->orig_len = nla_len(attr); | 3512 | (*sfa)->orig_len = nla_len(attr); |
| 3497 | err = __ovs_nla_copy_actions(net, attr, key, sfa, key->eth.type, | 3513 | err = __ovs_nla_copy_actions(net, attr, key, sfa, key->eth.type, |
| 3498 | key->eth.vlan.tci, mpls_label_count, log); | 3514 | key->eth.vlan.tci, mpls_label_count, log, |
| 3515 | 0); | ||
| 3499 | if (err) | 3516 | if (err) |
| 3500 | ovs_nla_free_flow_actions(*sfa); | 3517 | ovs_nla_free_flow_actions(*sfa); |
| 3501 | 3518 | ||
| @@ -425,6 +425,7 @@ static int rds_still_queued(struct rds_sock *rs, struct rds_incoming *inc, · 424 unmodified lines | |||
| 425 | struct sock *sk = rds_rs_to_sk(rs); | 425 | struct sock *sk = rds_rs_to_sk(rs); |
| 426 | int ret = 0; | 426 | int ret = 0; |
| 427 | unsigned long flags; | 427 | unsigned long flags; |
| 428 | struct rds_incoming *to_drop = NULL; | ||
| 428 | 429 | ||
| 429 | write_lock_irqsave(&rs->rs_recv_lock, flags); | 430 | write_lock_irqsave(&rs->rs_recv_lock, flags); |
| 430 | if (!list_empty(&inc->i_item)) { | 431 | if (!list_empty(&inc->i_item)) { |
| @@ -435,11 +436,14 @@ static int rds_still_queued(struct rds_sock *rs, struct rds_incoming *inc, · 4 unmodified lines | |||
| 435 | -be32_to_cpu(inc->i_hdr.h_len), | 436 | -be32_to_cpu(inc->i_hdr.h_len), |
| 436 | inc->i_hdr.h_dport); | 437 | inc->i_hdr.h_dport); |
| 437 | list_del_init(&inc->i_item); | 438 | list_del_init(&inc->i_item); |
| 438 | rds_inc_put(inc); | 439 | to_drop = inc; |
| 439 | } | 440 | } |
| 440 | } | 441 | } |
| 441 | write_unlock_irqrestore(&rs->rs_recv_lock, flags); | 442 | write_unlock_irqrestore(&rs->rs_recv_lock, flags); |
| 442 | 443 | ||
| 444 | if (to_drop) | ||
| 445 | rds_inc_put(to_drop); | ||
| 446 | |||
| 443 | rdsdebug("inc %p rs %p still %d dropped %d\n", inc, rs, ret, drop); | 447 | rdsdebug("inc %p rs %p still %d dropped %d\n", inc, rs, ret, drop); |
| 444 | return ret; | 448 | return ret; |
| 445 | } | 449 | } |
| @@ -758,16 +762,21 @@ void rds_clear_recv_queue(struct rds_sock *rs) · 312 unmodified lines | |||
| 758 | struct sock *sk = rds_rs_to_sk(rs); | 762 | struct sock *sk = rds_rs_to_sk(rs); |
| 759 | struct rds_incoming *inc, *tmp; | 763 | struct rds_incoming *inc, *tmp; |
| 760 | unsigned long flags; | 764 | unsigned long flags; |
| 765 | LIST_HEAD(to_drop); | ||
| 761 | 766 | ||
| 762 | write_lock_irqsave(&rs->rs_recv_lock, flags); | 767 | write_lock_irqsave(&rs->rs_recv_lock, flags); |
| 763 | list_for_each_entry_safe(inc, tmp, &rs->rs_recv_queue, i_item) { | 768 | list_for_each_entry_safe(inc, tmp, &rs->rs_recv_queue, i_item) { |
| 764 | rds_recv_rcvbuf_delta(rs, sk, inc->i_conn->c_lcong, | 769 | rds_recv_rcvbuf_delta(rs, sk, inc->i_conn->c_lcong, |
| 765 | -be32_to_cpu(inc->i_hdr.h_len), | 770 | -be32_to_cpu(inc->i_hdr.h_len), |
| 766 | inc->i_hdr.h_dport); | 771 | inc->i_hdr.h_dport); |
| 772 | list_move(&inc->i_item, &to_drop); | ||
| 773 | } | ||
| 774 | write_unlock_irqrestore(&rs->rs_recv_lock, flags); | ||
| 775 | |||
| 776 | list_for_each_entry_safe(inc, tmp, &to_drop, i_item) { | ||
| 767 | list_del_init(&inc->i_item); | 777 | list_del_init(&inc->i_item); |
| 768 | rds_inc_put(inc); | 778 | rds_inc_put(inc); |
| 769 | } | 779 | } |
| 770 | write_unlock_irqrestore(&rs->rs_recv_lock, flags); | ||
| 771 | } | 780 | } |
| 772 | 781 | ||
| 773 | /* | 782 | /* |
| @@ -533,8 +533,6 @@ static int mirred_device_event(struct notifier_block *unused, · 532 unmodified lines | |||
| 533 | * net_device are already rcu protected. | 533 | * net_device are already rcu protected. |
| 534 | */ | 534 | */ |
| 535 | RCU_INIT_POINTER(m->tcfm_dev, NULL); | 535 | RCU_INIT_POINTER(m->tcfm_dev, NULL); |
| 536 | } else if (m->tcfm_blockid) { | ||
| 537 | m->tcfm_blockid = 0; | ||
| 538 | } | 536 | } |
| 539 | spin_unlock_bh(&m->tcf_lock); | 537 | spin_unlock_bh(&m->tcf_lock); |
| 540 | } | 538 | } |
| @@ -222,6 +222,7 @@ static void __exit exit_em_canid(void) · 221 unmodified lines | |||
| 222 | tcf_em_unregister(&em_canid_ops); | 222 | tcf_em_unregister(&em_canid_ops); |
| 223 | } | 223 | } |
| 224 | 224 | ||
| 225 | MODULE_DESCRIPTION("ematch classifier to match CAN IDs embedded in skb CAN frames"); | ||
| 225 | MODULE_LICENSE("GPL"); | 226 | MODULE_LICENSE("GPL"); |
| 226 | 227 | ||
| 227 | module_init(init_em_canid); | 228 | module_init(init_em_canid); |
| @@ -87,6 +87,7 @@ static void __exit exit_em_cmp(void) · 86 unmodified lines | |||
| 87 | tcf_em_unregister(&em_cmp_ops); | 87 | tcf_em_unregister(&em_cmp_ops); |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | MODULE_DESCRIPTION("ematch classifier for basic data types(8/16/32 bit) against skb data"); | ||
| 90 | MODULE_LICENSE("GPL"); | 91 | MODULE_LICENSE("GPL"); |
| 91 | 92 | ||
| 92 | module_init(init_em_cmp); | 93 | module_init(init_em_cmp); |
| @@ -1006,6 +1006,7 @@ static void __exit exit_em_meta(void) · 1005 unmodified lines | |||
| 1006 | tcf_em_unregister(&em_meta_ops); | 1006 | tcf_em_unregister(&em_meta_ops); |
| 1007 | } | 1007 | } |
| 1008 | 1008 | ||
| 1009 | MODULE_DESCRIPTION("ematch classifier for various internal kernel metadata, skb metadata and sk metadata"); | ||
| 1009 | MODULE_LICENSE("GPL"); | 1010 | MODULE_LICENSE("GPL"); |
| 1010 | 1011 | ||
| 1011 | module_init(init_em_meta); | 1012 | module_init(init_em_meta); |
| @@ -68,6 +68,7 @@ static void __exit exit_em_nbyte(void) · 67 unmodified lines | |||
| 68 | tcf_em_unregister(&em_nbyte_ops); | 68 | tcf_em_unregister(&em_nbyte_ops); |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | MODULE_DESCRIPTION("ematch classifier for arbitrary skb multi-bytes"); | ||
| 71 | MODULE_LICENSE("GPL"); | 72 | MODULE_LICENSE("GPL"); |
| 72 | 73 | ||
| 73 | module_init(init_em_nbyte); | 74 | module_init(init_em_nbyte); |
| @@ -147,6 +147,7 @@ static void __exit exit_em_text(void) · 146 unmodified lines | |||
| 147 | tcf_em_unregister(&em_text_ops); | 147 | tcf_em_unregister(&em_text_ops); |
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | MODULE_DESCRIPTION("ematch classifier for embedded text in skbs"); | ||
| 150 | MODULE_LICENSE("GPL"); | 151 | MODULE_LICENSE("GPL"); |
| 151 | 152 | ||
| 152 | module_init(init_em_text); | 153 | module_init(init_em_text); |
| @@ -52,6 +52,7 @@ static void __exit exit_em_u32(void) · 51 unmodified lines | |||
| 52 | tcf_em_unregister(&em_u32_ops); | 52 | tcf_em_unregister(&em_u32_ops); |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | MODULE_DESCRIPTION("ematch skb classifier using 32 bit chunks of data"); | ||
| 55 | MODULE_LICENSE("GPL"); | 56 | MODULE_LICENSE("GPL"); |
| 56 | 57 | ||
| 57 | module_init(init_em_u32); | 58 | module_init(init_em_u32); |
| @@ -38,6 +38,14 @@ void sctp_inq_init(struct sctp_inq *queue) · 37 unmodified lines | |||
| 38 | INIT_WORK(&queue->immediate, NULL); | 38 | INIT_WORK(&queue->immediate, NULL); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | /* Properly release the chunk which is being worked on. */ | ||
| 42 | static inline void sctp_inq_chunk_free(struct sctp_chunk *chunk) | ||
| 43 | { | ||
| 44 | if (chunk->head_skb) | ||
| 45 | chunk->skb = chunk->head_skb; | ||
| 46 | sctp_chunk_free(chunk); | ||
| 47 | } | ||
| 48 | |||
| 41 | /* Release the memory associated with an SCTP inqueue. */ | 49 | /* Release the memory associated with an SCTP inqueue. */ |
| 42 | void sctp_inq_free(struct sctp_inq *queue) | 50 | void sctp_inq_free(struct sctp_inq *queue) |
| 43 | { | 51 | { |
| @@ -53,7 +61,7 @@ void sctp_inq_free(struct sctp_inq *queue) · 9 unmodified lines | |||
| 53 | * free it as well. | 61 | * free it as well. |
| 54 | */ | 62 | */ |
| 55 | if (queue->in_progress) { | 63 | if (queue->in_progress) { |
| 56 | sctp_chunk_free(queue->in_progress); | 64 | sctp_inq_chunk_free(queue->in_progress); |
| 57 | queue->in_progress = NULL; | 65 | queue->in_progress = NULL; |
| 58 | } | 66 | } |
| 59 | } | 67 | } |
| @@ -130,9 +138,7 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue) · 70 unmodified lines | |||
| 130 | goto new_skb; | 138 | goto new_skb; |
| 131 | } | 139 | } |
| 132 | 140 | ||
| 133 | if (chunk->head_skb) | 141 | sctp_inq_chunk_free(chunk); |
| 134 | chunk->skb = chunk->head_skb; | ||
| 135 | sctp_chunk_free(chunk); | ||
| 136 | chunk = queue->in_progress = NULL; | 142 | chunk = queue->in_progress = NULL; |
| 137 | } else { | 143 | } else { |
| 138 | /* Nothing to do. Next chunk in the packet, please. */ | 144 | /* Nothing to do. Next chunk in the packet, please. */ |
| @@ -924,6 +924,7 @@ static int smc_switch_to_fallback(struct smc_sock *smc, int reason_code) · 923 unmodified lines | |||
| 924 | smc->clcsock->file->private_data = smc->clcsock; | 924 | smc->clcsock->file->private_data = smc->clcsock; |
| 925 | smc->clcsock->wq.fasync_list = | 925 | smc->clcsock->wq.fasync_list = |
| 926 | smc->sk.sk_socket->wq.fasync_list; | 926 | smc->sk.sk_socket->wq.fasync_list; |
| 927 | smc->sk.sk_socket->wq.fasync_list = NULL; | ||
| 927 | 928 | ||
| 928 | /* There might be some wait entries remaining | 929 | /* There might be some wait entries remaining |
| 929 | * in smc sk->sk_wq and they should be woken up | 930 | * in smc sk->sk_wq and they should be woken up |
| @@ -63,6 +63,7 @@ struct tls_decrypt_ctx { · 62 unmodified lines | |||
| 63 | u8 iv[TLS_MAX_IV_SIZE]; | 63 | u8 iv[TLS_MAX_IV_SIZE]; |
| 64 | u8 aad[TLS_MAX_AAD_SIZE]; | 64 | u8 aad[TLS_MAX_AAD_SIZE]; |
| 65 | u8 tail; | 65 | u8 tail; |
| 66 | bool free_sgout; | ||
| 66 | struct scatterlist sg[]; | 67 | struct scatterlist sg[]; |
| 67 | }; | 68 | }; |
| 68 | 69 | ||
| @@ -187,7 +188,6 @@ static void tls_decrypt_done(void *data, int err) · 118 unmodified lines | |||
| 187 | struct aead_request *aead_req = data; | 188 | struct aead_request *aead_req = data; |
| 188 | struct crypto_aead *aead = crypto_aead_reqtfm(aead_req); | 189 | struct crypto_aead *aead = crypto_aead_reqtfm(aead_req); |
| 189 | struct scatterlist *sgout = aead_req->dst; | 190 | struct scatterlist *sgout = aead_req->dst; |
| 190 | struct scatterlist *sgin = aead_req->src; | ||
| 191 | struct tls_sw_context_rx *ctx; | 191 | struct tls_sw_context_rx *ctx; |
| 192 | struct tls_decrypt_ctx *dctx; | 192 | struct tls_decrypt_ctx *dctx; |
| 193 | struct tls_context *tls_ctx; | 193 | struct tls_context *tls_ctx; |
| @@ -196,6 +196,17 @@ static void tls_decrypt_done(void *data, int err) · 2 unmodified lines | |||
| 196 | struct sock *sk; | 196 | struct sock *sk; |
| 197 | int aead_size; | 197 | int aead_size; |
| 198 | 198 | ||
| 199 | /* If requests get too backlogged crypto API returns -EBUSY and calls | ||
| 200 | * ->complete(-EINPROGRESS) immediately followed by ->complete(0) | ||
| 201 | * to make waiting for backlog to flush with crypto_wait_req() easier. | ||
| 202 | * First wait converts -EBUSY -> -EINPROGRESS, and the second one | ||
| 203 | * -EINPROGRESS -> 0. | ||
| 204 | * We have a single struct crypto_async_request per direction, this | ||
| 205 | * scheme doesn't help us, so just ignore the first ->complete(). | ||
| 206 | */ | ||
| 207 | if (err == -EINPROGRESS) | ||
| 208 | return; | ||
| 209 | |||
| 199 | aead_size = sizeof(*aead_req) + crypto_aead_reqsize(aead); | 210 | aead_size = sizeof(*aead_req) + crypto_aead_reqsize(aead); |
| 200 | aead_size = ALIGN(aead_size, __alignof__(*dctx)); | 211 | aead_size = ALIGN(aead_size, __alignof__(*dctx)); |
| 201 | dctx = (void *)((u8 *)aead_req + aead_size); | 212 | dctx = (void *)((u8 *)aead_req + aead_size); |
| @@ -213,7 +224,7 @@ static void tls_decrypt_done(void *data, int err) · 11 unmodified lines | |||
| 213 | } | 224 | } |
| 214 | 225 | ||
| 215 | /* Free the destination pages if skb was not decrypted inplace */ | 226 | /* Free the destination pages if skb was not decrypted inplace */ |
| 216 | if (sgout != sgin) { | 227 | if (dctx->free_sgout) { |
| 217 | /* Skip the first S/G entry as it points to AAD */ | 228 | /* Skip the first S/G entry as it points to AAD */ |
| 218 | for_each_sg(sg_next(sgout), sg, UINT_MAX, pages) { | 229 | for_each_sg(sg_next(sgout), sg, UINT_MAX, pages) { |
| 219 | if (!sg) | 230 | if (!sg) |
| @@ -224,10 +235,17 @@ static void tls_decrypt_done(void *data, int err) · 4 unmodified lines | |||
| 224 | 235 | ||
| 225 | kfree(aead_req); | 236 | kfree(aead_req); |
| 226 | 237 | ||
| 227 | spin_lock_bh(&ctx->decrypt_compl_lock); | 238 | if (atomic_dec_and_test(&ctx->decrypt_pending)) |
| 228 | if (!atomic_dec_return(&ctx->decrypt_pending)) | ||
| 229 | complete(&ctx->async_wait.completion); | 239 | complete(&ctx->async_wait.completion); |
| 230 | spin_unlock_bh(&ctx->decrypt_compl_lock); | 240 | } |
| 241 | |||
| 242 | static int tls_decrypt_async_wait(struct tls_sw_context_rx *ctx) | ||
| 243 | { | ||
| 244 | if (!atomic_dec_and_test(&ctx->decrypt_pending)) | ||
| 245 | crypto_wait_req(-EINPROGRESS, &ctx->async_wait); | ||
| 246 | atomic_inc(&ctx->decrypt_pending); | ||
| 247 | |||
| 248 | return ctx->async_wait.err; | ||
| 231 | } | 249 | } |
| 232 | 250 | ||
| 233 | static int tls_do_decryption(struct sock *sk, | 251 | static int tls_do_decryption(struct sock *sk, |
| @@ -253,6 +271,7 @@ static int tls_do_decryption(struct sock *sk, · 19 unmodified lines | |||
| 253 | aead_request_set_callback(aead_req, | 271 | aead_request_set_callback(aead_req, |
| 254 | CRYPTO_TFM_REQ_MAY_BACKLOG, | 272 | CRYPTO_TFM_REQ_MAY_BACKLOG, |
| 255 | tls_decrypt_done, aead_req); | 273 | tls_decrypt_done, aead_req); |
| 274 | DEBUG_NET_WARN_ON_ONCE(atomic_read(&ctx->decrypt_pending) < 1); | ||
| 256 | atomic_inc(&ctx->decrypt_pending); | 275 | atomic_inc(&ctx->decrypt_pending); |
| 257 | } else { | 276 | } else { |
| 258 | aead_request_set_callback(aead_req, | 277 | aead_request_set_callback(aead_req, |
| @@ -261,6 +280,10 @@ static int tls_do_decryption(struct sock *sk, · 2 unmodified lines | |||
| 261 | } | 280 | } |
| 262 | 281 | ||
| 263 | ret = crypto_aead_decrypt(aead_req); | 282 | ret = crypto_aead_decrypt(aead_req); |
| 283 | if (ret == -EBUSY) { | ||
| 284 | ret = tls_decrypt_async_wait(ctx); | ||
| 285 | ret = ret ?: -EINPROGRESS; | ||
| 286 | } | ||
| 264 | if (ret == -EINPROGRESS) { | 287 | if (ret == -EINPROGRESS) { |
| 265 | if (darg->async) | 288 | if (darg->async) |
| 266 | return 0; | 289 | return 0; |
| @@ -439,9 +462,10 @@ static void tls_encrypt_done(void *data, int err) · 172 unmodified lines | |||
| 439 | struct tls_rec *rec = data; | 462 | struct tls_rec *rec = data; |
| 440 | struct scatterlist *sge; | 463 | struct scatterlist *sge; |
| 441 | struct sk_msg *msg_en; | 464 | struct sk_msg *msg_en; |
| 442 | bool ready = false; | ||
| 443 | struct sock *sk; | 465 | struct sock *sk; |
| 444 | int pending; | 466 | |
| 467 | if (err == -EINPROGRESS) /* see the comment in tls_decrypt_done() */ | ||
| 468 | return; | ||
| 445 | 469 | ||
| 446 | msg_en = &rec->msg_encrypted; | 470 | msg_en = &rec->msg_encrypted; |
| 447 | 471 | ||
| @@ -476,23 +500,25 @@ static void tls_encrypt_done(void *data, int err) · 28 unmodified lines | |||
| 476 | /* If received record is at head of tx_list, schedule tx */ | 500 | /* If received record is at head of tx_list, schedule tx */ |
| 477 | first_rec = list_first_entry(&ctx->tx_list, | 501 | first_rec = list_first_entry(&ctx->tx_list, |
| 478 | struct tls_rec, list); | 502 | struct tls_rec, list); |
| 479 | if (rec == first_rec) | 503 | if (rec == first_rec) { |
| 480 | ready = true; | 504 | /* Schedule the transmission */ |
| 505 | if (!test_and_set_bit(BIT_TX_SCHEDULED, | ||
| 506 | &ctx->tx_bitmask)) | ||
| 507 | schedule_delayed_work(&ctx->tx_work.work, 1); | ||
| 508 | } | ||
| 481 | } | 509 | } |
| 482 | 510 | ||
| 483 | spin_lock_bh(&ctx->encrypt_compl_lock); | 511 | if (atomic_dec_and_test(&ctx->encrypt_pending)) |
| 484 | pending = atomic_dec_return(&ctx->encrypt_pending); | ||
| 485 | |||
| 486 | if (!pending && ctx->async_notify) | ||
| 487 | complete(&ctx->async_wait.completion); | 512 | complete(&ctx->async_wait.completion); |
| 488 | spin_unlock_bh(&ctx->encrypt_compl_lock); | 513 | } |
| 489 | 514 | ||
| 490 | if (!ready) | 515 | static int tls_encrypt_async_wait(struct tls_sw_context_tx *ctx) |
| 491 | return; | 516 | { |
| 517 | if (!atomic_dec_and_test(&ctx->encrypt_pending)) | ||
| 518 | crypto_wait_req(-EINPROGRESS, &ctx->async_wait); | ||
| 519 | atomic_inc(&ctx->encrypt_pending); | ||
| 492 | 520 | ||
| 493 | /* Schedule the transmission */ | 521 | return ctx->async_wait.err; |
| 494 | if (!test_and_set_bit(BIT_TX_SCHEDULED, &ctx->tx_bitmask)) | ||
| 495 | schedule_delayed_work(&ctx->tx_work.work, 1); | ||
| 496 | } | 522 | } |
| 497 | 523 | ||
| 498 | static int tls_do_encryption(struct sock *sk, | 524 | static int tls_do_encryption(struct sock *sk, |
| @@ -541,9 +567,14 @@ static int tls_do_encryption(struct sock *sk, · 42 unmodified lines | |||
| 541 | 567 | ||
| 542 | /* Add the record in tx_list */ | 568 | /* Add the record in tx_list */ |
| 543 | list_add_tail((struct list_head *)&rec->list, &ctx->tx_list); | 569 | list_add_tail((struct list_head *)&rec->list, &ctx->tx_list); |
| 570 | DEBUG_NET_WARN_ON_ONCE(atomic_read(&ctx->encrypt_pending) < 1); | ||
| 544 | atomic_inc(&ctx->encrypt_pending); | 571 | atomic_inc(&ctx->encrypt_pending); |
| 545 | 572 | ||
| 546 | rc = crypto_aead_encrypt(aead_req); | 573 | rc = crypto_aead_encrypt(aead_req); |
| 574 | if (rc == -EBUSY) { | ||
| 575 | rc = tls_encrypt_async_wait(ctx); | ||
| 576 | rc = rc ?: -EINPROGRESS; | ||
| 577 | } | ||
| 547 | if (!rc || rc != -EINPROGRESS) { | 578 | if (!rc || rc != -EINPROGRESS) { |
| 548 | atomic_dec(&ctx->encrypt_pending); | 579 | atomic_dec(&ctx->encrypt_pending); |
| 549 | sge->offset -= prot->prepend_size; | 580 | sge->offset -= prot->prepend_size; |
| @@ -984,7 +1015,6 @@ static int tls_sw_sendmsg_locked(struct sock *sk, struct msghdr *msg, · 434 unmodified lines | |||
| 984 | int num_zc = 0; | 1015 | int num_zc = 0; |
| 985 | int orig_size; | 1016 | int orig_size; |
| 986 | int ret = 0; | 1017 | int ret = 0; |
| 987 | int pending; | ||
| 988 | 1018 | ||
| 989 | if (!eor && (msg->msg_flags & MSG_EOR)) | 1019 | if (!eor && (msg->msg_flags & MSG_EOR)) |
| 990 | return -EINVAL; | 1020 | return -EINVAL; |
| @@ -1163,24 +1193,12 @@ trim_sgl: · 172 unmodified lines | |||
| 1163 | if (!num_async) { | 1193 | if (!num_async) { |
| 1164 | goto send_end; | 1194 | goto send_end; |
| 1165 | } else if (num_zc) { | 1195 | } else if (num_zc) { |
| 1166 | /* Wait for pending encryptions to get completed */ | 1196 | int err; |
| 1167 | spin_lock_bh(&ctx->encrypt_compl_lock); | ||
| 1168 | ctx->async_notify = true; | ||
| 1169 | |||
| 1170 | pending = atomic_read(&ctx->encrypt_pending); | ||
| 1171 | spin_unlock_bh(&ctx->encrypt_compl_lock); | ||
| 1172 | if (pending) | ||
| 1173 | crypto_wait_req(-EINPROGRESS, &ctx->async_wait); | ||
| 1174 | else | ||
| 1175 | reinit_completion(&ctx->async_wait.completion); | ||
| 1176 | |||
| 1177 | /* There can be no concurrent accesses, since we have no | ||
| 1178 | * pending encrypt operations | ||
| 1179 | */ | ||
| 1180 | WRITE_ONCE(ctx->async_notify, false); | ||
| 1181 | 1197 | ||
| 1182 | if (ctx->async_wait.err) { | 1198 | /* Wait for pending encryptions to get completed */ |
| 1183 | ret = ctx->async_wait.err; | 1199 | err = tls_encrypt_async_wait(ctx); |
| 1200 | if (err) { | ||
| 1201 | ret = err; | ||
| 1184 | copied = 0; | 1202 | copied = 0; |
| 1185 | } | 1203 | } |
| 1186 | } | 1204 | } |
| @@ -1229,7 +1247,6 @@ void tls_sw_splice_eof(struct socket *sock) · 42 unmodified lines | |||
| 1229 | ssize_t copied = 0; | 1247 | ssize_t copied = 0; |
| 1230 | bool retrying = false; | 1248 | bool retrying = false; |
| 1231 | int ret = 0; | 1249 | int ret = 0; |
| 1232 | int pending; | ||
| 1233 | 1250 | ||
| 1234 | if (!ctx->open_rec) | 1251 | if (!ctx->open_rec) |
| 1235 | return; | 1252 | return; |
| @@ -1264,22 +1281,7 @@ retry: · 28 unmodified lines | |||
| 1264 | } | 1281 | } |
| 1265 | 1282 | ||
| 1266 | /* Wait for pending encryptions to get completed */ | 1283 | /* Wait for pending encryptions to get completed */ |
| 1267 | spin_lock_bh(&ctx->encrypt_compl_lock); | 1284 | if (tls_encrypt_async_wait(ctx)) |
| 1268 | ctx->async_notify = true; | ||
| 1269 | |||
| 1270 | pending = atomic_read(&ctx->encrypt_pending); | ||
| 1271 | spin_unlock_bh(&ctx->encrypt_compl_lock); | ||
| 1272 | if (pending) | ||
| 1273 | crypto_wait_req(-EINPROGRESS, &ctx->async_wait); | ||
| 1274 | else | ||
| 1275 | reinit_completion(&ctx->async_wait.completion); | ||
| 1276 | |||
| 1277 | /* There can be no concurrent accesses, since we have no pending | ||
| 1278 | * encrypt operations | ||
| 1279 | */ | ||
| 1280 | WRITE_ONCE(ctx->async_notify, false); | ||
| 1281 | |||
| 1282 | if (ctx->async_wait.err) | ||
| 1283 | goto unlock; | 1285 | goto unlock; |
| 1284 | 1286 | ||
| 1285 | /* Transmit if any encryptions have completed */ | 1287 | /* Transmit if any encryptions have completed */ |
| @@ -1581,6 +1583,7 @@ static int tls_decrypt_sg(struct sock *sk, struct iov_iter *out_iov, · 295 unmodified lines | |||
| 1581 | } else if (out_sg) { | 1583 | } else if (out_sg) { |
| 1582 | memcpy(sgout, out_sg, n_sgout * sizeof(*sgout)); | 1584 | memcpy(sgout, out_sg, n_sgout * sizeof(*sgout)); |
| 1583 | } | 1585 | } |
| 1586 | dctx->free_sgout = !!pages; | ||
| 1584 | 1587 | ||
| 1585 | /* Prepare and submit AEAD request */ | 1588 | /* Prepare and submit AEAD request */ |
| 1586 | err = tls_do_decryption(sk, sgin, sgout, dctx->iv, | 1589 | err = tls_do_decryption(sk, sgin, sgout, dctx->iv, |
| @@ -2109,16 +2112,10 @@ put_on_rx_list: · 522 unmodified lines | |||
| 2109 | 2112 | ||
| 2110 | recv_end: | 2113 | recv_end: |
| 2111 | if (async) { | 2114 | if (async) { |
| 2112 | int ret, pending; | 2115 | int ret; |
| 2113 | 2116 | ||
| 2114 | /* Wait for all previously submitted records to be decrypted */ | 2117 | /* Wait for all previously submitted records to be decrypted */ |
| 2115 | spin_lock_bh(&ctx->decrypt_compl_lock); | 2118 | ret = tls_decrypt_async_wait(ctx); |
| 2116 | reinit_completion(&ctx->async_wait.completion); | ||
| 2117 | pending = atomic_read(&ctx->decrypt_pending); | ||
| 2118 | spin_unlock_bh(&ctx->decrypt_compl_lock); | ||
| 2119 | ret = 0; | ||
| 2120 | if (pending) | ||
| 2121 | ret = crypto_wait_req(-EINPROGRESS, &ctx->async_wait); | ||
| 2122 | __skb_queue_purge(&ctx->async_hold); | 2119 | __skb_queue_purge(&ctx->async_hold); |
| 2123 | 2120 | ||
| 2124 | if (ret) { | 2121 | if (ret) { |
| @@ -2135,7 +2132,6 @@ recv_end: · 10 unmodified lines | |||
| 2135 | else | 2132 | else |
| 2136 | err = process_rx_list(ctx, msg, &control, 0, | 2133 | err = process_rx_list(ctx, msg, &control, 0, |
| 2137 | async_copy_bytes, is_peek); | 2134 | async_copy_bytes, is_peek); |
| 2138 | decrypted += max(err, 0); | ||
| 2139 | } | 2135 | } |
| 2140 | 2136 | ||
| 2141 | copied += decrypted; | 2137 | copied += decrypted; |
| @@ -2435,16 +2431,9 @@ void tls_sw_release_resources_tx(struct sock *sk) · 293 unmodified lines | |||
| 2435 | struct tls_context *tls_ctx = tls_get_ctx(sk); | 2431 | struct tls_context *tls_ctx = tls_get_ctx(sk); |
| 2436 | struct tls_sw_context_tx *ctx = tls_sw_ctx_tx(tls_ctx); | 2432 | struct tls_sw_context_tx *ctx = tls_sw_ctx_tx(tls_ctx); |
| 2437 | struct tls_rec *rec, *tmp; | 2433 | struct tls_rec *rec, *tmp; |
| 2438 | int pending; | ||
| 2439 | 2434 | ||
| 2440 | /* Wait for any pending async encryptions to complete */ | 2435 | /* Wait for any pending async encryptions to complete */ |
| 2441 | spin_lock_bh(&ctx->encrypt_compl_lock); | 2436 | tls_encrypt_async_wait(ctx); |
| 2442 | ctx->async_notify = true; | ||
| 2443 | pending = atomic_read(&ctx->encrypt_pending); | ||
| 2444 | spin_unlock_bh(&ctx->encrypt_compl_lock); | ||
| 2445 | |||
| 2446 | if (pending) | ||
| 2447 | crypto_wait_req(-EINPROGRESS, &ctx->async_wait); | ||
| 2448 | 2437 | ||
| 2449 | tls_tx_records(sk, -1); | 2438 | tls_tx_records(sk, -1); |
| 2450 | 2439 | ||
| @@ -2607,7 +2596,7 @@ static struct tls_sw_context_tx *init_ctx_tx(struct tls_context *ctx, struct soc · 156 unmodified lines | |||
| 2607 | } | 2596 | } |
| 2608 | 2597 | ||
| 2609 | crypto_init_wait(&sw_ctx_tx->async_wait); | 2598 | crypto_init_wait(&sw_ctx_tx->async_wait); |
| 2610 | spin_lock_init(&sw_ctx_tx->encrypt_compl_lock); | 2599 | atomic_set(&sw_ctx_tx->encrypt_pending, 1); |
| 2611 | INIT_LIST_HEAD(&sw_ctx_tx->tx_list); | 2600 | INIT_LIST_HEAD(&sw_ctx_tx->tx_list); |
| 2612 | INIT_DELAYED_WORK(&sw_ctx_tx->tx_work.work, tx_work_handler); | 2601 | INIT_DELAYED_WORK(&sw_ctx_tx->tx_work.work, tx_work_handler); |
| 2613 | sw_ctx_tx->tx_work.sk = sk; | 2602 | sw_ctx_tx->tx_work.sk = sk; |
| @@ -2628,7 +2617,7 @@ static struct tls_sw_context_rx *init_ctx_rx(struct tls_context *ctx) · 14 unmodified lines | |||
| 2628 | } | 2617 | } |
| 2629 | 2618 | ||
| 2630 | crypto_init_wait(&sw_ctx_rx->async_wait); | 2619 | crypto_init_wait(&sw_ctx_rx->async_wait); |
| 2631 | spin_lock_init(&sw_ctx_rx->decrypt_compl_lock); | 2620 | atomic_set(&sw_ctx_rx->decrypt_pending, 1); |
| 2632 | init_waitqueue_head(&sw_ctx_rx->wq); | 2621 | init_waitqueue_head(&sw_ctx_rx->wq); |
| 2633 | skb_queue_head_init(&sw_ctx_rx->rx_list); | 2622 | skb_queue_head_init(&sw_ctx_rx->rx_list); |
| 2634 | skb_queue_head_init(&sw_ctx_rx->async_hold); | 2623 | skb_queue_head_init(&sw_ctx_rx->async_hold); |
| @@ -315,10 +315,11 @@ void unix_gc(void) · 314 unmodified lines | |||
| 315 | __skb_queue_purge(&hitlist); | 315 | __skb_queue_purge(&hitlist); |
| 316 | 316 | ||
| 317 | #if IS_ENABLED(CONFIG_AF_UNIX_OOB) | 317 | #if IS_ENABLED(CONFIG_AF_UNIX_OOB) |
| 318 | list_for_each_entry_safe(u, next, &gc_candidates, link) { | 318 | while (!list_empty(&gc_candidates)) { |
| 319 | struct sk_buff *skb = u->oob_skb; | 319 | u = list_entry(gc_candidates.next, struct unix_sock, link); |
| 320 | if (u->oob_skb) { | ||
| 321 | struct sk_buff *skb = u->oob_skb; | ||
| 320 | 322 | ||
| 321 | if (skb) { | ||
| 322 | u->oob_skb = NULL; | 323 | u->oob_skb = NULL; |
| 323 | kfree_skb(skb); | 324 | kfree_skb(skb); |
| 324 | } | 325 | } |
| @@ -858,4 +858,5 @@ int xfrm_count_pfkey_enc_supported(void) · 857 unmodified lines | |||
| 858 | } | 858 | } |
| 859 | EXPORT_SYMBOL_GPL(xfrm_count_pfkey_enc_supported); | 859 | EXPORT_SYMBOL_GPL(xfrm_count_pfkey_enc_supported); |
| 860 | 860 | ||
| 861 | MODULE_DESCRIPTION("XFRM Algorithm interface"); | ||
| 861 | MODULE_LICENSE("GPL"); | 862 | MODULE_LICENSE("GPL"); |
| @@ -3888,5 +3888,6 @@ static void __exit xfrm_user_exit(void) · 3887 unmodified lines | |||
| 3888 | 3888 | ||
| 3889 | module_init(xfrm_user_init); | 3889 | module_init(xfrm_user_init); |
| 3890 | module_exit(xfrm_user_exit); | 3890 | module_exit(xfrm_user_exit); |
| 3891 | MODULE_DESCRIPTION("XFRM User interface"); | ||
| 3891 | MODULE_LICENSE("GPL"); | 3892 | MODULE_LICENSE("GPL"); |
| 3892 | MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_XFRM); | 3893 | MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_XFRM); |