diff options
Diffstat (limited to 'net')
48 files changed, 364 insertions, 169 deletions
diff --git a/net/9p/trans_common.c b/net/9p/trans_common.c index 38aa6345bdfa..b718db2085b2 100644 --- a/net/9p/trans_common.c +++ b/net/9p/trans_common.c | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
| 17 | 17 | ||
| 18 | /** | 18 | /** |
| 19 | * p9_release_req_pages - Release pages after the transaction. | 19 | * p9_release_pages - Release pages after the transaction. |
| 20 | */ | 20 | */ |
| 21 | void p9_release_pages(struct page **pages, int nr_pages) | 21 | void p9_release_pages(struct page **pages, int nr_pages) |
| 22 | { | 22 | { |
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c index 0cfba919d167..848969fe7979 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c | |||
| @@ -1092,8 +1092,8 @@ static struct p9_trans_module p9_fd_trans = { | |||
| 1092 | }; | 1092 | }; |
| 1093 | 1093 | ||
| 1094 | /** | 1094 | /** |
| 1095 | * p9_poll_proc - poll worker thread | 1095 | * p9_poll_workfn - poll worker thread |
| 1096 | * @a: thread state and arguments | 1096 | * @work: work queue |
| 1097 | * | 1097 | * |
| 1098 | * polls all v9fs transports for new events and queues the appropriate | 1098 | * polls all v9fs transports for new events and queues the appropriate |
| 1099 | * work to the work queue | 1099 | * work to the work queue |
diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c index 6d8e3031978f..3d414acb7015 100644 --- a/net/9p/trans_rdma.c +++ b/net/9p/trans_rdma.c | |||
| @@ -68,8 +68,6 @@ | |||
| 68 | * @pd: Protection Domain pointer | 68 | * @pd: Protection Domain pointer |
| 69 | * @qp: Queue Pair pointer | 69 | * @qp: Queue Pair pointer |
| 70 | * @cq: Completion Queue pointer | 70 | * @cq: Completion Queue pointer |
| 71 | * @dm_mr: DMA Memory Region pointer | ||
| 72 | * @lkey: The local access only memory region key | ||
| 73 | * @timeout: Number of uSecs to wait for connection management events | 71 | * @timeout: Number of uSecs to wait for connection management events |
| 74 | * @privport: Whether a privileged port may be used | 72 | * @privport: Whether a privileged port may be used |
| 75 | * @port: The port to use | 73 | * @port: The port to use |
| @@ -632,7 +630,7 @@ static int p9_rdma_bind_privport(struct p9_trans_rdma *rdma) | |||
| 632 | } | 630 | } |
| 633 | 631 | ||
| 634 | /** | 632 | /** |
| 635 | * trans_create_rdma - Transport method for creating atransport instance | 633 | * rdma_create_trans - Transport method for creating a transport instance |
| 636 | * @client: client instance | 634 | * @client: client instance |
| 637 | * @addr: IP address string | 635 | * @addr: IP address string |
| 638 | * @args: Mount options string | 636 | * @args: Mount options string |
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index 3aa5a93ad107..4d0372263e5d 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c | |||
| @@ -60,7 +60,6 @@ static atomic_t vp_pinned = ATOMIC_INIT(0); | |||
| 60 | 60 | ||
| 61 | /** | 61 | /** |
| 62 | * struct virtio_chan - per-instance transport information | 62 | * struct virtio_chan - per-instance transport information |
| 63 | * @initialized: whether the channel is initialized | ||
| 64 | * @inuse: whether the channel is in use | 63 | * @inuse: whether the channel is in use |
| 65 | * @lock: protects multiple elements within this structure | 64 | * @lock: protects multiple elements within this structure |
| 66 | * @client: client instance | 65 | * @client: client instance |
| @@ -385,8 +384,8 @@ static int p9_get_mapped_pages(struct virtio_chan *chan, | |||
| 385 | * @uidata: user bffer that should be ued for zero copy read | 384 | * @uidata: user bffer that should be ued for zero copy read |
| 386 | * @uodata: user buffer that shoud be user for zero copy write | 385 | * @uodata: user buffer that shoud be user for zero copy write |
| 387 | * @inlen: read buffer size | 386 | * @inlen: read buffer size |
| 388 | * @olen: write buffer size | 387 | * @outlen: write buffer size |
| 389 | * @hdrlen: reader header size, This is the size of response protocol data | 388 | * @in_hdr_len: reader header size, This is the size of response protocol data |
| 390 | * | 389 | * |
| 391 | */ | 390 | */ |
| 392 | static int | 391 | static int |
diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c index 086a4abdfa7c..0f19960390a6 100644 --- a/net/9p/trans_xen.c +++ b/net/9p/trans_xen.c | |||
| @@ -485,7 +485,7 @@ static int xen_9pfs_front_probe(struct xenbus_device *dev, | |||
| 485 | 485 | ||
| 486 | static int xen_9pfs_front_resume(struct xenbus_device *dev) | 486 | static int xen_9pfs_front_resume(struct xenbus_device *dev) |
| 487 | { | 487 | { |
| 488 | dev_warn(&dev->dev, "suspsend/resume unsupported\n"); | 488 | dev_warn(&dev->dev, "suspend/resume unsupported\n"); |
| 489 | return 0; | 489 | return 0; |
| 490 | } | 490 | } |
| 491 | 491 | ||
diff --git a/net/atm/lec.c b/net/atm/lec.c index 01d5d20a6eb1..3138a869b5c0 100644 --- a/net/atm/lec.c +++ b/net/atm/lec.c | |||
| @@ -41,6 +41,9 @@ static unsigned char bridge_ula_lec[] = { 0x01, 0x80, 0xc2, 0x00, 0x00 }; | |||
| 41 | #include <linux/module.h> | 41 | #include <linux/module.h> |
| 42 | #include <linux/init.h> | 42 | #include <linux/init.h> |
| 43 | 43 | ||
| 44 | /* Hardening for Spectre-v1 */ | ||
| 45 | #include <linux/nospec.h> | ||
| 46 | |||
| 44 | #include "lec.h" | 47 | #include "lec.h" |
| 45 | #include "lec_arpc.h" | 48 | #include "lec_arpc.h" |
| 46 | #include "resources.h" | 49 | #include "resources.h" |
| @@ -687,8 +690,10 @@ static int lec_vcc_attach(struct atm_vcc *vcc, void __user *arg) | |||
| 687 | bytes_left = copy_from_user(&ioc_data, arg, sizeof(struct atmlec_ioc)); | 690 | bytes_left = copy_from_user(&ioc_data, arg, sizeof(struct atmlec_ioc)); |
| 688 | if (bytes_left != 0) | 691 | if (bytes_left != 0) |
| 689 | pr_info("copy from user failed for %d bytes\n", bytes_left); | 692 | pr_info("copy from user failed for %d bytes\n", bytes_left); |
| 690 | if (ioc_data.dev_num < 0 || ioc_data.dev_num >= MAX_LEC_ITF || | 693 | if (ioc_data.dev_num < 0 || ioc_data.dev_num >= MAX_LEC_ITF) |
| 691 | !dev_lec[ioc_data.dev_num]) | 694 | return -EINVAL; |
| 695 | ioc_data.dev_num = array_index_nospec(ioc_data.dev_num, MAX_LEC_ITF); | ||
| 696 | if (!dev_lec[ioc_data.dev_num]) | ||
| 692 | return -EINVAL; | 697 | return -EINVAL; |
| 693 | vpriv = kmalloc(sizeof(struct lec_vcc_priv), GFP_KERNEL); | 698 | vpriv = kmalloc(sizeof(struct lec_vcc_priv), GFP_KERNEL); |
| 694 | if (!vpriv) | 699 | if (!vpriv) |
diff --git a/net/ieee802154/6lowpan/6lowpan_i.h b/net/ieee802154/6lowpan/6lowpan_i.h index b8d95cb71c25..44a7e16bf3b5 100644 --- a/net/ieee802154/6lowpan/6lowpan_i.h +++ b/net/ieee802154/6lowpan/6lowpan_i.h | |||
| @@ -20,8 +20,8 @@ typedef unsigned __bitwise lowpan_rx_result; | |||
| 20 | struct frag_lowpan_compare_key { | 20 | struct frag_lowpan_compare_key { |
| 21 | u16 tag; | 21 | u16 tag; |
| 22 | u16 d_size; | 22 | u16 d_size; |
| 23 | const struct ieee802154_addr src; | 23 | struct ieee802154_addr src; |
| 24 | const struct ieee802154_addr dst; | 24 | struct ieee802154_addr dst; |
| 25 | }; | 25 | }; |
| 26 | 26 | ||
| 27 | /* Equivalent of ipv4 struct ipq | 27 | /* Equivalent of ipv4 struct ipq |
diff --git a/net/ieee802154/6lowpan/reassembly.c b/net/ieee802154/6lowpan/reassembly.c index 1790b65944b3..2cc224106b69 100644 --- a/net/ieee802154/6lowpan/reassembly.c +++ b/net/ieee802154/6lowpan/reassembly.c | |||
| @@ -75,14 +75,14 @@ fq_find(struct net *net, const struct lowpan_802154_cb *cb, | |||
| 75 | { | 75 | { |
| 76 | struct netns_ieee802154_lowpan *ieee802154_lowpan = | 76 | struct netns_ieee802154_lowpan *ieee802154_lowpan = |
| 77 | net_ieee802154_lowpan(net); | 77 | net_ieee802154_lowpan(net); |
| 78 | struct frag_lowpan_compare_key key = { | 78 | struct frag_lowpan_compare_key key = {}; |
| 79 | .tag = cb->d_tag, | ||
| 80 | .d_size = cb->d_size, | ||
| 81 | .src = *src, | ||
| 82 | .dst = *dst, | ||
| 83 | }; | ||
| 84 | struct inet_frag_queue *q; | 79 | struct inet_frag_queue *q; |
| 85 | 80 | ||
| 81 | key.tag = cb->d_tag; | ||
| 82 | key.d_size = cb->d_size; | ||
| 83 | key.src = *src; | ||
| 84 | key.dst = *dst; | ||
| 85 | |||
| 86 | q = inet_frag_find(&ieee802154_lowpan->frags, &key); | 86 | q = inet_frag_find(&ieee802154_lowpan->frags, &key); |
| 87 | if (!q) | 87 | if (!q) |
| 88 | return NULL; | 88 | return NULL; |
| @@ -372,7 +372,7 @@ int lowpan_frag_rcv(struct sk_buff *skb, u8 frag_type) | |||
| 372 | struct lowpan_frag_queue *fq; | 372 | struct lowpan_frag_queue *fq; |
| 373 | struct net *net = dev_net(skb->dev); | 373 | struct net *net = dev_net(skb->dev); |
| 374 | struct lowpan_802154_cb *cb = lowpan_802154_cb(skb); | 374 | struct lowpan_802154_cb *cb = lowpan_802154_cb(skb); |
| 375 | struct ieee802154_hdr hdr; | 375 | struct ieee802154_hdr hdr = {}; |
| 376 | int err; | 376 | int err; |
| 377 | 377 | ||
| 378 | if (ieee802154_hdr_peek_addrs(skb, &hdr) < 0) | 378 | if (ieee802154_hdr_peek_addrs(skb, &hdr) < 0) |
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index 05e47d777009..56a010622f70 100644 --- a/net/ipv4/ping.c +++ b/net/ipv4/ping.c | |||
| @@ -775,8 +775,10 @@ static int ping_v4_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) | |||
| 775 | ipc.addr = faddr = daddr; | 775 | ipc.addr = faddr = daddr; |
| 776 | 776 | ||
| 777 | if (ipc.opt && ipc.opt->opt.srr) { | 777 | if (ipc.opt && ipc.opt->opt.srr) { |
| 778 | if (!daddr) | 778 | if (!daddr) { |
| 779 | return -EINVAL; | 779 | err = -EINVAL; |
| 780 | goto out_free; | ||
| 781 | } | ||
| 780 | faddr = ipc.opt->opt.faddr; | 782 | faddr = ipc.opt->opt.faddr; |
| 781 | } | 783 | } |
| 782 | tos = get_rttos(&ipc, inet); | 784 | tos = get_rttos(&ipc, inet); |
| @@ -842,6 +844,7 @@ back_from_confirm: | |||
| 842 | 844 | ||
| 843 | out: | 845 | out: |
| 844 | ip_rt_put(rt); | 846 | ip_rt_put(rt); |
| 847 | out_free: | ||
| 845 | if (free) | 848 | if (free) |
| 846 | kfree(ipc.opt); | 849 | kfree(ipc.opt); |
| 847 | if (!err) { | 850 | if (!err) { |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 1412a7baf0b9..29268efad247 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
| @@ -1375,6 +1375,7 @@ static bool rt_bind_exception(struct rtable *rt, struct fib_nh_exception *fnhe, | |||
| 1375 | fnhe->fnhe_gw = 0; | 1375 | fnhe->fnhe_gw = 0; |
| 1376 | fnhe->fnhe_pmtu = 0; | 1376 | fnhe->fnhe_pmtu = 0; |
| 1377 | fnhe->fnhe_expires = 0; | 1377 | fnhe->fnhe_expires = 0; |
| 1378 | fnhe->fnhe_mtu_locked = false; | ||
| 1378 | fnhe_flush_routes(fnhe); | 1379 | fnhe_flush_routes(fnhe); |
| 1379 | orig = NULL; | 1380 | orig = NULL; |
| 1380 | } | 1381 | } |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 24b5c59b1c53..b61a770884fa 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
| @@ -401,9 +401,9 @@ static int compute_score(struct sock *sk, struct net *net, | |||
| 401 | bool dev_match = (sk->sk_bound_dev_if == dif || | 401 | bool dev_match = (sk->sk_bound_dev_if == dif || |
| 402 | sk->sk_bound_dev_if == sdif); | 402 | sk->sk_bound_dev_if == sdif); |
| 403 | 403 | ||
| 404 | if (exact_dif && !dev_match) | 404 | if (!dev_match) |
| 405 | return -1; | 405 | return -1; |
| 406 | if (sk->sk_bound_dev_if && dev_match) | 406 | if (sk->sk_bound_dev_if) |
| 407 | score += 4; | 407 | score += 4; |
| 408 | } | 408 | } |
| 409 | 409 | ||
| @@ -952,8 +952,10 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) | |||
| 952 | sock_tx_timestamp(sk, ipc.sockc.tsflags, &ipc.tx_flags); | 952 | sock_tx_timestamp(sk, ipc.sockc.tsflags, &ipc.tx_flags); |
| 953 | 953 | ||
| 954 | if (ipc.opt && ipc.opt->opt.srr) { | 954 | if (ipc.opt && ipc.opt->opt.srr) { |
| 955 | if (!daddr) | 955 | if (!daddr) { |
| 956 | return -EINVAL; | 956 | err = -EINVAL; |
| 957 | goto out_free; | ||
| 958 | } | ||
| 957 | faddr = ipc.opt->opt.faddr; | 959 | faddr = ipc.opt->opt.faddr; |
| 958 | connected = 0; | 960 | connected = 0; |
| 959 | } | 961 | } |
| @@ -1074,6 +1076,7 @@ do_append_data: | |||
| 1074 | 1076 | ||
| 1075 | out: | 1077 | out: |
| 1076 | ip_rt_put(rt); | 1078 | ip_rt_put(rt); |
| 1079 | out_free: | ||
| 1077 | if (free) | 1080 | if (free) |
| 1078 | kfree(ipc.opt); | 1081 | kfree(ipc.opt); |
| 1079 | if (!err) | 1082 | if (!err) |
diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig index 6794ddf0547c..11e4e80cf7e9 100644 --- a/net/ipv6/Kconfig +++ b/net/ipv6/Kconfig | |||
| @@ -34,16 +34,15 @@ config IPV6_ROUTE_INFO | |||
| 34 | bool "IPv6: Route Information (RFC 4191) support" | 34 | bool "IPv6: Route Information (RFC 4191) support" |
| 35 | depends on IPV6_ROUTER_PREF | 35 | depends on IPV6_ROUTER_PREF |
| 36 | ---help--- | 36 | ---help--- |
| 37 | This is experimental support of Route Information. | 37 | Support of Route Information. |
| 38 | 38 | ||
| 39 | If unsure, say N. | 39 | If unsure, say N. |
| 40 | 40 | ||
| 41 | config IPV6_OPTIMISTIC_DAD | 41 | config IPV6_OPTIMISTIC_DAD |
| 42 | bool "IPv6: Enable RFC 4429 Optimistic DAD" | 42 | bool "IPv6: Enable RFC 4429 Optimistic DAD" |
| 43 | ---help--- | 43 | ---help--- |
| 44 | This is experimental support for optimistic Duplicate | 44 | Support for optimistic Duplicate Address Detection. It allows for |
| 45 | Address Detection. It allows for autoconfigured addresses | 45 | autoconfigured addresses to be used more quickly. |
| 46 | to be used more quickly. | ||
| 47 | 46 | ||
| 48 | If unsure, say N. | 47 | If unsure, say N. |
| 49 | 48 | ||
| @@ -280,7 +279,7 @@ config IPV6_MROUTE | |||
| 280 | depends on IPV6 | 279 | depends on IPV6 |
| 281 | select IP_MROUTE_COMMON | 280 | select IP_MROUTE_COMMON |
| 282 | ---help--- | 281 | ---help--- |
| 283 | Experimental support for IPv6 multicast forwarding. | 282 | Support for IPv6 multicast forwarding. |
| 284 | If unsure, say N. | 283 | If unsure, say N. |
| 285 | 284 | ||
| 286 | config IPV6_MROUTE_MULTIPLE_TABLES | 285 | config IPV6_MROUTE_MULTIPLE_TABLES |
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c index c214ffec02f0..ca957dd93a29 100644 --- a/net/ipv6/ip6_vti.c +++ b/net/ipv6/ip6_vti.c | |||
| @@ -669,7 +669,7 @@ static void vti6_link_config(struct ip6_tnl *t, bool keep_mtu) | |||
| 669 | else | 669 | else |
| 670 | mtu = ETH_DATA_LEN - LL_MAX_HEADER - sizeof(struct ipv6hdr); | 670 | mtu = ETH_DATA_LEN - LL_MAX_HEADER - sizeof(struct ipv6hdr); |
| 671 | 671 | ||
| 672 | dev->mtu = max_t(int, mtu, IPV6_MIN_MTU); | 672 | dev->mtu = max_t(int, mtu, IPV4_MIN_MTU); |
| 673 | } | 673 | } |
| 674 | 674 | ||
| 675 | /** | 675 | /** |
| @@ -881,7 +881,7 @@ static void vti6_dev_setup(struct net_device *dev) | |||
| 881 | dev->priv_destructor = vti6_dev_free; | 881 | dev->priv_destructor = vti6_dev_free; |
| 882 | 882 | ||
| 883 | dev->type = ARPHRD_TUNNEL6; | 883 | dev->type = ARPHRD_TUNNEL6; |
| 884 | dev->min_mtu = IPV6_MIN_MTU; | 884 | dev->min_mtu = IPV4_MIN_MTU; |
| 885 | dev->max_mtu = IP_MAX_MTU - sizeof(struct ipv6hdr); | 885 | dev->max_mtu = IP_MAX_MTU - sizeof(struct ipv6hdr); |
| 886 | dev->flags |= IFF_NOARP; | 886 | dev->flags |= IFF_NOARP; |
| 887 | dev->addr_len = sizeof(struct in6_addr); | 887 | dev->addr_len = sizeof(struct in6_addr); |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 4ec76a87aeb8..ea0730028e5d 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
| @@ -148,9 +148,9 @@ static int compute_score(struct sock *sk, struct net *net, | |||
| 148 | bool dev_match = (sk->sk_bound_dev_if == dif || | 148 | bool dev_match = (sk->sk_bound_dev_if == dif || |
| 149 | sk->sk_bound_dev_if == sdif); | 149 | sk->sk_bound_dev_if == sdif); |
| 150 | 150 | ||
| 151 | if (exact_dif && !dev_match) | 151 | if (!dev_match) |
| 152 | return -1; | 152 | return -1; |
| 153 | if (sk->sk_bound_dev_if && dev_match) | 153 | if (sk->sk_bound_dev_if) |
| 154 | score++; | 154 | score++; |
| 155 | } | 155 | } |
| 156 | 156 | ||
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c index f85f0d7480ac..4a46df8441c9 100644 --- a/net/ipv6/xfrm6_tunnel.c +++ b/net/ipv6/xfrm6_tunnel.c | |||
| @@ -341,6 +341,9 @@ static void __net_exit xfrm6_tunnel_net_exit(struct net *net) | |||
| 341 | struct xfrm6_tunnel_net *xfrm6_tn = xfrm6_tunnel_pernet(net); | 341 | struct xfrm6_tunnel_net *xfrm6_tn = xfrm6_tunnel_pernet(net); |
| 342 | unsigned int i; | 342 | unsigned int i; |
| 343 | 343 | ||
| 344 | xfrm_state_flush(net, IPSEC_PROTO_ANY, false); | ||
| 345 | xfrm_flush_gc(); | ||
| 346 | |||
| 344 | for (i = 0; i < XFRM6_TUNNEL_SPI_BYADDR_HSIZE; i++) | 347 | for (i = 0; i < XFRM6_TUNNEL_SPI_BYADDR_HSIZE; i++) |
| 345 | WARN_ON_ONCE(!hlist_empty(&xfrm6_tn->spi_byaddr[i])); | 348 | WARN_ON_ONCE(!hlist_empty(&xfrm6_tn->spi_byaddr[i])); |
| 346 | 349 | ||
diff --git a/net/key/af_key.c b/net/key/af_key.c index 7e2e7188e7f4..e62e52e8f141 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
| @@ -437,6 +437,24 @@ static int verify_address_len(const void *p) | |||
| 437 | return 0; | 437 | return 0; |
| 438 | } | 438 | } |
| 439 | 439 | ||
| 440 | static inline int sadb_key_len(const struct sadb_key *key) | ||
| 441 | { | ||
| 442 | int key_bytes = DIV_ROUND_UP(key->sadb_key_bits, 8); | ||
| 443 | |||
| 444 | return DIV_ROUND_UP(sizeof(struct sadb_key) + key_bytes, | ||
| 445 | sizeof(uint64_t)); | ||
| 446 | } | ||
| 447 | |||
| 448 | static int verify_key_len(const void *p) | ||
| 449 | { | ||
| 450 | const struct sadb_key *key = p; | ||
| 451 | |||
| 452 | if (sadb_key_len(key) > key->sadb_key_len) | ||
| 453 | return -EINVAL; | ||
| 454 | |||
| 455 | return 0; | ||
| 456 | } | ||
| 457 | |||
| 440 | static inline int pfkey_sec_ctx_len(const struct sadb_x_sec_ctx *sec_ctx) | 458 | static inline int pfkey_sec_ctx_len(const struct sadb_x_sec_ctx *sec_ctx) |
| 441 | { | 459 | { |
| 442 | return DIV_ROUND_UP(sizeof(struct sadb_x_sec_ctx) + | 460 | return DIV_ROUND_UP(sizeof(struct sadb_x_sec_ctx) + |
| @@ -533,16 +551,25 @@ static int parse_exthdrs(struct sk_buff *skb, const struct sadb_msg *hdr, void * | |||
| 533 | return -EINVAL; | 551 | return -EINVAL; |
| 534 | if (ext_hdrs[ext_type-1] != NULL) | 552 | if (ext_hdrs[ext_type-1] != NULL) |
| 535 | return -EINVAL; | 553 | return -EINVAL; |
| 536 | if (ext_type == SADB_EXT_ADDRESS_SRC || | 554 | switch (ext_type) { |
| 537 | ext_type == SADB_EXT_ADDRESS_DST || | 555 | case SADB_EXT_ADDRESS_SRC: |
| 538 | ext_type == SADB_EXT_ADDRESS_PROXY || | 556 | case SADB_EXT_ADDRESS_DST: |
| 539 | ext_type == SADB_X_EXT_NAT_T_OA) { | 557 | case SADB_EXT_ADDRESS_PROXY: |
| 558 | case SADB_X_EXT_NAT_T_OA: | ||
| 540 | if (verify_address_len(p)) | 559 | if (verify_address_len(p)) |
| 541 | return -EINVAL; | 560 | return -EINVAL; |
| 542 | } | 561 | break; |
| 543 | if (ext_type == SADB_X_EXT_SEC_CTX) { | 562 | case SADB_X_EXT_SEC_CTX: |
| 544 | if (verify_sec_ctx_len(p)) | 563 | if (verify_sec_ctx_len(p)) |
| 545 | return -EINVAL; | 564 | return -EINVAL; |
| 565 | break; | ||
| 566 | case SADB_EXT_KEY_AUTH: | ||
| 567 | case SADB_EXT_KEY_ENCRYPT: | ||
| 568 | if (verify_key_len(p)) | ||
| 569 | return -EINVAL; | ||
| 570 | break; | ||
| 571 | default: | ||
| 572 | break; | ||
| 546 | } | 573 | } |
| 547 | ext_hdrs[ext_type-1] = (void *) p; | 574 | ext_hdrs[ext_type-1] = (void *) p; |
| 548 | } | 575 | } |
| @@ -1104,14 +1131,12 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct net *net, | |||
| 1104 | key = ext_hdrs[SADB_EXT_KEY_AUTH - 1]; | 1131 | key = ext_hdrs[SADB_EXT_KEY_AUTH - 1]; |
| 1105 | if (key != NULL && | 1132 | if (key != NULL && |
| 1106 | sa->sadb_sa_auth != SADB_X_AALG_NULL && | 1133 | sa->sadb_sa_auth != SADB_X_AALG_NULL && |
| 1107 | ((key->sadb_key_bits+7) / 8 == 0 || | 1134 | key->sadb_key_bits == 0) |
| 1108 | (key->sadb_key_bits+7) / 8 > key->sadb_key_len * sizeof(uint64_t))) | ||
| 1109 | return ERR_PTR(-EINVAL); | 1135 | return ERR_PTR(-EINVAL); |
| 1110 | key = ext_hdrs[SADB_EXT_KEY_ENCRYPT-1]; | 1136 | key = ext_hdrs[SADB_EXT_KEY_ENCRYPT-1]; |
| 1111 | if (key != NULL && | 1137 | if (key != NULL && |
| 1112 | sa->sadb_sa_encrypt != SADB_EALG_NULL && | 1138 | sa->sadb_sa_encrypt != SADB_EALG_NULL && |
| 1113 | ((key->sadb_key_bits+7) / 8 == 0 || | 1139 | key->sadb_key_bits == 0) |
| 1114 | (key->sadb_key_bits+7) / 8 > key->sadb_key_len * sizeof(uint64_t))) | ||
| 1115 | return ERR_PTR(-EINVAL); | 1140 | return ERR_PTR(-EINVAL); |
| 1116 | 1141 | ||
| 1117 | x = xfrm_state_alloc(net); | 1142 | x = xfrm_state_alloc(net); |
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c index cb80ebb38311..1beeea9549fa 100644 --- a/net/llc/af_llc.c +++ b/net/llc/af_llc.c | |||
| @@ -930,6 +930,9 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) | |||
| 930 | if (size > llc->dev->mtu) | 930 | if (size > llc->dev->mtu) |
| 931 | size = llc->dev->mtu; | 931 | size = llc->dev->mtu; |
| 932 | copied = size - hdrlen; | 932 | copied = size - hdrlen; |
| 933 | rc = -EINVAL; | ||
| 934 | if (copied < 0) | ||
| 935 | goto release; | ||
| 933 | release_sock(sk); | 936 | release_sock(sk); |
| 934 | skb = sock_alloc_send_skb(sk, size, noblock, &rc); | 937 | skb = sock_alloc_send_skb(sk, size, noblock, &rc); |
| 935 | lock_sock(sk); | 938 | lock_sock(sk); |
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c index 595c662a61e8..ac4295296514 100644 --- a/net/mac80211/agg-tx.c +++ b/net/mac80211/agg-tx.c | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | * Copyright 2007, Michael Wu <flamingice@sourmilk.net> | 8 | * Copyright 2007, Michael Wu <flamingice@sourmilk.net> |
| 9 | * Copyright 2007-2010, Intel Corporation | 9 | * Copyright 2007-2010, Intel Corporation |
| 10 | * Copyright(c) 2015-2017 Intel Deutschland GmbH | 10 | * Copyright(c) 2015-2017 Intel Deutschland GmbH |
| 11 | * Copyright (C) 2018 Intel Corporation | ||
| 11 | * | 12 | * |
| 12 | * This program is free software; you can redistribute it and/or modify | 13 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License version 2 as | 14 | * it under the terms of the GNU General Public License version 2 as |
| @@ -970,6 +971,9 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local, | |||
| 970 | 971 | ||
| 971 | sta->ampdu_mlme.addba_req_num[tid] = 0; | 972 | sta->ampdu_mlme.addba_req_num[tid] = 0; |
| 972 | 973 | ||
| 974 | tid_tx->timeout = | ||
| 975 | le16_to_cpu(mgmt->u.action.u.addba_resp.timeout); | ||
| 976 | |||
| 973 | if (tid_tx->timeout) { | 977 | if (tid_tx->timeout) { |
| 974 | mod_timer(&tid_tx->session_timer, | 978 | mod_timer(&tid_tx->session_timer, |
| 975 | TU_TO_EXP_TIME(tid_tx->timeout)); | 979 | TU_TO_EXP_TIME(tid_tx->timeout)); |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 69449db7e283..233068756502 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | #define IEEE80211_AUTH_TIMEOUT (HZ / 5) | 36 | #define IEEE80211_AUTH_TIMEOUT (HZ / 5) |
| 37 | #define IEEE80211_AUTH_TIMEOUT_LONG (HZ / 2) | 37 | #define IEEE80211_AUTH_TIMEOUT_LONG (HZ / 2) |
| 38 | #define IEEE80211_AUTH_TIMEOUT_SHORT (HZ / 10) | 38 | #define IEEE80211_AUTH_TIMEOUT_SHORT (HZ / 10) |
| 39 | #define IEEE80211_AUTH_TIMEOUT_SAE (HZ * 2) | ||
| 39 | #define IEEE80211_AUTH_MAX_TRIES 3 | 40 | #define IEEE80211_AUTH_MAX_TRIES 3 |
| 40 | #define IEEE80211_AUTH_WAIT_ASSOC (HZ * 5) | 41 | #define IEEE80211_AUTH_WAIT_ASSOC (HZ * 5) |
| 41 | #define IEEE80211_ASSOC_TIMEOUT (HZ / 5) | 42 | #define IEEE80211_ASSOC_TIMEOUT (HZ / 5) |
| @@ -1787,7 +1788,7 @@ static bool ieee80211_sta_wmm_params(struct ieee80211_local *local, | |||
| 1787 | params[ac].acm = acm; | 1788 | params[ac].acm = acm; |
| 1788 | params[ac].uapsd = uapsd; | 1789 | params[ac].uapsd = uapsd; |
| 1789 | 1790 | ||
| 1790 | if (params->cw_min == 0 || | 1791 | if (params[ac].cw_min == 0 || |
| 1791 | params[ac].cw_min > params[ac].cw_max) { | 1792 | params[ac].cw_min > params[ac].cw_max) { |
| 1792 | sdata_info(sdata, | 1793 | sdata_info(sdata, |
| 1793 | "AP has invalid WMM params (CWmin/max=%d/%d for ACI %d), using defaults\n", | 1794 | "AP has invalid WMM params (CWmin/max=%d/%d for ACI %d), using defaults\n", |
| @@ -3814,16 +3815,19 @@ static int ieee80211_auth(struct ieee80211_sub_if_data *sdata) | |||
| 3814 | tx_flags); | 3815 | tx_flags); |
| 3815 | 3816 | ||
| 3816 | if (tx_flags == 0) { | 3817 | if (tx_flags == 0) { |
| 3817 | auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT; | 3818 | if (auth_data->algorithm == WLAN_AUTH_SAE) |
| 3818 | auth_data->timeout_started = true; | 3819 | auth_data->timeout = jiffies + |
| 3819 | run_again(sdata, auth_data->timeout); | 3820 | IEEE80211_AUTH_TIMEOUT_SAE; |
| 3821 | else | ||
| 3822 | auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT; | ||
| 3820 | } else { | 3823 | } else { |
| 3821 | auth_data->timeout = | 3824 | auth_data->timeout = |
| 3822 | round_jiffies_up(jiffies + IEEE80211_AUTH_TIMEOUT_LONG); | 3825 | round_jiffies_up(jiffies + IEEE80211_AUTH_TIMEOUT_LONG); |
| 3823 | auth_data->timeout_started = true; | ||
| 3824 | run_again(sdata, auth_data->timeout); | ||
| 3825 | } | 3826 | } |
| 3826 | 3827 | ||
| 3828 | auth_data->timeout_started = true; | ||
| 3829 | run_again(sdata, auth_data->timeout); | ||
| 3830 | |||
| 3827 | return 0; | 3831 | return 0; |
| 3828 | } | 3832 | } |
| 3829 | 3833 | ||
| @@ -3894,8 +3898,15 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata) | |||
| 3894 | ifmgd->status_received = false; | 3898 | ifmgd->status_received = false; |
| 3895 | if (ifmgd->auth_data && ieee80211_is_auth(fc)) { | 3899 | if (ifmgd->auth_data && ieee80211_is_auth(fc)) { |
| 3896 | if (status_acked) { | 3900 | if (status_acked) { |
| 3897 | ifmgd->auth_data->timeout = | 3901 | if (ifmgd->auth_data->algorithm == |
| 3898 | jiffies + IEEE80211_AUTH_TIMEOUT_SHORT; | 3902 | WLAN_AUTH_SAE) |
| 3903 | ifmgd->auth_data->timeout = | ||
| 3904 | jiffies + | ||
| 3905 | IEEE80211_AUTH_TIMEOUT_SAE; | ||
| 3906 | else | ||
| 3907 | ifmgd->auth_data->timeout = | ||
| 3908 | jiffies + | ||
| 3909 | IEEE80211_AUTH_TIMEOUT_SHORT; | ||
| 3899 | run_again(sdata, ifmgd->auth_data->timeout); | 3910 | run_again(sdata, ifmgd->auth_data->timeout); |
| 3900 | } else { | 3911 | } else { |
| 3901 | ifmgd->auth_data->timeout = jiffies - 1; | 3912 | ifmgd->auth_data->timeout = jiffies - 1; |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 535de3161a78..05a265cd573d 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> | 4 | * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> |
| 5 | * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> | 5 | * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> |
| 6 | * Copyright 2013-2014 Intel Mobile Communications GmbH | 6 | * Copyright 2013-2014 Intel Mobile Communications GmbH |
| 7 | * Copyright (C) 2018 Intel Corporation | ||
| 7 | * | 8 | * |
| 8 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License version 2 as | 10 | * it under the terms of the GNU General Public License version 2 as |
| @@ -1135,7 +1136,7 @@ static bool ieee80211_tx_prep_agg(struct ieee80211_tx_data *tx, | |||
| 1135 | } | 1136 | } |
| 1136 | 1137 | ||
| 1137 | /* reset session timer */ | 1138 | /* reset session timer */ |
| 1138 | if (reset_agg_timer && tid_tx->timeout) | 1139 | if (reset_agg_timer) |
| 1139 | tid_tx->last_tx = jiffies; | 1140 | tid_tx->last_tx = jiffies; |
| 1140 | 1141 | ||
| 1141 | return queued; | 1142 | return queued; |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 55342c4d5cec..2e2dd88fc79f 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
| @@ -2606,13 +2606,13 @@ static int netlink_seq_show(struct seq_file *seq, void *v) | |||
| 2606 | { | 2606 | { |
| 2607 | if (v == SEQ_START_TOKEN) { | 2607 | if (v == SEQ_START_TOKEN) { |
| 2608 | seq_puts(seq, | 2608 | seq_puts(seq, |
| 2609 | "sk Eth Pid Groups " | 2609 | "sk Eth Pid Groups " |
| 2610 | "Rmem Wmem Dump Locks Drops Inode\n"); | 2610 | "Rmem Wmem Dump Locks Drops Inode\n"); |
| 2611 | } else { | 2611 | } else { |
| 2612 | struct sock *s = v; | 2612 | struct sock *s = v; |
| 2613 | struct netlink_sock *nlk = nlk_sk(s); | 2613 | struct netlink_sock *nlk = nlk_sk(s); |
| 2614 | 2614 | ||
| 2615 | seq_printf(seq, "%pK %-3d %-6u %08x %-8d %-8d %d %-8d %-8d %-8lu\n", | 2615 | seq_printf(seq, "%pK %-3d %-10u %08x %-8d %-8d %-5d %-8d %-8d %-8lu\n", |
| 2616 | s, | 2616 | s, |
| 2617 | s->sk_protocol, | 2617 | s->sk_protocol, |
| 2618 | nlk->portid, | 2618 | nlk->portid, |
diff --git a/net/nsh/nsh.c b/net/nsh/nsh.c index d7da99a0b0b8..9696ef96b719 100644 --- a/net/nsh/nsh.c +++ b/net/nsh/nsh.c | |||
| @@ -57,6 +57,8 @@ int nsh_pop(struct sk_buff *skb) | |||
| 57 | return -ENOMEM; | 57 | return -ENOMEM; |
| 58 | nh = (struct nshhdr *)(skb->data); | 58 | nh = (struct nshhdr *)(skb->data); |
| 59 | length = nsh_hdr_len(nh); | 59 | length = nsh_hdr_len(nh); |
| 60 | if (length < NSH_BASE_HDR_LEN) | ||
| 61 | return -EINVAL; | ||
| 60 | inner_proto = tun_p_to_eth_p(nh->np); | 62 | inner_proto = tun_p_to_eth_p(nh->np); |
| 61 | if (!pskb_may_pull(skb, length)) | 63 | if (!pskb_may_pull(skb, length)) |
| 62 | return -ENOMEM; | 64 | return -ENOMEM; |
| @@ -90,6 +92,8 @@ static struct sk_buff *nsh_gso_segment(struct sk_buff *skb, | |||
| 90 | if (unlikely(!pskb_may_pull(skb, NSH_BASE_HDR_LEN))) | 92 | if (unlikely(!pskb_may_pull(skb, NSH_BASE_HDR_LEN))) |
| 91 | goto out; | 93 | goto out; |
| 92 | nsh_len = nsh_hdr_len(nsh_hdr(skb)); | 94 | nsh_len = nsh_hdr_len(nsh_hdr(skb)); |
| 95 | if (nsh_len < NSH_BASE_HDR_LEN) | ||
| 96 | goto out; | ||
| 93 | if (unlikely(!pskb_may_pull(skb, nsh_len))) | 97 | if (unlikely(!pskb_may_pull(skb, nsh_len))) |
| 94 | goto out; | 98 | goto out; |
| 95 | 99 | ||
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c index 7322aa1e382e..492ab0c36f7c 100644 --- a/net/openvswitch/flow_netlink.c +++ b/net/openvswitch/flow_netlink.c | |||
| @@ -1712,13 +1712,10 @@ static void nlattr_set(struct nlattr *attr, u8 val, | |||
| 1712 | 1712 | ||
| 1713 | /* The nlattr stream should already have been validated */ | 1713 | /* The nlattr stream should already have been validated */ |
| 1714 | nla_for_each_nested(nla, attr, rem) { | 1714 | nla_for_each_nested(nla, attr, rem) { |
| 1715 | if (tbl[nla_type(nla)].len == OVS_ATTR_NESTED) { | 1715 | if (tbl[nla_type(nla)].len == OVS_ATTR_NESTED) |
| 1716 | if (tbl[nla_type(nla)].next) | 1716 | nlattr_set(nla, val, tbl[nla_type(nla)].next ? : tbl); |
| 1717 | tbl = tbl[nla_type(nla)].next; | 1717 | else |
| 1718 | nlattr_set(nla, val, tbl); | ||
| 1719 | } else { | ||
| 1720 | memset(nla_data(nla), val, nla_len(nla)); | 1718 | memset(nla_data(nla), val, nla_len(nla)); |
| 1721 | } | ||
| 1722 | 1719 | ||
| 1723 | if (nla_type(nla) == OVS_KEY_ATTR_CT_STATE) | 1720 | if (nla_type(nla) == OVS_KEY_ATTR_CT_STATE) |
| 1724 | *(u32 *)nla_data(nla) &= CT_SUPPORTED_MASK; | 1721 | *(u32 *)nla_data(nla) &= CT_SUPPORTED_MASK; |
diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c index 41bd496531d4..00192a996be0 100644 --- a/net/rfkill/rfkill-gpio.c +++ b/net/rfkill/rfkill-gpio.c | |||
| @@ -137,13 +137,18 @@ static int rfkill_gpio_probe(struct platform_device *pdev) | |||
| 137 | 137 | ||
| 138 | ret = rfkill_register(rfkill->rfkill_dev); | 138 | ret = rfkill_register(rfkill->rfkill_dev); |
| 139 | if (ret < 0) | 139 | if (ret < 0) |
| 140 | return ret; | 140 | goto err_destroy; |
| 141 | 141 | ||
| 142 | platform_set_drvdata(pdev, rfkill); | 142 | platform_set_drvdata(pdev, rfkill); |
| 143 | 143 | ||
| 144 | dev_info(&pdev->dev, "%s device registered.\n", rfkill->name); | 144 | dev_info(&pdev->dev, "%s device registered.\n", rfkill->name); |
| 145 | 145 | ||
| 146 | return 0; | 146 | return 0; |
| 147 | |||
| 148 | err_destroy: | ||
| 149 | rfkill_destroy(rfkill->rfkill_dev); | ||
| 150 | |||
| 151 | return ret; | ||
| 147 | } | 152 | } |
| 148 | 153 | ||
| 149 | static int rfkill_gpio_remove(struct platform_device *pdev) | 154 | static int rfkill_gpio_remove(struct platform_device *pdev) |
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c index 9a2c8e7c000e..2b463047dd7b 100644 --- a/net/rxrpc/af_rxrpc.c +++ b/net/rxrpc/af_rxrpc.c | |||
| @@ -313,7 +313,7 @@ struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *sock, | |||
| 313 | memset(&cp, 0, sizeof(cp)); | 313 | memset(&cp, 0, sizeof(cp)); |
| 314 | cp.local = rx->local; | 314 | cp.local = rx->local; |
| 315 | cp.key = key; | 315 | cp.key = key; |
| 316 | cp.security_level = 0; | 316 | cp.security_level = rx->min_sec_level; |
| 317 | cp.exclusive = false; | 317 | cp.exclusive = false; |
| 318 | cp.upgrade = upgrade; | 318 | cp.upgrade = upgrade; |
| 319 | cp.service_id = srx->srx_service; | 319 | cp.service_id = srx->srx_service; |
diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h index 90d7079e0aa9..19975d2ca9a2 100644 --- a/net/rxrpc/ar-internal.h +++ b/net/rxrpc/ar-internal.h | |||
| @@ -476,6 +476,7 @@ enum rxrpc_call_flag { | |||
| 476 | RXRPC_CALL_SEND_PING, /* A ping will need to be sent */ | 476 | RXRPC_CALL_SEND_PING, /* A ping will need to be sent */ |
| 477 | RXRPC_CALL_PINGING, /* Ping in process */ | 477 | RXRPC_CALL_PINGING, /* Ping in process */ |
| 478 | RXRPC_CALL_RETRANS_TIMEOUT, /* Retransmission due to timeout occurred */ | 478 | RXRPC_CALL_RETRANS_TIMEOUT, /* Retransmission due to timeout occurred */ |
| 479 | RXRPC_CALL_BEGAN_RX_TIMER, /* We began the expect_rx_by timer */ | ||
| 479 | }; | 480 | }; |
| 480 | 481 | ||
| 481 | /* | 482 | /* |
diff --git a/net/rxrpc/conn_event.c b/net/rxrpc/conn_event.c index c717152070df..1350f1be8037 100644 --- a/net/rxrpc/conn_event.c +++ b/net/rxrpc/conn_event.c | |||
| @@ -40,7 +40,7 @@ static void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn, | |||
| 40 | } __attribute__((packed)) pkt; | 40 | } __attribute__((packed)) pkt; |
| 41 | struct rxrpc_ackinfo ack_info; | 41 | struct rxrpc_ackinfo ack_info; |
| 42 | size_t len; | 42 | size_t len; |
| 43 | int ioc; | 43 | int ret, ioc; |
| 44 | u32 serial, mtu, call_id, padding; | 44 | u32 serial, mtu, call_id, padding; |
| 45 | 45 | ||
| 46 | _enter("%d", conn->debug_id); | 46 | _enter("%d", conn->debug_id); |
| @@ -135,10 +135,13 @@ static void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn, | |||
| 135 | break; | 135 | break; |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | kernel_sendmsg(conn->params.local->socket, &msg, iov, ioc, len); | 138 | ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, ioc, len); |
| 139 | conn->params.peer->last_tx_at = ktime_get_real(); | 139 | conn->params.peer->last_tx_at = ktime_get_real(); |
| 140 | if (ret < 0) | ||
| 141 | trace_rxrpc_tx_fail(conn->debug_id, serial, ret, | ||
| 142 | rxrpc_tx_fail_call_final_resend); | ||
| 143 | |||
| 140 | _leave(""); | 144 | _leave(""); |
| 141 | return; | ||
| 142 | } | 145 | } |
| 143 | 146 | ||
| 144 | /* | 147 | /* |
| @@ -236,6 +239,8 @@ static int rxrpc_abort_connection(struct rxrpc_connection *conn, | |||
| 236 | 239 | ||
| 237 | ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len); | 240 | ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len); |
| 238 | if (ret < 0) { | 241 | if (ret < 0) { |
| 242 | trace_rxrpc_tx_fail(conn->debug_id, serial, ret, | ||
| 243 | rxrpc_tx_fail_conn_abort); | ||
| 239 | _debug("sendmsg failed: %d", ret); | 244 | _debug("sendmsg failed: %d", ret); |
| 240 | return -EAGAIN; | 245 | return -EAGAIN; |
| 241 | } | 246 | } |
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c index 0410d2277ca2..b5fd6381313d 100644 --- a/net/rxrpc/input.c +++ b/net/rxrpc/input.c | |||
| @@ -971,7 +971,7 @@ static void rxrpc_input_call_packet(struct rxrpc_call *call, | |||
| 971 | if (timo) { | 971 | if (timo) { |
| 972 | unsigned long now = jiffies, expect_rx_by; | 972 | unsigned long now = jiffies, expect_rx_by; |
| 973 | 973 | ||
| 974 | expect_rx_by = jiffies + timo; | 974 | expect_rx_by = now + timo; |
| 975 | WRITE_ONCE(call->expect_rx_by, expect_rx_by); | 975 | WRITE_ONCE(call->expect_rx_by, expect_rx_by); |
| 976 | rxrpc_reduce_call_timer(call, expect_rx_by, now, | 976 | rxrpc_reduce_call_timer(call, expect_rx_by, now, |
| 977 | rxrpc_timer_set_for_normal); | 977 | rxrpc_timer_set_for_normal); |
diff --git a/net/rxrpc/local_event.c b/net/rxrpc/local_event.c index 93b5d910b4a1..8325f1b86840 100644 --- a/net/rxrpc/local_event.c +++ b/net/rxrpc/local_event.c | |||
| @@ -71,7 +71,8 @@ static void rxrpc_send_version_request(struct rxrpc_local *local, | |||
| 71 | 71 | ||
| 72 | ret = kernel_sendmsg(local->socket, &msg, iov, 2, len); | 72 | ret = kernel_sendmsg(local->socket, &msg, iov, 2, len); |
| 73 | if (ret < 0) | 73 | if (ret < 0) |
| 74 | _debug("sendmsg failed: %d", ret); | 74 | trace_rxrpc_tx_fail(local->debug_id, 0, ret, |
| 75 | rxrpc_tx_fail_version_reply); | ||
| 75 | 76 | ||
| 76 | _leave(""); | 77 | _leave(""); |
| 77 | } | 78 | } |
diff --git a/net/rxrpc/local_object.c b/net/rxrpc/local_object.c index 8b54e9531d52..b493e6b62740 100644 --- a/net/rxrpc/local_object.c +++ b/net/rxrpc/local_object.c | |||
| @@ -134,22 +134,49 @@ static int rxrpc_open_socket(struct rxrpc_local *local, struct net *net) | |||
| 134 | } | 134 | } |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | /* we want to receive ICMP errors */ | 137 | switch (local->srx.transport.family) { |
| 138 | opt = 1; | 138 | case AF_INET: |
| 139 | ret = kernel_setsockopt(local->socket, SOL_IP, IP_RECVERR, | 139 | /* we want to receive ICMP errors */ |
| 140 | (char *) &opt, sizeof(opt)); | 140 | opt = 1; |
| 141 | if (ret < 0) { | 141 | ret = kernel_setsockopt(local->socket, SOL_IP, IP_RECVERR, |
| 142 | _debug("setsockopt failed"); | 142 | (char *) &opt, sizeof(opt)); |
| 143 | goto error; | 143 | if (ret < 0) { |
| 144 | } | 144 | _debug("setsockopt failed"); |
| 145 | goto error; | ||
| 146 | } | ||
| 145 | 147 | ||
| 146 | /* we want to set the don't fragment bit */ | 148 | /* we want to set the don't fragment bit */ |
| 147 | opt = IP_PMTUDISC_DO; | 149 | opt = IP_PMTUDISC_DO; |
| 148 | ret = kernel_setsockopt(local->socket, SOL_IP, IP_MTU_DISCOVER, | 150 | ret = kernel_setsockopt(local->socket, SOL_IP, IP_MTU_DISCOVER, |
| 149 | (char *) &opt, sizeof(opt)); | 151 | (char *) &opt, sizeof(opt)); |
| 150 | if (ret < 0) { | 152 | if (ret < 0) { |
| 151 | _debug("setsockopt failed"); | 153 | _debug("setsockopt failed"); |
| 152 | goto error; | 154 | goto error; |
| 155 | } | ||
| 156 | break; | ||
| 157 | |||
| 158 | case AF_INET6: | ||
| 159 | /* we want to receive ICMP errors */ | ||
| 160 | opt = 1; | ||
| 161 | ret = kernel_setsockopt(local->socket, SOL_IPV6, IPV6_RECVERR, | ||
| 162 | (char *) &opt, sizeof(opt)); | ||
| 163 | if (ret < 0) { | ||
| 164 | _debug("setsockopt failed"); | ||
| 165 | goto error; | ||
| 166 | } | ||
| 167 | |||
| 168 | /* we want to set the don't fragment bit */ | ||
| 169 | opt = IPV6_PMTUDISC_DO; | ||
| 170 | ret = kernel_setsockopt(local->socket, SOL_IPV6, IPV6_MTU_DISCOVER, | ||
| 171 | (char *) &opt, sizeof(opt)); | ||
| 172 | if (ret < 0) { | ||
| 173 | _debug("setsockopt failed"); | ||
| 174 | goto error; | ||
| 175 | } | ||
| 176 | break; | ||
| 177 | |||
| 178 | default: | ||
| 179 | BUG(); | ||
| 153 | } | 180 | } |
| 154 | 181 | ||
| 155 | /* set the socket up */ | 182 | /* set the socket up */ |
diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c index 7f1fc04775b3..f03de1c59ba3 100644 --- a/net/rxrpc/output.c +++ b/net/rxrpc/output.c | |||
| @@ -210,6 +210,9 @@ int rxrpc_send_ack_packet(struct rxrpc_call *call, bool ping, | |||
| 210 | if (ping) | 210 | if (ping) |
| 211 | call->ping_time = now; | 211 | call->ping_time = now; |
| 212 | conn->params.peer->last_tx_at = ktime_get_real(); | 212 | conn->params.peer->last_tx_at = ktime_get_real(); |
| 213 | if (ret < 0) | ||
| 214 | trace_rxrpc_tx_fail(call->debug_id, serial, ret, | ||
| 215 | rxrpc_tx_fail_call_ack); | ||
| 213 | 216 | ||
| 214 | if (call->state < RXRPC_CALL_COMPLETE) { | 217 | if (call->state < RXRPC_CALL_COMPLETE) { |
| 215 | if (ret < 0) { | 218 | if (ret < 0) { |
| @@ -294,6 +297,10 @@ int rxrpc_send_abort_packet(struct rxrpc_call *call) | |||
| 294 | ret = kernel_sendmsg(conn->params.local->socket, | 297 | ret = kernel_sendmsg(conn->params.local->socket, |
| 295 | &msg, iov, 1, sizeof(pkt)); | 298 | &msg, iov, 1, sizeof(pkt)); |
| 296 | conn->params.peer->last_tx_at = ktime_get_real(); | 299 | conn->params.peer->last_tx_at = ktime_get_real(); |
| 300 | if (ret < 0) | ||
| 301 | trace_rxrpc_tx_fail(call->debug_id, serial, ret, | ||
| 302 | rxrpc_tx_fail_call_abort); | ||
| 303 | |||
| 297 | 304 | ||
| 298 | rxrpc_put_connection(conn); | 305 | rxrpc_put_connection(conn); |
| 299 | return ret; | 306 | return ret; |
| @@ -387,6 +394,9 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb, | |||
| 387 | conn->params.peer->last_tx_at = ktime_get_real(); | 394 | conn->params.peer->last_tx_at = ktime_get_real(); |
| 388 | 395 | ||
| 389 | up_read(&conn->params.local->defrag_sem); | 396 | up_read(&conn->params.local->defrag_sem); |
| 397 | if (ret < 0) | ||
| 398 | trace_rxrpc_tx_fail(call->debug_id, serial, ret, | ||
| 399 | rxrpc_tx_fail_call_data_nofrag); | ||
| 390 | if (ret == -EMSGSIZE) | 400 | if (ret == -EMSGSIZE) |
| 391 | goto send_fragmentable; | 401 | goto send_fragmentable; |
| 392 | 402 | ||
| @@ -414,6 +424,17 @@ done: | |||
| 414 | rxrpc_timer_set_for_lost_ack); | 424 | rxrpc_timer_set_for_lost_ack); |
| 415 | } | 425 | } |
| 416 | } | 426 | } |
| 427 | |||
| 428 | if (sp->hdr.seq == 1 && | ||
| 429 | !test_and_set_bit(RXRPC_CALL_BEGAN_RX_TIMER, | ||
| 430 | &call->flags)) { | ||
| 431 | unsigned long nowj = jiffies, expect_rx_by; | ||
| 432 | |||
| 433 | expect_rx_by = nowj + call->next_rx_timo; | ||
| 434 | WRITE_ONCE(call->expect_rx_by, expect_rx_by); | ||
| 435 | rxrpc_reduce_call_timer(call, expect_rx_by, nowj, | ||
| 436 | rxrpc_timer_set_for_normal); | ||
| 437 | } | ||
| 417 | } | 438 | } |
| 418 | 439 | ||
| 419 | rxrpc_set_keepalive(call); | 440 | rxrpc_set_keepalive(call); |
| @@ -465,6 +486,10 @@ send_fragmentable: | |||
| 465 | #endif | 486 | #endif |
| 466 | } | 487 | } |
| 467 | 488 | ||
| 489 | if (ret < 0) | ||
| 490 | trace_rxrpc_tx_fail(call->debug_id, serial, ret, | ||
| 491 | rxrpc_tx_fail_call_data_frag); | ||
| 492 | |||
| 468 | up_write(&conn->params.local->defrag_sem); | 493 | up_write(&conn->params.local->defrag_sem); |
| 469 | goto done; | 494 | goto done; |
| 470 | } | 495 | } |
| @@ -482,6 +507,7 @@ void rxrpc_reject_packets(struct rxrpc_local *local) | |||
| 482 | struct kvec iov[2]; | 507 | struct kvec iov[2]; |
| 483 | size_t size; | 508 | size_t size; |
| 484 | __be32 code; | 509 | __be32 code; |
| 510 | int ret; | ||
| 485 | 511 | ||
| 486 | _enter("%d", local->debug_id); | 512 | _enter("%d", local->debug_id); |
| 487 | 513 | ||
| @@ -516,7 +542,10 @@ void rxrpc_reject_packets(struct rxrpc_local *local) | |||
| 516 | whdr.flags ^= RXRPC_CLIENT_INITIATED; | 542 | whdr.flags ^= RXRPC_CLIENT_INITIATED; |
| 517 | whdr.flags &= RXRPC_CLIENT_INITIATED; | 543 | whdr.flags &= RXRPC_CLIENT_INITIATED; |
| 518 | 544 | ||
| 519 | kernel_sendmsg(local->socket, &msg, iov, 2, size); | 545 | ret = kernel_sendmsg(local->socket, &msg, iov, 2, size); |
| 546 | if (ret < 0) | ||
| 547 | trace_rxrpc_tx_fail(local->debug_id, 0, ret, | ||
| 548 | rxrpc_tx_fail_reject); | ||
| 520 | } | 549 | } |
| 521 | 550 | ||
| 522 | rxrpc_free_skb(skb, rxrpc_skb_rx_freed); | 551 | rxrpc_free_skb(skb, rxrpc_skb_rx_freed); |
| @@ -567,7 +596,8 @@ void rxrpc_send_keepalive(struct rxrpc_peer *peer) | |||
| 567 | 596 | ||
| 568 | ret = kernel_sendmsg(peer->local->socket, &msg, iov, 2, len); | 597 | ret = kernel_sendmsg(peer->local->socket, &msg, iov, 2, len); |
| 569 | if (ret < 0) | 598 | if (ret < 0) |
| 570 | _debug("sendmsg failed: %d", ret); | 599 | trace_rxrpc_tx_fail(peer->debug_id, 0, ret, |
| 600 | rxrpc_tx_fail_version_keepalive); | ||
| 571 | 601 | ||
| 572 | peer->last_tx_at = ktime_get_real(); | 602 | peer->last_tx_at = ktime_get_real(); |
| 573 | _leave(""); | 603 | _leave(""); |
diff --git a/net/rxrpc/peer_event.c b/net/rxrpc/peer_event.c index 78c2f95d1f22..0ed8b651cec2 100644 --- a/net/rxrpc/peer_event.c +++ b/net/rxrpc/peer_event.c | |||
| @@ -28,39 +28,39 @@ static void rxrpc_store_error(struct rxrpc_peer *, struct sock_exterr_skb *); | |||
| 28 | * Find the peer associated with an ICMP packet. | 28 | * Find the peer associated with an ICMP packet. |
| 29 | */ | 29 | */ |
| 30 | static struct rxrpc_peer *rxrpc_lookup_peer_icmp_rcu(struct rxrpc_local *local, | 30 | static struct rxrpc_peer *rxrpc_lookup_peer_icmp_rcu(struct rxrpc_local *local, |
| 31 | const struct sk_buff *skb) | 31 | const struct sk_buff *skb, |
| 32 | struct sockaddr_rxrpc *srx) | ||
| 32 | { | 33 | { |
| 33 | struct sock_exterr_skb *serr = SKB_EXT_ERR(skb); | 34 | struct sock_exterr_skb *serr = SKB_EXT_ERR(skb); |
| 34 | struct sockaddr_rxrpc srx; | ||
| 35 | 35 | ||
| 36 | _enter(""); | 36 | _enter(""); |
| 37 | 37 | ||
| 38 | memset(&srx, 0, sizeof(srx)); | 38 | memset(srx, 0, sizeof(*srx)); |
| 39 | srx.transport_type = local->srx.transport_type; | 39 | srx->transport_type = local->srx.transport_type; |
| 40 | srx.transport_len = local->srx.transport_len; | 40 | srx->transport_len = local->srx.transport_len; |
| 41 | srx.transport.family = local->srx.transport.family; | 41 | srx->transport.family = local->srx.transport.family; |
| 42 | 42 | ||
| 43 | /* Can we see an ICMP4 packet on an ICMP6 listening socket? and vice | 43 | /* Can we see an ICMP4 packet on an ICMP6 listening socket? and vice |
| 44 | * versa? | 44 | * versa? |
| 45 | */ | 45 | */ |
| 46 | switch (srx.transport.family) { | 46 | switch (srx->transport.family) { |
| 47 | case AF_INET: | 47 | case AF_INET: |
| 48 | srx.transport.sin.sin_port = serr->port; | 48 | srx->transport.sin.sin_port = serr->port; |
| 49 | switch (serr->ee.ee_origin) { | 49 | switch (serr->ee.ee_origin) { |
| 50 | case SO_EE_ORIGIN_ICMP: | 50 | case SO_EE_ORIGIN_ICMP: |
| 51 | _net("Rx ICMP"); | 51 | _net("Rx ICMP"); |
| 52 | memcpy(&srx.transport.sin.sin_addr, | 52 | memcpy(&srx->transport.sin.sin_addr, |
| 53 | skb_network_header(skb) + serr->addr_offset, | 53 | skb_network_header(skb) + serr->addr_offset, |
| 54 | sizeof(struct in_addr)); | 54 | sizeof(struct in_addr)); |
| 55 | break; | 55 | break; |
| 56 | case SO_EE_ORIGIN_ICMP6: | 56 | case SO_EE_ORIGIN_ICMP6: |
| 57 | _net("Rx ICMP6 on v4 sock"); | 57 | _net("Rx ICMP6 on v4 sock"); |
| 58 | memcpy(&srx.transport.sin.sin_addr, | 58 | memcpy(&srx->transport.sin.sin_addr, |
| 59 | skb_network_header(skb) + serr->addr_offset + 12, | 59 | skb_network_header(skb) + serr->addr_offset + 12, |
| 60 | sizeof(struct in_addr)); | 60 | sizeof(struct in_addr)); |
| 61 | break; | 61 | break; |
| 62 | default: | 62 | default: |
| 63 | memcpy(&srx.transport.sin.sin_addr, &ip_hdr(skb)->saddr, | 63 | memcpy(&srx->transport.sin.sin_addr, &ip_hdr(skb)->saddr, |
| 64 | sizeof(struct in_addr)); | 64 | sizeof(struct in_addr)); |
| 65 | break; | 65 | break; |
| 66 | } | 66 | } |
| @@ -68,25 +68,25 @@ static struct rxrpc_peer *rxrpc_lookup_peer_icmp_rcu(struct rxrpc_local *local, | |||
| 68 | 68 | ||
| 69 | #ifdef CONFIG_AF_RXRPC_IPV6 | 69 | #ifdef CONFIG_AF_RXRPC_IPV6 |
| 70 | case AF_INET6: | 70 | case AF_INET6: |
| 71 | srx.transport.sin6.sin6_port = serr->port; | 71 | srx->transport.sin6.sin6_port = serr->port; |
| 72 | switch (serr->ee.ee_origin) { | 72 | switch (serr->ee.ee_origin) { |
| 73 | case SO_EE_ORIGIN_ICMP6: | 73 | case SO_EE_ORIGIN_ICMP6: |
| 74 | _net("Rx ICMP6"); | 74 | _net("Rx ICMP6"); |
| 75 | memcpy(&srx.transport.sin6.sin6_addr, | 75 | memcpy(&srx->transport.sin6.sin6_addr, |
| 76 | skb_network_header(skb) + serr->addr_offset, | 76 | skb_network_header(skb) + serr->addr_offset, |
| 77 | sizeof(struct in6_addr)); | 77 | sizeof(struct in6_addr)); |
| 78 | break; | 78 | break; |
| 79 | case SO_EE_ORIGIN_ICMP: | 79 | case SO_EE_ORIGIN_ICMP: |
| 80 | _net("Rx ICMP on v6 sock"); | 80 | _net("Rx ICMP on v6 sock"); |
| 81 | srx.transport.sin6.sin6_addr.s6_addr32[0] = 0; | 81 | srx->transport.sin6.sin6_addr.s6_addr32[0] = 0; |
| 82 | srx.transport.sin6.sin6_addr.s6_addr32[1] = 0; | 82 | srx->transport.sin6.sin6_addr.s6_addr32[1] = 0; |
| 83 | srx.transport.sin6.sin6_addr.s6_addr32[2] = htonl(0xffff); | 83 | srx->transport.sin6.sin6_addr.s6_addr32[2] = htonl(0xffff); |
| 84 | memcpy(srx.transport.sin6.sin6_addr.s6_addr + 12, | 84 | memcpy(srx->transport.sin6.sin6_addr.s6_addr + 12, |
| 85 | skb_network_header(skb) + serr->addr_offset, | 85 | skb_network_header(skb) + serr->addr_offset, |
| 86 | sizeof(struct in_addr)); | 86 | sizeof(struct in_addr)); |
| 87 | break; | 87 | break; |
| 88 | default: | 88 | default: |
| 89 | memcpy(&srx.transport.sin6.sin6_addr, | 89 | memcpy(&srx->transport.sin6.sin6_addr, |
| 90 | &ipv6_hdr(skb)->saddr, | 90 | &ipv6_hdr(skb)->saddr, |
| 91 | sizeof(struct in6_addr)); | 91 | sizeof(struct in6_addr)); |
| 92 | break; | 92 | break; |
| @@ -98,7 +98,7 @@ static struct rxrpc_peer *rxrpc_lookup_peer_icmp_rcu(struct rxrpc_local *local, | |||
| 98 | BUG(); | 98 | BUG(); |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | return rxrpc_lookup_peer_rcu(local, &srx); | 101 | return rxrpc_lookup_peer_rcu(local, srx); |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | /* | 104 | /* |
| @@ -146,6 +146,7 @@ static void rxrpc_adjust_mtu(struct rxrpc_peer *peer, struct sock_exterr_skb *se | |||
| 146 | void rxrpc_error_report(struct sock *sk) | 146 | void rxrpc_error_report(struct sock *sk) |
| 147 | { | 147 | { |
| 148 | struct sock_exterr_skb *serr; | 148 | struct sock_exterr_skb *serr; |
| 149 | struct sockaddr_rxrpc srx; | ||
| 149 | struct rxrpc_local *local = sk->sk_user_data; | 150 | struct rxrpc_local *local = sk->sk_user_data; |
| 150 | struct rxrpc_peer *peer; | 151 | struct rxrpc_peer *peer; |
| 151 | struct sk_buff *skb; | 152 | struct sk_buff *skb; |
| @@ -166,7 +167,7 @@ void rxrpc_error_report(struct sock *sk) | |||
| 166 | } | 167 | } |
| 167 | 168 | ||
| 168 | rcu_read_lock(); | 169 | rcu_read_lock(); |
| 169 | peer = rxrpc_lookup_peer_icmp_rcu(local, skb); | 170 | peer = rxrpc_lookup_peer_icmp_rcu(local, skb, &srx); |
| 170 | if (peer && !rxrpc_get_peer_maybe(peer)) | 171 | if (peer && !rxrpc_get_peer_maybe(peer)) |
| 171 | peer = NULL; | 172 | peer = NULL; |
| 172 | if (!peer) { | 173 | if (!peer) { |
| @@ -176,6 +177,8 @@ void rxrpc_error_report(struct sock *sk) | |||
| 176 | return; | 177 | return; |
| 177 | } | 178 | } |
| 178 | 179 | ||
| 180 | trace_rxrpc_rx_icmp(peer, &serr->ee, &srx); | ||
| 181 | |||
| 179 | if ((serr->ee.ee_origin == SO_EE_ORIGIN_ICMP && | 182 | if ((serr->ee.ee_origin == SO_EE_ORIGIN_ICMP && |
| 180 | serr->ee.ee_type == ICMP_DEST_UNREACH && | 183 | serr->ee.ee_type == ICMP_DEST_UNREACH && |
| 181 | serr->ee.ee_code == ICMP_FRAG_NEEDED)) { | 184 | serr->ee.ee_code == ICMP_FRAG_NEEDED)) { |
| @@ -209,9 +212,6 @@ static void rxrpc_store_error(struct rxrpc_peer *peer, | |||
| 209 | 212 | ||
| 210 | ee = &serr->ee; | 213 | ee = &serr->ee; |
| 211 | 214 | ||
| 212 | _net("Rx Error o=%d t=%d c=%d e=%d", | ||
| 213 | ee->ee_origin, ee->ee_type, ee->ee_code, ee->ee_errno); | ||
| 214 | |||
| 215 | err = ee->ee_errno; | 215 | err = ee->ee_errno; |
| 216 | 216 | ||
| 217 | switch (ee->ee_origin) { | 217 | switch (ee->ee_origin) { |
diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c index 588fea0dd362..6c0ae27fff84 100644 --- a/net/rxrpc/rxkad.c +++ b/net/rxrpc/rxkad.c | |||
| @@ -664,7 +664,8 @@ static int rxkad_issue_challenge(struct rxrpc_connection *conn) | |||
| 664 | 664 | ||
| 665 | ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len); | 665 | ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len); |
| 666 | if (ret < 0) { | 666 | if (ret < 0) { |
| 667 | _debug("sendmsg failed: %d", ret); | 667 | trace_rxrpc_tx_fail(conn->debug_id, serial, ret, |
| 668 | rxrpc_tx_fail_conn_challenge); | ||
| 668 | return -EAGAIN; | 669 | return -EAGAIN; |
| 669 | } | 670 | } |
| 670 | 671 | ||
| @@ -719,7 +720,8 @@ static int rxkad_send_response(struct rxrpc_connection *conn, | |||
| 719 | 720 | ||
| 720 | ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 3, len); | 721 | ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 3, len); |
| 721 | if (ret < 0) { | 722 | if (ret < 0) { |
| 722 | _debug("sendmsg failed: %d", ret); | 723 | trace_rxrpc_tx_fail(conn->debug_id, serial, ret, |
| 724 | rxrpc_tx_fail_conn_response); | ||
| 723 | return -EAGAIN; | 725 | return -EAGAIN; |
| 724 | } | 726 | } |
| 725 | 727 | ||
diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c index 206e802ccbdc..be01f9c5d963 100644 --- a/net/rxrpc/sendmsg.c +++ b/net/rxrpc/sendmsg.c | |||
| @@ -223,6 +223,15 @@ static void rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call, | |||
| 223 | 223 | ||
| 224 | ret = rxrpc_send_data_packet(call, skb, false); | 224 | ret = rxrpc_send_data_packet(call, skb, false); |
| 225 | if (ret < 0) { | 225 | if (ret < 0) { |
| 226 | switch (ret) { | ||
| 227 | case -ENETUNREACH: | ||
| 228 | case -EHOSTUNREACH: | ||
| 229 | case -ECONNREFUSED: | ||
| 230 | rxrpc_set_call_completion(call, | ||
| 231 | RXRPC_CALL_LOCAL_ERROR, | ||
| 232 | 0, ret); | ||
| 233 | goto out; | ||
| 234 | } | ||
| 226 | _debug("need instant resend %d", ret); | 235 | _debug("need instant resend %d", ret); |
| 227 | rxrpc_instant_resend(call, ix); | 236 | rxrpc_instant_resend(call, ix); |
| 228 | } else { | 237 | } else { |
| @@ -241,6 +250,7 @@ static void rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call, | |||
| 241 | rxrpc_timer_set_for_send); | 250 | rxrpc_timer_set_for_send); |
| 242 | } | 251 | } |
| 243 | 252 | ||
| 253 | out: | ||
| 244 | rxrpc_free_skb(skb, rxrpc_skb_tx_freed); | 254 | rxrpc_free_skb(skb, rxrpc_skb_tx_freed); |
| 245 | _leave(""); | 255 | _leave(""); |
| 246 | } | 256 | } |
diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c index ddf69fc01bdf..6138d1d71900 100644 --- a/net/sched/act_skbedit.c +++ b/net/sched/act_skbedit.c | |||
| @@ -121,7 +121,8 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla, | |||
| 121 | return 0; | 121 | return 0; |
| 122 | 122 | ||
| 123 | if (!flags) { | 123 | if (!flags) { |
| 124 | tcf_idr_release(*a, bind); | 124 | if (exists) |
| 125 | tcf_idr_release(*a, bind); | ||
| 125 | return -EINVAL; | 126 | return -EINVAL; |
| 126 | } | 127 | } |
| 127 | 128 | ||
diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c index bbcbdce732cc..ad050d7d4b46 100644 --- a/net/sched/act_skbmod.c +++ b/net/sched/act_skbmod.c | |||
| @@ -131,8 +131,11 @@ static int tcf_skbmod_init(struct net *net, struct nlattr *nla, | |||
| 131 | if (exists && bind) | 131 | if (exists && bind) |
| 132 | return 0; | 132 | return 0; |
| 133 | 133 | ||
| 134 | if (!lflags) | 134 | if (!lflags) { |
| 135 | if (exists) | ||
| 136 | tcf_idr_release(*a, bind); | ||
| 135 | return -EINVAL; | 137 | return -EINVAL; |
| 138 | } | ||
| 136 | 139 | ||
| 137 | if (!exists) { | 140 | if (!exists) { |
| 138 | ret = tcf_idr_create(tn, parm->index, est, a, | 141 | ret = tcf_idr_create(tn, parm->index, est, a, |
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index b66754f52a9f..963e4bf0aab8 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
| @@ -152,8 +152,8 @@ static struct tcf_proto *tcf_proto_create(const char *kind, u32 protocol, | |||
| 152 | NL_SET_ERR_MSG(extack, "TC classifier not found"); | 152 | NL_SET_ERR_MSG(extack, "TC classifier not found"); |
| 153 | err = -ENOENT; | 153 | err = -ENOENT; |
| 154 | } | 154 | } |
| 155 | goto errout; | ||
| 156 | #endif | 155 | #endif |
| 156 | goto errout; | ||
| 157 | } | 157 | } |
| 158 | tp->classify = tp->ops->classify; | 158 | tp->classify = tp->ops->classify; |
| 159 | tp->protocol = protocol; | 159 | tp->protocol = protocol; |
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index 837806dd5799..a47179da24e6 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c | |||
| @@ -1024,8 +1024,9 @@ static void sctp_assoc_bh_rcv(struct work_struct *work) | |||
| 1024 | struct sctp_endpoint *ep; | 1024 | struct sctp_endpoint *ep; |
| 1025 | struct sctp_chunk *chunk; | 1025 | struct sctp_chunk *chunk; |
| 1026 | struct sctp_inq *inqueue; | 1026 | struct sctp_inq *inqueue; |
| 1027 | int state; | 1027 | int first_time = 1; /* is this the first time through the loop */ |
| 1028 | int error = 0; | 1028 | int error = 0; |
| 1029 | int state; | ||
| 1029 | 1030 | ||
| 1030 | /* The association should be held so we should be safe. */ | 1031 | /* The association should be held so we should be safe. */ |
| 1031 | ep = asoc->ep; | 1032 | ep = asoc->ep; |
| @@ -1036,6 +1037,30 @@ static void sctp_assoc_bh_rcv(struct work_struct *work) | |||
| 1036 | state = asoc->state; | 1037 | state = asoc->state; |
| 1037 | subtype = SCTP_ST_CHUNK(chunk->chunk_hdr->type); | 1038 | subtype = SCTP_ST_CHUNK(chunk->chunk_hdr->type); |
| 1038 | 1039 | ||
| 1040 | /* If the first chunk in the packet is AUTH, do special | ||
| 1041 | * processing specified in Section 6.3 of SCTP-AUTH spec | ||
| 1042 | */ | ||
| 1043 | if (first_time && subtype.chunk == SCTP_CID_AUTH) { | ||
| 1044 | struct sctp_chunkhdr *next_hdr; | ||
| 1045 | |||
| 1046 | next_hdr = sctp_inq_peek(inqueue); | ||
| 1047 | if (!next_hdr) | ||
| 1048 | goto normal; | ||
| 1049 | |||
| 1050 | /* If the next chunk is COOKIE-ECHO, skip the AUTH | ||
| 1051 | * chunk while saving a pointer to it so we can do | ||
| 1052 | * Authentication later (during cookie-echo | ||
| 1053 | * processing). | ||
| 1054 | */ | ||
| 1055 | if (next_hdr->type == SCTP_CID_COOKIE_ECHO) { | ||
| 1056 | chunk->auth_chunk = skb_clone(chunk->skb, | ||
| 1057 | GFP_ATOMIC); | ||
| 1058 | chunk->auth = 1; | ||
| 1059 | continue; | ||
| 1060 | } | ||
| 1061 | } | ||
| 1062 | |||
| 1063 | normal: | ||
| 1039 | /* SCTP-AUTH, Section 6.3: | 1064 | /* SCTP-AUTH, Section 6.3: |
| 1040 | * The receiver has a list of chunk types which it expects | 1065 | * The receiver has a list of chunk types which it expects |
| 1041 | * to be received only after an AUTH-chunk. This list has | 1066 | * to be received only after an AUTH-chunk. This list has |
| @@ -1074,6 +1099,9 @@ static void sctp_assoc_bh_rcv(struct work_struct *work) | |||
| 1074 | /* If there is an error on chunk, discard this packet. */ | 1099 | /* If there is an error on chunk, discard this packet. */ |
| 1075 | if (error && chunk) | 1100 | if (error && chunk) |
| 1076 | chunk->pdiscard = 1; | 1101 | chunk->pdiscard = 1; |
| 1102 | |||
| 1103 | if (first_time) | ||
| 1104 | first_time = 0; | ||
| 1077 | } | 1105 | } |
| 1078 | sctp_association_put(asoc); | 1106 | sctp_association_put(asoc); |
| 1079 | } | 1107 | } |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 5a4fb1dc8400..e62addb60434 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
| @@ -1152,7 +1152,7 @@ struct sctp_chunk *sctp_make_violation_max_retrans( | |||
| 1152 | const struct sctp_association *asoc, | 1152 | const struct sctp_association *asoc, |
| 1153 | const struct sctp_chunk *chunk) | 1153 | const struct sctp_chunk *chunk) |
| 1154 | { | 1154 | { |
| 1155 | static const char error[] = "Association exceeded its max_retans count"; | 1155 | static const char error[] = "Association exceeded its max_retrans count"; |
| 1156 | size_t payload_len = sizeof(error) + sizeof(struct sctp_errhdr); | 1156 | size_t payload_len = sizeof(error) + sizeof(struct sctp_errhdr); |
| 1157 | struct sctp_chunk *retval; | 1157 | struct sctp_chunk *retval; |
| 1158 | 1158 | ||
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 28c070e187c2..c9ae3404b1bb 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
| @@ -153,10 +153,7 @@ static enum sctp_disposition sctp_sf_violation_chunk( | |||
| 153 | struct sctp_cmd_seq *commands); | 153 | struct sctp_cmd_seq *commands); |
| 154 | 154 | ||
| 155 | static enum sctp_ierror sctp_sf_authenticate( | 155 | static enum sctp_ierror sctp_sf_authenticate( |
| 156 | struct net *net, | ||
| 157 | const struct sctp_endpoint *ep, | ||
| 158 | const struct sctp_association *asoc, | 156 | const struct sctp_association *asoc, |
| 159 | const union sctp_subtype type, | ||
| 160 | struct sctp_chunk *chunk); | 157 | struct sctp_chunk *chunk); |
| 161 | 158 | ||
| 162 | static enum sctp_disposition __sctp_sf_do_9_1_abort( | 159 | static enum sctp_disposition __sctp_sf_do_9_1_abort( |
| @@ -626,6 +623,38 @@ enum sctp_disposition sctp_sf_do_5_1C_ack(struct net *net, | |||
| 626 | return SCTP_DISPOSITION_CONSUME; | 623 | return SCTP_DISPOSITION_CONSUME; |
| 627 | } | 624 | } |
| 628 | 625 | ||
| 626 | static bool sctp_auth_chunk_verify(struct net *net, struct sctp_chunk *chunk, | ||
| 627 | const struct sctp_association *asoc) | ||
| 628 | { | ||
| 629 | struct sctp_chunk auth; | ||
| 630 | |||
| 631 | if (!chunk->auth_chunk) | ||
| 632 | return true; | ||
| 633 | |||
| 634 | /* SCTP-AUTH: auth_chunk pointer is only set when the cookie-echo | ||
| 635 | * is supposed to be authenticated and we have to do delayed | ||
| 636 | * authentication. We've just recreated the association using | ||
| 637 | * the information in the cookie and now it's much easier to | ||
| 638 | * do the authentication. | ||
| 639 | */ | ||
| 640 | |||
| 641 | /* Make sure that we and the peer are AUTH capable */ | ||
| 642 | if (!net->sctp.auth_enable || !asoc->peer.auth_capable) | ||
| 643 | return false; | ||
| 644 | |||
| 645 | /* set-up our fake chunk so that we can process it */ | ||
| 646 | auth.skb = chunk->auth_chunk; | ||
| 647 | auth.asoc = chunk->asoc; | ||
| 648 | auth.sctp_hdr = chunk->sctp_hdr; | ||
| 649 | auth.chunk_hdr = (struct sctp_chunkhdr *) | ||
| 650 | skb_push(chunk->auth_chunk, | ||
| 651 | sizeof(struct sctp_chunkhdr)); | ||
| 652 | skb_pull(chunk->auth_chunk, sizeof(struct sctp_chunkhdr)); | ||
| 653 | auth.transport = chunk->transport; | ||
| 654 | |||
| 655 | return sctp_sf_authenticate(asoc, &auth) == SCTP_IERROR_NO_ERROR; | ||
| 656 | } | ||
| 657 | |||
| 629 | /* | 658 | /* |
| 630 | * Respond to a normal COOKIE ECHO chunk. | 659 | * Respond to a normal COOKIE ECHO chunk. |
| 631 | * We are the side that is being asked for an association. | 660 | * We are the side that is being asked for an association. |
| @@ -763,37 +792,9 @@ enum sctp_disposition sctp_sf_do_5_1D_ce(struct net *net, | |||
| 763 | if (error) | 792 | if (error) |
| 764 | goto nomem_init; | 793 | goto nomem_init; |
| 765 | 794 | ||
| 766 | /* SCTP-AUTH: auth_chunk pointer is only set when the cookie-echo | 795 | if (!sctp_auth_chunk_verify(net, chunk, new_asoc)) { |
| 767 | * is supposed to be authenticated and we have to do delayed | 796 | sctp_association_free(new_asoc); |
| 768 | * authentication. We've just recreated the association using | 797 | return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); |
| 769 | * the information in the cookie and now it's much easier to | ||
| 770 | * do the authentication. | ||
| 771 | */ | ||
| 772 | if (chunk->auth_chunk) { | ||
| 773 | struct sctp_chunk auth; | ||
| 774 | enum sctp_ierror ret; | ||
| 775 | |||
| 776 | /* Make sure that we and the peer are AUTH capable */ | ||
| 777 | if (!net->sctp.auth_enable || !new_asoc->peer.auth_capable) { | ||
| 778 | sctp_association_free(new_asoc); | ||
| 779 | return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); | ||
| 780 | } | ||
| 781 | |||
| 782 | /* set-up our fake chunk so that we can process it */ | ||
| 783 | auth.skb = chunk->auth_chunk; | ||
| 784 | auth.asoc = chunk->asoc; | ||
| 785 | auth.sctp_hdr = chunk->sctp_hdr; | ||
| 786 | auth.chunk_hdr = (struct sctp_chunkhdr *) | ||
| 787 | skb_push(chunk->auth_chunk, | ||
| 788 | sizeof(struct sctp_chunkhdr)); | ||
| 789 | skb_pull(chunk->auth_chunk, sizeof(struct sctp_chunkhdr)); | ||
| 790 | auth.transport = chunk->transport; | ||
| 791 | |||
| 792 | ret = sctp_sf_authenticate(net, ep, new_asoc, type, &auth); | ||
| 793 | if (ret != SCTP_IERROR_NO_ERROR) { | ||
| 794 | sctp_association_free(new_asoc); | ||
| 795 | return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); | ||
| 796 | } | ||
| 797 | } | 798 | } |
| 798 | 799 | ||
| 799 | repl = sctp_make_cookie_ack(new_asoc, chunk); | 800 | repl = sctp_make_cookie_ack(new_asoc, chunk); |
| @@ -1797,13 +1798,15 @@ static enum sctp_disposition sctp_sf_do_dupcook_a( | |||
| 1797 | if (sctp_auth_asoc_init_active_key(new_asoc, GFP_ATOMIC)) | 1798 | if (sctp_auth_asoc_init_active_key(new_asoc, GFP_ATOMIC)) |
| 1798 | goto nomem; | 1799 | goto nomem; |
| 1799 | 1800 | ||
| 1801 | if (!sctp_auth_chunk_verify(net, chunk, new_asoc)) | ||
| 1802 | return SCTP_DISPOSITION_DISCARD; | ||
| 1803 | |||
| 1800 | /* Make sure no new addresses are being added during the | 1804 | /* Make sure no new addresses are being added during the |
| 1801 | * restart. Though this is a pretty complicated attack | 1805 | * restart. Though this is a pretty complicated attack |
| 1802 | * since you'd have to get inside the cookie. | 1806 | * since you'd have to get inside the cookie. |
| 1803 | */ | 1807 | */ |
| 1804 | if (!sctp_sf_check_restart_addrs(new_asoc, asoc, chunk, commands)) { | 1808 | if (!sctp_sf_check_restart_addrs(new_asoc, asoc, chunk, commands)) |
| 1805 | return SCTP_DISPOSITION_CONSUME; | 1809 | return SCTP_DISPOSITION_CONSUME; |
| 1806 | } | ||
| 1807 | 1810 | ||
| 1808 | /* If the endpoint is in the SHUTDOWN-ACK-SENT state and recognizes | 1811 | /* If the endpoint is in the SHUTDOWN-ACK-SENT state and recognizes |
| 1809 | * the peer has restarted (Action A), it MUST NOT setup a new | 1812 | * the peer has restarted (Action A), it MUST NOT setup a new |
| @@ -1912,6 +1915,9 @@ static enum sctp_disposition sctp_sf_do_dupcook_b( | |||
| 1912 | if (sctp_auth_asoc_init_active_key(new_asoc, GFP_ATOMIC)) | 1915 | if (sctp_auth_asoc_init_active_key(new_asoc, GFP_ATOMIC)) |
| 1913 | goto nomem; | 1916 | goto nomem; |
| 1914 | 1917 | ||
| 1918 | if (!sctp_auth_chunk_verify(net, chunk, new_asoc)) | ||
| 1919 | return SCTP_DISPOSITION_DISCARD; | ||
| 1920 | |||
| 1915 | /* Update the content of current association. */ | 1921 | /* Update the content of current association. */ |
| 1916 | sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_ASSOC, SCTP_ASOC(new_asoc)); | 1922 | sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_ASSOC, SCTP_ASOC(new_asoc)); |
| 1917 | sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, | 1923 | sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, |
| @@ -2009,6 +2015,9 @@ static enum sctp_disposition sctp_sf_do_dupcook_d( | |||
| 2009 | * a COOKIE ACK. | 2015 | * a COOKIE ACK. |
| 2010 | */ | 2016 | */ |
| 2011 | 2017 | ||
| 2018 | if (!sctp_auth_chunk_verify(net, chunk, asoc)) | ||
| 2019 | return SCTP_DISPOSITION_DISCARD; | ||
| 2020 | |||
| 2012 | /* Don't accidentally move back into established state. */ | 2021 | /* Don't accidentally move back into established state. */ |
| 2013 | if (asoc->state < SCTP_STATE_ESTABLISHED) { | 2022 | if (asoc->state < SCTP_STATE_ESTABLISHED) { |
| 2014 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, | 2023 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, |
| @@ -4171,10 +4180,7 @@ gen_shutdown: | |||
| 4171 | * The return value is the disposition of the chunk. | 4180 | * The return value is the disposition of the chunk. |
| 4172 | */ | 4181 | */ |
| 4173 | static enum sctp_ierror sctp_sf_authenticate( | 4182 | static enum sctp_ierror sctp_sf_authenticate( |
| 4174 | struct net *net, | ||
| 4175 | const struct sctp_endpoint *ep, | ||
| 4176 | const struct sctp_association *asoc, | 4183 | const struct sctp_association *asoc, |
| 4177 | const union sctp_subtype type, | ||
| 4178 | struct sctp_chunk *chunk) | 4184 | struct sctp_chunk *chunk) |
| 4179 | { | 4185 | { |
| 4180 | struct sctp_shared_key *sh_key = NULL; | 4186 | struct sctp_shared_key *sh_key = NULL; |
| @@ -4275,7 +4281,7 @@ enum sctp_disposition sctp_sf_eat_auth(struct net *net, | |||
| 4275 | commands); | 4281 | commands); |
| 4276 | 4282 | ||
| 4277 | auth_hdr = (struct sctp_authhdr *)chunk->skb->data; | 4283 | auth_hdr = (struct sctp_authhdr *)chunk->skb->data; |
| 4278 | error = sctp_sf_authenticate(net, ep, asoc, type, chunk); | 4284 | error = sctp_sf_authenticate(asoc, chunk); |
| 4279 | switch (error) { | 4285 | switch (error) { |
| 4280 | case SCTP_IERROR_AUTH_BAD_HMAC: | 4286 | case SCTP_IERROR_AUTH_BAD_HMAC: |
| 4281 | /* Generate the ERROR chunk and discard the rest | 4287 | /* Generate the ERROR chunk and discard the rest |
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c index 84207ad33e8e..8cb7d9858270 100644 --- a/net/sctp/ulpevent.c +++ b/net/sctp/ulpevent.c | |||
| @@ -715,7 +715,6 @@ struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc, | |||
| 715 | return event; | 715 | return event; |
| 716 | 716 | ||
| 717 | fail_mark: | 717 | fail_mark: |
| 718 | sctp_chunk_put(chunk); | ||
| 719 | kfree_skb(skb); | 718 | kfree_skb(skb); |
| 720 | fail: | 719 | fail: |
| 721 | return NULL; | 720 | return NULL; |
diff --git a/net/tipc/node.c b/net/tipc/node.c index baaf93f12cbd..f29549de9245 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
| @@ -1950,6 +1950,7 @@ out: | |||
| 1950 | int tipc_nl_node_get_link(struct sk_buff *skb, struct genl_info *info) | 1950 | int tipc_nl_node_get_link(struct sk_buff *skb, struct genl_info *info) |
| 1951 | { | 1951 | { |
| 1952 | struct net *net = genl_info_net(info); | 1952 | struct net *net = genl_info_net(info); |
| 1953 | struct nlattr *attrs[TIPC_NLA_LINK_MAX + 1]; | ||
| 1953 | struct tipc_nl_msg msg; | 1954 | struct tipc_nl_msg msg; |
| 1954 | char *name; | 1955 | char *name; |
| 1955 | int err; | 1956 | int err; |
| @@ -1957,9 +1958,19 @@ int tipc_nl_node_get_link(struct sk_buff *skb, struct genl_info *info) | |||
| 1957 | msg.portid = info->snd_portid; | 1958 | msg.portid = info->snd_portid; |
| 1958 | msg.seq = info->snd_seq; | 1959 | msg.seq = info->snd_seq; |
| 1959 | 1960 | ||
| 1960 | if (!info->attrs[TIPC_NLA_LINK_NAME]) | 1961 | if (!info->attrs[TIPC_NLA_LINK]) |
| 1961 | return -EINVAL; | 1962 | return -EINVAL; |
| 1962 | name = nla_data(info->attrs[TIPC_NLA_LINK_NAME]); | 1963 | |
| 1964 | err = nla_parse_nested(attrs, TIPC_NLA_LINK_MAX, | ||
| 1965 | info->attrs[TIPC_NLA_LINK], | ||
| 1966 | tipc_nl_link_policy, info->extack); | ||
| 1967 | if (err) | ||
| 1968 | return err; | ||
| 1969 | |||
| 1970 | if (!attrs[TIPC_NLA_LINK_NAME]) | ||
| 1971 | return -EINVAL; | ||
| 1972 | |||
| 1973 | name = nla_data(attrs[TIPC_NLA_LINK_NAME]); | ||
| 1963 | 1974 | ||
| 1964 | msg.skb = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); | 1975 | msg.skb = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); |
| 1965 | if (!msg.skb) | 1976 | if (!msg.skb) |
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 252a52ae0893..6be21575503a 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
| @@ -1516,10 +1516,10 @@ static void tipc_sk_set_orig_addr(struct msghdr *m, struct sk_buff *skb) | |||
| 1516 | 1516 | ||
| 1517 | srcaddr->sock.family = AF_TIPC; | 1517 | srcaddr->sock.family = AF_TIPC; |
| 1518 | srcaddr->sock.addrtype = TIPC_ADDR_ID; | 1518 | srcaddr->sock.addrtype = TIPC_ADDR_ID; |
| 1519 | srcaddr->sock.scope = 0; | ||
| 1519 | srcaddr->sock.addr.id.ref = msg_origport(hdr); | 1520 | srcaddr->sock.addr.id.ref = msg_origport(hdr); |
| 1520 | srcaddr->sock.addr.id.node = msg_orignode(hdr); | 1521 | srcaddr->sock.addr.id.node = msg_orignode(hdr); |
| 1521 | srcaddr->sock.addr.name.domain = 0; | 1522 | srcaddr->sock.addr.name.domain = 0; |
| 1522 | srcaddr->sock.scope = 0; | ||
| 1523 | m->msg_namelen = sizeof(struct sockaddr_tipc); | 1523 | m->msg_namelen = sizeof(struct sockaddr_tipc); |
| 1524 | 1524 | ||
| 1525 | if (!msg_in_group(hdr)) | 1525 | if (!msg_in_group(hdr)) |
| @@ -1528,6 +1528,7 @@ static void tipc_sk_set_orig_addr(struct msghdr *m, struct sk_buff *skb) | |||
| 1528 | /* Group message users may also want to know sending member's id */ | 1528 | /* Group message users may also want to know sending member's id */ |
| 1529 | srcaddr->member.family = AF_TIPC; | 1529 | srcaddr->member.family = AF_TIPC; |
| 1530 | srcaddr->member.addrtype = TIPC_ADDR_NAME; | 1530 | srcaddr->member.addrtype = TIPC_ADDR_NAME; |
| 1531 | srcaddr->member.scope = 0; | ||
| 1531 | srcaddr->member.addr.name.name.type = msg_nametype(hdr); | 1532 | srcaddr->member.addr.name.name.type = msg_nametype(hdr); |
| 1532 | srcaddr->member.addr.name.name.instance = TIPC_SKB_CB(skb)->orig_member; | 1533 | srcaddr->member.addr.name.name.instance = TIPC_SKB_CB(skb)->orig_member; |
| 1533 | srcaddr->member.addr.name.domain = 0; | 1534 | srcaddr->member.addr.name.domain = 0; |
diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c index cc03e00785c7..20cd93be6236 100644 --- a/net/tls/tls_main.c +++ b/net/tls/tls_main.c | |||
| @@ -135,6 +135,7 @@ retry: | |||
| 135 | offset -= sg->offset; | 135 | offset -= sg->offset; |
| 136 | ctx->partially_sent_offset = offset; | 136 | ctx->partially_sent_offset = offset; |
| 137 | ctx->partially_sent_record = (void *)sg; | 137 | ctx->partially_sent_record = (void *)sg; |
| 138 | ctx->in_tcp_sendpages = false; | ||
| 138 | return ret; | 139 | return ret; |
| 139 | } | 140 | } |
| 140 | 141 | ||
| @@ -248,16 +249,13 @@ static void tls_sk_proto_close(struct sock *sk, long timeout) | |||
| 248 | struct tls_context *ctx = tls_get_ctx(sk); | 249 | struct tls_context *ctx = tls_get_ctx(sk); |
| 249 | long timeo = sock_sndtimeo(sk, 0); | 250 | long timeo = sock_sndtimeo(sk, 0); |
| 250 | void (*sk_proto_close)(struct sock *sk, long timeout); | 251 | void (*sk_proto_close)(struct sock *sk, long timeout); |
| 252 | bool free_ctx = false; | ||
| 251 | 253 | ||
| 252 | lock_sock(sk); | 254 | lock_sock(sk); |
| 253 | sk_proto_close = ctx->sk_proto_close; | 255 | sk_proto_close = ctx->sk_proto_close; |
| 254 | 256 | ||
| 255 | if (ctx->conf == TLS_HW_RECORD) | 257 | if (ctx->conf == TLS_BASE || ctx->conf == TLS_HW_RECORD) { |
| 256 | goto skip_tx_cleanup; | 258 | free_ctx = true; |
| 257 | |||
| 258 | if (ctx->conf == TLS_BASE) { | ||
| 259 | kfree(ctx); | ||
| 260 | ctx = NULL; | ||
| 261 | goto skip_tx_cleanup; | 259 | goto skip_tx_cleanup; |
| 262 | } | 260 | } |
| 263 | 261 | ||
| @@ -294,7 +292,7 @@ skip_tx_cleanup: | |||
| 294 | /* free ctx for TLS_HW_RECORD, used by tcp_set_state | 292 | /* free ctx for TLS_HW_RECORD, used by tcp_set_state |
| 295 | * for sk->sk_prot->unhash [tls_hw_unhash] | 293 | * for sk->sk_prot->unhash [tls_hw_unhash] |
| 296 | */ | 294 | */ |
| 297 | if (ctx && ctx->conf == TLS_HW_RECORD) | 295 | if (free_ctx) |
| 298 | kfree(ctx); | 296 | kfree(ctx); |
| 299 | } | 297 | } |
| 300 | 298 | ||
diff --git a/net/wireless/core.c b/net/wireless/core.c index a6f3cac8c640..c0fd8a85e7f7 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
| @@ -95,6 +95,9 @@ static int cfg80211_dev_check_name(struct cfg80211_registered_device *rdev, | |||
| 95 | 95 | ||
| 96 | ASSERT_RTNL(); | 96 | ASSERT_RTNL(); |
| 97 | 97 | ||
| 98 | if (strlen(newname) > NL80211_WIPHY_NAME_MAXLEN) | ||
| 99 | return -EINVAL; | ||
| 100 | |||
| 98 | /* prohibit calling the thing phy%d when %d is not its number */ | 101 | /* prohibit calling the thing phy%d when %d is not its number */ |
| 99 | sscanf(newname, PHY_NAME "%d%n", &wiphy_idx, &taken); | 102 | sscanf(newname, PHY_NAME "%d%n", &wiphy_idx, &taken); |
| 100 | if (taken == strlen(newname) && wiphy_idx != rdev->wiphy_idx) { | 103 | if (taken == strlen(newname) && wiphy_idx != rdev->wiphy_idx) { |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index ff28f8feeb09..a052693c2e85 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
| @@ -9214,6 +9214,7 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) | |||
| 9214 | 9214 | ||
| 9215 | if (nla_get_flag(info->attrs[NL80211_ATTR_EXTERNAL_AUTH_SUPPORT])) { | 9215 | if (nla_get_flag(info->attrs[NL80211_ATTR_EXTERNAL_AUTH_SUPPORT])) { |
| 9216 | if (!info->attrs[NL80211_ATTR_SOCKET_OWNER]) { | 9216 | if (!info->attrs[NL80211_ATTR_SOCKET_OWNER]) { |
| 9217 | kzfree(connkeys); | ||
| 9217 | GENL_SET_ERR_MSG(info, | 9218 | GENL_SET_ERR_MSG(info, |
| 9218 | "external auth requires connection ownership"); | 9219 | "external auth requires connection ownership"); |
| 9219 | return -EINVAL; | 9220 | return -EINVAL; |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 16c7e4ef5820..ac3e12c32aa3 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
| @@ -1026,6 +1026,7 @@ static int regdb_query_country(const struct fwdb_header *db, | |||
| 1026 | 1026 | ||
| 1027 | if (!tmp_rd) { | 1027 | if (!tmp_rd) { |
| 1028 | kfree(regdom); | 1028 | kfree(regdom); |
| 1029 | kfree(wmm_ptrs); | ||
| 1029 | return -ENOMEM; | 1030 | return -ENOMEM; |
| 1030 | } | 1031 | } |
| 1031 | regdom = tmp_rd; | 1032 | regdom = tmp_rd; |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index f9d2f2233f09..6c177ae7a6d9 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
| @@ -2175,6 +2175,12 @@ struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned int family) | |||
| 2175 | return afinfo; | 2175 | return afinfo; |
| 2176 | } | 2176 | } |
| 2177 | 2177 | ||
| 2178 | void xfrm_flush_gc(void) | ||
| 2179 | { | ||
| 2180 | flush_work(&xfrm_state_gc_work); | ||
| 2181 | } | ||
| 2182 | EXPORT_SYMBOL(xfrm_flush_gc); | ||
| 2183 | |||
| 2178 | /* Temporarily located here until net/xfrm/xfrm_tunnel.c is created */ | 2184 | /* Temporarily located here until net/xfrm/xfrm_tunnel.c is created */ |
| 2179 | void xfrm_state_delete_tunnel(struct xfrm_state *x) | 2185 | void xfrm_state_delete_tunnel(struct xfrm_state *x) |
| 2180 | { | 2186 | { |
