aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/networking/ppp_generic.txt6
-rw-r--r--MAINTAINERS8
-rw-r--r--drivers/bcma/driver_mips.c2
-rw-r--r--drivers/isdn/hardware/eicon/diva.c22
-rw-r--r--drivers/isdn/hardware/eicon/diva.h5
-rw-r--r--drivers/isdn/hardware/eicon/divasmain.c18
-rw-r--r--drivers/net/ethernet/amd/pcnet32.c10
-rw-r--r--drivers/net/ethernet/cisco/enic/enic_main.c8
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c1
-rw-r--r--drivers/net/ethernet/freescale/fec_ptp.c14
-rw-r--r--drivers/net/ethernet/ibm/ibmvnic.c22
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/icm.c16
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/intf.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/qp.c4
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_rx.c42
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c12
-rw-r--r--drivers/net/ethernet/qlogic/qed/qed_cxt.c2
-rw-r--r--drivers/net/phy/bcm-cygnus.c6
-rw-r--r--drivers/net/phy/bcm-phy-lib.c2
-rw-r--r--drivers/net/phy/bcm-phy-lib.h7
-rw-r--r--drivers/net/phy/bcm7xxx.c4
-rw-r--r--drivers/net/ppp/ppp_generic.c27
-rw-r--r--drivers/net/tun.c19
-rw-r--r--drivers/net/virtio_net.c21
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c4
-rw-r--r--drivers/ssb/Kconfig4
-rw-r--r--drivers/vhost/vhost.c3
-rw-r--r--include/linux/bpf_verifier.h2
-rw-r--r--include/net/sctp/sctp.h2
-rw-r--r--include/uapi/linux/nl80211.h2
-rw-r--r--include/uapi/linux/ppp-ioctl.h2
-rw-r--r--kernel/bpf/verifier.c86
-rw-r--r--net/batman-adv/multicast.c2
-rw-r--r--net/batman-adv/translation-table.c84
-rw-r--r--net/dccp/proto.c2
-rw-r--r--net/ipv4/fib_frontend.c1
-rw-r--r--net/ipv4/ip_sockglue.c2
-rw-r--r--net/ipv4/ipmr_base.c5
-rw-r--r--net/mac80211/mesh_plink.c8
-rw-r--r--net/packet/af_packet.c2
-rw-r--r--net/sched/cls_api.c2
-rw-r--r--net/sctp/ipv6.c2
-rw-r--r--net/sctp/protocol.c2
-rw-r--r--net/sctp/socket.c51
-rw-r--r--net/wireless/nl80211.c3
-rw-r--r--net/wireless/reg.c3
-rw-r--r--tools/testing/selftests/bpf/config2
-rw-r--r--tools/testing/selftests/net/config5
-rw-r--r--tools/testing/selftests/net/reuseport_bpf_numa.c4
49 files changed, 372 insertions, 193 deletions
diff --git a/Documentation/networking/ppp_generic.txt b/Documentation/networking/ppp_generic.txt
index 091d20273dcb..61daf4b39600 100644
--- a/Documentation/networking/ppp_generic.txt
+++ b/Documentation/networking/ppp_generic.txt
@@ -300,12 +300,6 @@ unattached instance are:
300The ioctl calls available on an instance of /dev/ppp attached to a 300The ioctl calls available on an instance of /dev/ppp attached to a
301channel are: 301channel are:
302 302
303* PPPIOCDETACH detaches the instance from the channel. This ioctl is
304 deprecated since the same effect can be achieved by closing the
305 instance. In order to prevent possible races this ioctl will fail
306 with an EINVAL error if more than one file descriptor refers to this
307 instance (i.e. as a result of dup(), dup2() or fork()).
308
309* PPPIOCCONNECT connects this channel to a PPP interface. The 303* PPPIOCCONNECT connects this channel to a PPP interface. The
310 argument should point to an int containing the interface unit 304 argument should point to an int containing the interface unit
311 number. It will return an EINVAL error if the channel is already 305 number. It will return an EINVAL error if the channel is already
diff --git a/MAINTAINERS b/MAINTAINERS
index a9ca122957e9..8f57c1e63d19 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2332,7 +2332,7 @@ F: drivers/gpio/gpio-ath79.c
2332F: Documentation/devicetree/bindings/gpio/gpio-ath79.txt 2332F: Documentation/devicetree/bindings/gpio/gpio-ath79.txt
2333 2333
2334ATHEROS ATH GENERIC UTILITIES 2334ATHEROS ATH GENERIC UTILITIES
2335M: "Luis R. Rodriguez" <mcgrof@do-not-panic.com> 2335M: Kalle Valo <kvalo@codeaurora.org>
2336L: linux-wireless@vger.kernel.org 2336L: linux-wireless@vger.kernel.org
2337S: Supported 2337S: Supported
2338F: drivers/net/wireless/ath/* 2338F: drivers/net/wireless/ath/*
@@ -2347,7 +2347,7 @@ S: Maintained
2347F: drivers/net/wireless/ath/ath5k/ 2347F: drivers/net/wireless/ath/ath5k/
2348 2348
2349ATHEROS ATH6KL WIRELESS DRIVER 2349ATHEROS ATH6KL WIRELESS DRIVER
2350M: Kalle Valo <kvalo@qca.qualcomm.com> 2350M: Kalle Valo <kvalo@codeaurora.org>
2351L: linux-wireless@vger.kernel.org 2351L: linux-wireless@vger.kernel.org
2352W: http://wireless.kernel.org/en/users/Drivers/ath6kl 2352W: http://wireless.kernel.org/en/users/Drivers/ath6kl
2353T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git 2353T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
@@ -11626,7 +11626,7 @@ S: Maintained
11626F: drivers/media/tuners/qt1010* 11626F: drivers/media/tuners/qt1010*
11627 11627
11628QUALCOMM ATHEROS ATH10K WIRELESS DRIVER 11628QUALCOMM ATHEROS ATH10K WIRELESS DRIVER
11629M: Kalle Valo <kvalo@qca.qualcomm.com> 11629M: Kalle Valo <kvalo@codeaurora.org>
11630L: ath10k@lists.infradead.org 11630L: ath10k@lists.infradead.org
11631W: http://wireless.kernel.org/en/users/Drivers/ath10k 11631W: http://wireless.kernel.org/en/users/Drivers/ath10k
11632T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git 11632T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
@@ -11677,7 +11677,7 @@ S: Maintained
11677F: drivers/media/platform/qcom/venus/ 11677F: drivers/media/platform/qcom/venus/
11678 11678
11679QUALCOMM WCN36XX WIRELESS DRIVER 11679QUALCOMM WCN36XX WIRELESS DRIVER
11680M: Eugene Krasnikov <k.eugene.e@gmail.com> 11680M: Kalle Valo <kvalo@codeaurora.org>
11681L: wcn36xx@lists.infradead.org 11681L: wcn36xx@lists.infradead.org
11682W: http://wireless.kernel.org/en/users/Drivers/wcn36xx 11682W: http://wireless.kernel.org/en/users/Drivers/wcn36xx
11683T: git git://github.com/KrasnikovEugene/wcn36xx.git 11683T: git git://github.com/KrasnikovEugene/wcn36xx.git
diff --git a/drivers/bcma/driver_mips.c b/drivers/bcma/driver_mips.c
index f040aba48d50..27e9686b6d3a 100644
--- a/drivers/bcma/driver_mips.c
+++ b/drivers/bcma/driver_mips.c
@@ -184,7 +184,7 @@ static void bcma_core_mips_print_irq(struct bcma_device *dev, unsigned int irq)
184{ 184{
185 int i; 185 int i;
186 static const char *irq_name[] = {"2(S)", "3", "4", "5", "6", "D", "I"}; 186 static const char *irq_name[] = {"2(S)", "3", "4", "5", "6", "D", "I"};
187 char interrupts[20]; 187 char interrupts[25];
188 char *ints = interrupts; 188 char *ints = interrupts;
189 189
190 for (i = 0; i < ARRAY_SIZE(irq_name); i++) 190 for (i = 0; i < ARRAY_SIZE(irq_name); i++)
diff --git a/drivers/isdn/hardware/eicon/diva.c b/drivers/isdn/hardware/eicon/diva.c
index 944a7f338099..1b25d8bc153a 100644
--- a/drivers/isdn/hardware/eicon/diva.c
+++ b/drivers/isdn/hardware/eicon/diva.c
@@ -388,10 +388,10 @@ void divasa_xdi_driver_unload(void)
388** Receive and process command from user mode utility 388** Receive and process command from user mode utility
389*/ 389*/
390void *diva_xdi_open_adapter(void *os_handle, const void __user *src, 390void *diva_xdi_open_adapter(void *os_handle, const void __user *src,
391 int length, 391 int length, void *mptr,
392 divas_xdi_copy_from_user_fn_t cp_fn) 392 divas_xdi_copy_from_user_fn_t cp_fn)
393{ 393{
394 diva_xdi_um_cfg_cmd_t msg; 394 diva_xdi_um_cfg_cmd_t *msg = (diva_xdi_um_cfg_cmd_t *)mptr;
395 diva_os_xdi_adapter_t *a = NULL; 395 diva_os_xdi_adapter_t *a = NULL;
396 diva_os_spin_lock_magic_t old_irql; 396 diva_os_spin_lock_magic_t old_irql;
397 struct list_head *tmp; 397 struct list_head *tmp;
@@ -401,21 +401,21 @@ void *diva_xdi_open_adapter(void *os_handle, const void __user *src,
401 length, sizeof(diva_xdi_um_cfg_cmd_t))) 401 length, sizeof(diva_xdi_um_cfg_cmd_t)))
402 return NULL; 402 return NULL;
403 } 403 }
404 if ((*cp_fn) (os_handle, &msg, src, sizeof(msg)) <= 0) { 404 if ((*cp_fn) (os_handle, msg, src, sizeof(*msg)) <= 0) {
405 DBG_ERR(("A: A(?) open, write error")) 405 DBG_ERR(("A: A(?) open, write error"))
406 return NULL; 406 return NULL;
407 } 407 }
408 diva_os_enter_spin_lock(&adapter_lock, &old_irql, "open_adapter"); 408 diva_os_enter_spin_lock(&adapter_lock, &old_irql, "open_adapter");
409 list_for_each(tmp, &adapter_queue) { 409 list_for_each(tmp, &adapter_queue) {
410 a = list_entry(tmp, diva_os_xdi_adapter_t, link); 410 a = list_entry(tmp, diva_os_xdi_adapter_t, link);
411 if (a->controller == (int)msg.adapter) 411 if (a->controller == (int)msg->adapter)
412 break; 412 break;
413 a = NULL; 413 a = NULL;
414 } 414 }
415 diva_os_leave_spin_lock(&adapter_lock, &old_irql, "open_adapter"); 415 diva_os_leave_spin_lock(&adapter_lock, &old_irql, "open_adapter");
416 416
417 if (!a) { 417 if (!a) {
418 DBG_ERR(("A: A(%d) open, adapter not found", msg.adapter)) 418 DBG_ERR(("A: A(%d) open, adapter not found", msg->adapter))
419 } 419 }
420 420
421 return (a); 421 return (a);
@@ -437,8 +437,10 @@ void diva_xdi_close_adapter(void *adapter, void *os_handle)
437 437
438int 438int
439diva_xdi_write(void *adapter, void *os_handle, const void __user *src, 439diva_xdi_write(void *adapter, void *os_handle, const void __user *src,
440 int length, divas_xdi_copy_from_user_fn_t cp_fn) 440 int length, void *mptr,
441 divas_xdi_copy_from_user_fn_t cp_fn)
441{ 442{
443 diva_xdi_um_cfg_cmd_t *msg = (diva_xdi_um_cfg_cmd_t *)mptr;
442 diva_os_xdi_adapter_t *a = (diva_os_xdi_adapter_t *) adapter; 444 diva_os_xdi_adapter_t *a = (diva_os_xdi_adapter_t *) adapter;
443 void *data; 445 void *data;
444 446
@@ -459,7 +461,13 @@ diva_xdi_write(void *adapter, void *os_handle, const void __user *src,
459 return (-2); 461 return (-2);
460 } 462 }
461 463
462 length = (*cp_fn) (os_handle, data, src, length); 464 if (msg) {
465 *(diva_xdi_um_cfg_cmd_t *)data = *msg;
466 length = (*cp_fn) (os_handle, (char *)data + sizeof(*msg),
467 src + sizeof(*msg), length - sizeof(*msg));
468 } else {
469 length = (*cp_fn) (os_handle, data, src, length);
470 }
463 if (length > 0) { 471 if (length > 0) {
464 if ((*(a->interface.cmd_proc)) 472 if ((*(a->interface.cmd_proc))
465 (a, (diva_xdi_um_cfg_cmd_t *) data, length)) { 473 (a, (diva_xdi_um_cfg_cmd_t *) data, length)) {
diff --git a/drivers/isdn/hardware/eicon/diva.h b/drivers/isdn/hardware/eicon/diva.h
index b067032093a8..1ad76650fbf9 100644
--- a/drivers/isdn/hardware/eicon/diva.h
+++ b/drivers/isdn/hardware/eicon/diva.h
@@ -20,10 +20,11 @@ int diva_xdi_read(void *adapter, void *os_handle, void __user *dst,
20 int max_length, divas_xdi_copy_to_user_fn_t cp_fn); 20 int max_length, divas_xdi_copy_to_user_fn_t cp_fn);
21 21
22int diva_xdi_write(void *adapter, void *os_handle, const void __user *src, 22int diva_xdi_write(void *adapter, void *os_handle, const void __user *src,
23 int length, divas_xdi_copy_from_user_fn_t cp_fn); 23 int length, void *msg,
24 divas_xdi_copy_from_user_fn_t cp_fn);
24 25
25void *diva_xdi_open_adapter(void *os_handle, const void __user *src, 26void *diva_xdi_open_adapter(void *os_handle, const void __user *src,
26 int length, 27 int length, void *msg,
27 divas_xdi_copy_from_user_fn_t cp_fn); 28 divas_xdi_copy_from_user_fn_t cp_fn);
28 29
29void diva_xdi_close_adapter(void *adapter, void *os_handle); 30void diva_xdi_close_adapter(void *adapter, void *os_handle);
diff --git a/drivers/isdn/hardware/eicon/divasmain.c b/drivers/isdn/hardware/eicon/divasmain.c
index b9980e84f9db..b6a3950b2564 100644
--- a/drivers/isdn/hardware/eicon/divasmain.c
+++ b/drivers/isdn/hardware/eicon/divasmain.c
@@ -591,19 +591,22 @@ static int divas_release(struct inode *inode, struct file *file)
591static ssize_t divas_write(struct file *file, const char __user *buf, 591static ssize_t divas_write(struct file *file, const char __user *buf,
592 size_t count, loff_t *ppos) 592 size_t count, loff_t *ppos)
593{ 593{
594 diva_xdi_um_cfg_cmd_t msg;
594 int ret = -EINVAL; 595 int ret = -EINVAL;
595 596
596 if (!file->private_data) { 597 if (!file->private_data) {
597 file->private_data = diva_xdi_open_adapter(file, buf, 598 file->private_data = diva_xdi_open_adapter(file, buf,
598 count, 599 count, &msg,
599 xdi_copy_from_user); 600 xdi_copy_from_user);
600 } 601 if (!file->private_data)
601 if (!file->private_data) { 602 return (-ENODEV);
602 return (-ENODEV); 603 ret = diva_xdi_write(file->private_data, file,
604 buf, count, &msg, xdi_copy_from_user);
605 } else {
606 ret = diva_xdi_write(file->private_data, file,
607 buf, count, NULL, xdi_copy_from_user);
603 } 608 }
604 609
605 ret = diva_xdi_write(file->private_data, file,
606 buf, count, xdi_copy_from_user);
607 switch (ret) { 610 switch (ret) {
608 case -1: /* Message should be removed from rx mailbox first */ 611 case -1: /* Message should be removed from rx mailbox first */
609 ret = -EBUSY; 612 ret = -EBUSY;
@@ -622,11 +625,12 @@ static ssize_t divas_write(struct file *file, const char __user *buf,
622static ssize_t divas_read(struct file *file, char __user *buf, 625static ssize_t divas_read(struct file *file, char __user *buf,
623 size_t count, loff_t *ppos) 626 size_t count, loff_t *ppos)
624{ 627{
628 diva_xdi_um_cfg_cmd_t msg;
625 int ret = -EINVAL; 629 int ret = -EINVAL;
626 630
627 if (!file->private_data) { 631 if (!file->private_data) {
628 file->private_data = diva_xdi_open_adapter(file, buf, 632 file->private_data = diva_xdi_open_adapter(file, buf,
629 count, 633 count, &msg,
630 xdi_copy_from_user); 634 xdi_copy_from_user);
631 } 635 }
632 if (!file->private_data) { 636 if (!file->private_data) {
diff --git a/drivers/net/ethernet/amd/pcnet32.c b/drivers/net/ethernet/amd/pcnet32.c
index a561705f232c..be198cc0b10c 100644
--- a/drivers/net/ethernet/amd/pcnet32.c
+++ b/drivers/net/ethernet/amd/pcnet32.c
@@ -1552,22 +1552,26 @@ pcnet32_probe_pci(struct pci_dev *pdev, const struct pci_device_id *ent)
1552 if (!ioaddr) { 1552 if (!ioaddr) {
1553 if (pcnet32_debug & NETIF_MSG_PROBE) 1553 if (pcnet32_debug & NETIF_MSG_PROBE)
1554 pr_err("card has no PCI IO resources, aborting\n"); 1554 pr_err("card has no PCI IO resources, aborting\n");
1555 return -ENODEV; 1555 err = -ENODEV;
1556 goto err_disable_dev;
1556 } 1557 }
1557 1558
1558 err = pci_set_dma_mask(pdev, PCNET32_DMA_MASK); 1559 err = pci_set_dma_mask(pdev, PCNET32_DMA_MASK);
1559 if (err) { 1560 if (err) {
1560 if (pcnet32_debug & NETIF_MSG_PROBE) 1561 if (pcnet32_debug & NETIF_MSG_PROBE)
1561 pr_err("architecture does not support 32bit PCI busmaster DMA\n"); 1562 pr_err("architecture does not support 32bit PCI busmaster DMA\n");
1562 return err; 1563 goto err_disable_dev;
1563 } 1564 }
1564 if (!request_region(ioaddr, PCNET32_TOTAL_SIZE, "pcnet32_probe_pci")) { 1565 if (!request_region(ioaddr, PCNET32_TOTAL_SIZE, "pcnet32_probe_pci")) {
1565 if (pcnet32_debug & NETIF_MSG_PROBE) 1566 if (pcnet32_debug & NETIF_MSG_PROBE)
1566 pr_err("io address range already allocated\n"); 1567 pr_err("io address range already allocated\n");
1567 return -EBUSY; 1568 err = -EBUSY;
1569 goto err_disable_dev;
1568 } 1570 }
1569 1571
1570 err = pcnet32_probe1(ioaddr, 1, pdev); 1572 err = pcnet32_probe1(ioaddr, 1, pdev);
1573
1574err_disable_dev:
1571 if (err < 0) 1575 if (err < 0)
1572 pci_disable_device(pdev); 1576 pci_disable_device(pdev);
1573 1577
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index 81684acf52af..8a8b12b720ef 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -2747,11 +2747,11 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2747 pci_set_master(pdev); 2747 pci_set_master(pdev);
2748 2748
2749 /* Query PCI controller on system for DMA addressing 2749 /* Query PCI controller on system for DMA addressing
2750 * limitation for the device. Try 64-bit first, and 2750 * limitation for the device. Try 47-bit first, and
2751 * fail to 32-bit. 2751 * fail to 32-bit.
2752 */ 2752 */
2753 2753
2754 err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64)); 2754 err = pci_set_dma_mask(pdev, DMA_BIT_MASK(47));
2755 if (err) { 2755 if (err) {
2756 err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); 2756 err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
2757 if (err) { 2757 if (err) {
@@ -2765,10 +2765,10 @@ static int enic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2765 goto err_out_release_regions; 2765 goto err_out_release_regions;
2766 } 2766 }
2767 } else { 2767 } else {
2768 err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); 2768 err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(47));
2769 if (err) { 2769 if (err) {
2770 dev_err(dev, "Unable to obtain %u-bit DMA " 2770 dev_err(dev, "Unable to obtain %u-bit DMA "
2771 "for consistent allocations, aborting\n", 64); 2771 "for consistent allocations, aborting\n", 47);
2772 goto err_out_release_regions; 2772 goto err_out_release_regions;
2773 } 2773 }
2774 using_dac = 1; 2774 using_dac = 1;
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index d4604bc8eb5b..9d3eed46830d 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1,3 +1,4 @@
1// SPDX-License-Identifier: GPL-2.0+
1/* 2/*
2 * Fast Ethernet Controller (FEC) driver for Motorola MPC8xx. 3 * Fast Ethernet Controller (FEC) driver for Motorola MPC8xx.
3 * Copyright (c) 1997 Dan Malek (dmalek@jlc.net) 4 * Copyright (c) 1997 Dan Malek (dmalek@jlc.net)
diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c
index f81439796ac7..43d973215040 100644
--- a/drivers/net/ethernet/freescale/fec_ptp.c
+++ b/drivers/net/ethernet/freescale/fec_ptp.c
@@ -1,20 +1,8 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Fast Ethernet Controller (ENET) PTP driver for MX6x. 3 * Fast Ethernet Controller (ENET) PTP driver for MX6x.
3 * 4 *
4 * Copyright (C) 2012 Freescale Semiconductor, Inc. 5 * Copyright (C) 2012 Freescale Semiconductor, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 */ 6 */
19 7
20#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 8#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 4bb4646a5f92..5ec1185808e5 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -796,9 +796,11 @@ static int ibmvnic_login(struct net_device *netdev)
796 struct ibmvnic_adapter *adapter = netdev_priv(netdev); 796 struct ibmvnic_adapter *adapter = netdev_priv(netdev);
797 unsigned long timeout = msecs_to_jiffies(30000); 797 unsigned long timeout = msecs_to_jiffies(30000);
798 int retry_count = 0; 798 int retry_count = 0;
799 bool retry;
799 int rc; 800 int rc;
800 801
801 do { 802 do {
803 retry = false;
802 if (retry_count > IBMVNIC_MAX_QUEUES) { 804 if (retry_count > IBMVNIC_MAX_QUEUES) {
803 netdev_warn(netdev, "Login attempts exceeded\n"); 805 netdev_warn(netdev, "Login attempts exceeded\n");
804 return -1; 806 return -1;
@@ -822,6 +824,9 @@ static int ibmvnic_login(struct net_device *netdev)
822 retry_count++; 824 retry_count++;
823 release_sub_crqs(adapter, 1); 825 release_sub_crqs(adapter, 1);
824 826
827 retry = true;
828 netdev_dbg(netdev,
829 "Received partial success, retrying...\n");
825 adapter->init_done_rc = 0; 830 adapter->init_done_rc = 0;
826 reinit_completion(&adapter->init_done); 831 reinit_completion(&adapter->init_done);
827 send_cap_queries(adapter); 832 send_cap_queries(adapter);
@@ -849,7 +854,7 @@ static int ibmvnic_login(struct net_device *netdev)
849 netdev_warn(netdev, "Adapter login failed\n"); 854 netdev_warn(netdev, "Adapter login failed\n");
850 return -1; 855 return -1;
851 } 856 }
852 } while (adapter->init_done_rc == PARTIALSUCCESS); 857 } while (retry);
853 858
854 /* handle pending MAC address changes after successful login */ 859 /* handle pending MAC address changes after successful login */
855 if (adapter->mac_change_pending) { 860 if (adapter->mac_change_pending) {
@@ -2617,18 +2622,21 @@ static int enable_scrq_irq(struct ibmvnic_adapter *adapter,
2617{ 2622{
2618 struct device *dev = &adapter->vdev->dev; 2623 struct device *dev = &adapter->vdev->dev;
2619 unsigned long rc; 2624 unsigned long rc;
2620 u64 val;
2621 2625
2622 if (scrq->hw_irq > 0x100000000ULL) { 2626 if (scrq->hw_irq > 0x100000000ULL) {
2623 dev_err(dev, "bad hw_irq = %lx\n", scrq->hw_irq); 2627 dev_err(dev, "bad hw_irq = %lx\n", scrq->hw_irq);
2624 return 1; 2628 return 1;
2625 } 2629 }
2626 2630
2627 val = (0xff000000) | scrq->hw_irq; 2631 if (adapter->resetting &&
2628 rc = plpar_hcall_norets(H_EOI, val); 2632 adapter->reset_reason == VNIC_RESET_MOBILITY) {
2629 if (rc) 2633 u64 val = (0xff000000) | scrq->hw_irq;
2630 dev_err(dev, "H_EOI FAILED irq 0x%llx. rc=%ld\n", 2634
2631 val, rc); 2635 rc = plpar_hcall_norets(H_EOI, val);
2636 if (rc)
2637 dev_err(dev, "H_EOI FAILED irq 0x%llx. rc=%ld\n",
2638 val, rc);
2639 }
2632 2640
2633 rc = plpar_hcall_norets(H_VIOCTL, adapter->vdev->unit_address, 2641 rc = plpar_hcall_norets(H_VIOCTL, adapter->vdev->unit_address,
2634 H_ENABLE_VIO_INTERRUPT, scrq->hw_irq, 0, 0); 2642 H_ENABLE_VIO_INTERRUPT, scrq->hw_irq, 0, 0);
diff --git a/drivers/net/ethernet/mellanox/mlx4/icm.c b/drivers/net/ethernet/mellanox/mlx4/icm.c
index a822f7a56bc5..685337d58276 100644
--- a/drivers/net/ethernet/mellanox/mlx4/icm.c
+++ b/drivers/net/ethernet/mellanox/mlx4/icm.c
@@ -43,12 +43,12 @@
43#include "fw.h" 43#include "fw.h"
44 44
45/* 45/*
46 * We allocate in as big chunks as we can, up to a maximum of 256 KB 46 * We allocate in page size (default 4KB on many archs) chunks to avoid high
47 * per chunk. 47 * order memory allocations in fragmented/high usage memory situation.
48 */ 48 */
49enum { 49enum {
50 MLX4_ICM_ALLOC_SIZE = 1 << 18, 50 MLX4_ICM_ALLOC_SIZE = PAGE_SIZE,
51 MLX4_TABLE_CHUNK_SIZE = 1 << 18 51 MLX4_TABLE_CHUNK_SIZE = PAGE_SIZE,
52}; 52};
53 53
54static void mlx4_free_icm_pages(struct mlx4_dev *dev, struct mlx4_icm_chunk *chunk) 54static void mlx4_free_icm_pages(struct mlx4_dev *dev, struct mlx4_icm_chunk *chunk)
@@ -398,9 +398,11 @@ int mlx4_init_icm_table(struct mlx4_dev *dev, struct mlx4_icm_table *table,
398 u64 size; 398 u64 size;
399 399
400 obj_per_chunk = MLX4_TABLE_CHUNK_SIZE / obj_size; 400 obj_per_chunk = MLX4_TABLE_CHUNK_SIZE / obj_size;
401 if (WARN_ON(!obj_per_chunk))
402 return -EINVAL;
401 num_icm = (nobj + obj_per_chunk - 1) / obj_per_chunk; 403 num_icm = (nobj + obj_per_chunk - 1) / obj_per_chunk;
402 404
403 table->icm = kcalloc(num_icm, sizeof(*table->icm), GFP_KERNEL); 405 table->icm = kvzalloc(num_icm * sizeof(*table->icm), GFP_KERNEL);
404 if (!table->icm) 406 if (!table->icm)
405 return -ENOMEM; 407 return -ENOMEM;
406 table->virt = virt; 408 table->virt = virt;
@@ -446,7 +448,7 @@ err:
446 mlx4_free_icm(dev, table->icm[i], use_coherent); 448 mlx4_free_icm(dev, table->icm[i], use_coherent);
447 } 449 }
448 450
449 kfree(table->icm); 451 kvfree(table->icm);
450 452
451 return -ENOMEM; 453 return -ENOMEM;
452} 454}
@@ -462,5 +464,5 @@ void mlx4_cleanup_icm_table(struct mlx4_dev *dev, struct mlx4_icm_table *table)
462 mlx4_free_icm(dev, table->icm[i], table->coherent); 464 mlx4_free_icm(dev, table->icm[i], table->coherent);
463 } 465 }
464 466
465 kfree(table->icm); 467 kvfree(table->icm);
466} 468}
diff --git a/drivers/net/ethernet/mellanox/mlx4/intf.c b/drivers/net/ethernet/mellanox/mlx4/intf.c
index 2edcce98ab2d..65482f004e50 100644
--- a/drivers/net/ethernet/mellanox/mlx4/intf.c
+++ b/drivers/net/ethernet/mellanox/mlx4/intf.c
@@ -172,7 +172,7 @@ int mlx4_do_bond(struct mlx4_dev *dev, bool enable)
172 list_add_tail(&dev_ctx->list, &priv->ctx_list); 172 list_add_tail(&dev_ctx->list, &priv->ctx_list);
173 spin_unlock_irqrestore(&priv->ctx_lock, flags); 173 spin_unlock_irqrestore(&priv->ctx_lock, flags);
174 174
175 mlx4_dbg(dev, "Inrerface for protocol %d restarted with when bonded mode is %s\n", 175 mlx4_dbg(dev, "Interface for protocol %d restarted with bonded mode %s\n",
176 dev_ctx->intf->protocol, enable ? 176 dev_ctx->intf->protocol, enable ?
177 "enabled" : "disabled"); 177 "enabled" : "disabled");
178 } 178 }
diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c
index 3aaf4bad6c5a..427e7a31862c 100644
--- a/drivers/net/ethernet/mellanox/mlx4/qp.c
+++ b/drivers/net/ethernet/mellanox/mlx4/qp.c
@@ -393,11 +393,11 @@ struct mlx4_qp *mlx4_qp_lookup(struct mlx4_dev *dev, u32 qpn)
393 struct mlx4_qp_table *qp_table = &mlx4_priv(dev)->qp_table; 393 struct mlx4_qp_table *qp_table = &mlx4_priv(dev)->qp_table;
394 struct mlx4_qp *qp; 394 struct mlx4_qp *qp;
395 395
396 spin_lock(&qp_table->lock); 396 spin_lock_irq(&qp_table->lock);
397 397
398 qp = __mlx4_qp_lookup(dev, qpn); 398 qp = __mlx4_qp_lookup(dev, qpn);
399 399
400 spin_unlock(&qp_table->lock); 400 spin_unlock_irq(&qp_table->lock);
401 return qp; 401 return qp;
402} 402}
403 403
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index 176645762e49..1ff0b0e93804 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -615,6 +615,45 @@ static inline bool is_last_ethertype_ip(struct sk_buff *skb, int *network_depth)
615 return (ethertype == htons(ETH_P_IP) || ethertype == htons(ETH_P_IPV6)); 615 return (ethertype == htons(ETH_P_IP) || ethertype == htons(ETH_P_IPV6));
616} 616}
617 617
618static __be32 mlx5e_get_fcs(struct sk_buff *skb)
619{
620 int last_frag_sz, bytes_in_prev, nr_frags;
621 u8 *fcs_p1, *fcs_p2;
622 skb_frag_t *last_frag;
623 __be32 fcs_bytes;
624
625 if (!skb_is_nonlinear(skb))
626 return *(__be32 *)(skb->data + skb->len - ETH_FCS_LEN);
627
628 nr_frags = skb_shinfo(skb)->nr_frags;
629 last_frag = &skb_shinfo(skb)->frags[nr_frags - 1];
630 last_frag_sz = skb_frag_size(last_frag);
631
632 /* If all FCS data is in last frag */
633 if (last_frag_sz >= ETH_FCS_LEN)
634 return *(__be32 *)(skb_frag_address(last_frag) +
635 last_frag_sz - ETH_FCS_LEN);
636
637 fcs_p2 = (u8 *)skb_frag_address(last_frag);
638 bytes_in_prev = ETH_FCS_LEN - last_frag_sz;
639
640 /* Find where the other part of the FCS is - Linear or another frag */
641 if (nr_frags == 1) {
642 fcs_p1 = skb_tail_pointer(skb);
643 } else {
644 skb_frag_t *prev_frag = &skb_shinfo(skb)->frags[nr_frags - 2];
645
646 fcs_p1 = skb_frag_address(prev_frag) +
647 skb_frag_size(prev_frag);
648 }
649 fcs_p1 -= bytes_in_prev;
650
651 memcpy(&fcs_bytes, fcs_p1, bytes_in_prev);
652 memcpy(((u8 *)&fcs_bytes) + bytes_in_prev, fcs_p2, last_frag_sz);
653
654 return fcs_bytes;
655}
656
618static inline void mlx5e_handle_csum(struct net_device *netdev, 657static inline void mlx5e_handle_csum(struct net_device *netdev,
619 struct mlx5_cqe64 *cqe, 658 struct mlx5_cqe64 *cqe,
620 struct mlx5e_rq *rq, 659 struct mlx5e_rq *rq,
@@ -643,6 +682,9 @@ static inline void mlx5e_handle_csum(struct net_device *netdev,
643 skb->csum = csum_partial(skb->data + ETH_HLEN, 682 skb->csum = csum_partial(skb->data + ETH_HLEN,
644 network_depth - ETH_HLEN, 683 network_depth - ETH_HLEN,
645 skb->csum); 684 skb->csum);
685 if (unlikely(netdev->features & NETIF_F_RXFCS))
686 skb->csum = csum_add(skb->csum,
687 (__force __wsum)mlx5e_get_fcs(skb));
646 rq->stats.csum_complete++; 688 rq->stats.csum_complete++;
647 return; 689 return;
648 } 690 }
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c b/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c
index 0f5da499a223..fad8c2e3804e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c
@@ -237,19 +237,17 @@ static void *mlx5_fpga_ipsec_cmd_exec(struct mlx5_core_dev *mdev,
237 context->buf.sg[0].data = &context->command; 237 context->buf.sg[0].data = &context->command;
238 238
239 spin_lock_irqsave(&fdev->ipsec->pending_cmds_lock, flags); 239 spin_lock_irqsave(&fdev->ipsec->pending_cmds_lock, flags);
240 list_add_tail(&context->list, &fdev->ipsec->pending_cmds); 240 res = mlx5_fpga_sbu_conn_sendmsg(fdev->ipsec->conn, &context->buf);
241 if (!res)
242 list_add_tail(&context->list, &fdev->ipsec->pending_cmds);
241 spin_unlock_irqrestore(&fdev->ipsec->pending_cmds_lock, flags); 243 spin_unlock_irqrestore(&fdev->ipsec->pending_cmds_lock, flags);
242 244
243 res = mlx5_fpga_sbu_conn_sendmsg(fdev->ipsec->conn, &context->buf);
244 if (res) { 245 if (res) {
245 mlx5_fpga_warn(fdev, "Failure sending IPSec command: %d\n", 246 mlx5_fpga_warn(fdev, "Failed to send IPSec command: %d\n", res);
246 res);
247 spin_lock_irqsave(&fdev->ipsec->pending_cmds_lock, flags);
248 list_del(&context->list);
249 spin_unlock_irqrestore(&fdev->ipsec->pending_cmds_lock, flags);
250 kfree(context); 247 kfree(context);
251 return ERR_PTR(res); 248 return ERR_PTR(res);
252 } 249 }
250
253 /* Context will be freed by wait func after completion */ 251 /* Context will be freed by wait func after completion */
254 return context; 252 return context;
255} 253}
diff --git a/drivers/net/ethernet/qlogic/qed/qed_cxt.c b/drivers/net/ethernet/qlogic/qed/qed_cxt.c
index 00f41c145d4d..820b226d6ff8 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_cxt.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_cxt.c
@@ -77,7 +77,7 @@
77#define ILT_CFG_REG(cli, reg) PSWRQ2_REG_ ## cli ## _ ## reg ## _RT_OFFSET 77#define ILT_CFG_REG(cli, reg) PSWRQ2_REG_ ## cli ## _ ## reg ## _RT_OFFSET
78 78
79/* ILT entry structure */ 79/* ILT entry structure */
80#define ILT_ENTRY_PHY_ADDR_MASK 0x000FFFFFFFFFFFULL 80#define ILT_ENTRY_PHY_ADDR_MASK (~0ULL >> 12)
81#define ILT_ENTRY_PHY_ADDR_SHIFT 0 81#define ILT_ENTRY_PHY_ADDR_SHIFT 0
82#define ILT_ENTRY_VALID_MASK 0x1ULL 82#define ILT_ENTRY_VALID_MASK 0x1ULL
83#define ILT_ENTRY_VALID_SHIFT 52 83#define ILT_ENTRY_VALID_SHIFT 52
diff --git a/drivers/net/phy/bcm-cygnus.c b/drivers/net/phy/bcm-cygnus.c
index 6838129839ca..e757b09f1889 100644
--- a/drivers/net/phy/bcm-cygnus.c
+++ b/drivers/net/phy/bcm-cygnus.c
@@ -61,17 +61,17 @@ static int bcm_cygnus_afe_config(struct phy_device *phydev)
61 return rc; 61 return rc;
62 62
63 /* make rcal=100, since rdb default is 000 */ 63 /* make rcal=100, since rdb default is 000 */
64 rc = bcm_phy_write_exp(phydev, MII_BRCM_CORE_EXPB1, 0x10); 64 rc = bcm_phy_write_exp_sel(phydev, MII_BRCM_CORE_EXPB1, 0x10);
65 if (rc < 0) 65 if (rc < 0)
66 return rc; 66 return rc;
67 67
68 /* CORE_EXPB0, Reset R_CAL/RC_CAL Engine */ 68 /* CORE_EXPB0, Reset R_CAL/RC_CAL Engine */
69 rc = bcm_phy_write_exp(phydev, MII_BRCM_CORE_EXPB0, 0x10); 69 rc = bcm_phy_write_exp_sel(phydev, MII_BRCM_CORE_EXPB0, 0x10);
70 if (rc < 0) 70 if (rc < 0)
71 return rc; 71 return rc;
72 72
73 /* CORE_EXPB0, Disable Reset R_CAL/RC_CAL Engine */ 73 /* CORE_EXPB0, Disable Reset R_CAL/RC_CAL Engine */
74 rc = bcm_phy_write_exp(phydev, MII_BRCM_CORE_EXPB0, 0x00); 74 rc = bcm_phy_write_exp_sel(phydev, MII_BRCM_CORE_EXPB0, 0x00);
75 75
76 return 0; 76 return 0;
77} 77}
diff --git a/drivers/net/phy/bcm-phy-lib.c b/drivers/net/phy/bcm-phy-lib.c
index 5ad130c3da43..d5e0833d69b9 100644
--- a/drivers/net/phy/bcm-phy-lib.c
+++ b/drivers/net/phy/bcm-phy-lib.c
@@ -56,7 +56,7 @@ int bcm54xx_auxctl_read(struct phy_device *phydev, u16 regnum)
56 /* The register must be written to both the Shadow Register Select and 56 /* The register must be written to both the Shadow Register Select and
57 * the Shadow Read Register Selector 57 * the Shadow Read Register Selector
58 */ 58 */
59 phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum | 59 phy_write(phydev, MII_BCM54XX_AUX_CTL, MII_BCM54XX_AUXCTL_SHDWSEL_MASK |
60 regnum << MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT); 60 regnum << MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT);
61 return phy_read(phydev, MII_BCM54XX_AUX_CTL); 61 return phy_read(phydev, MII_BCM54XX_AUX_CTL);
62} 62}
diff --git a/drivers/net/phy/bcm-phy-lib.h b/drivers/net/phy/bcm-phy-lib.h
index 7c73808cbbde..81cceaa412fe 100644
--- a/drivers/net/phy/bcm-phy-lib.h
+++ b/drivers/net/phy/bcm-phy-lib.h
@@ -14,11 +14,18 @@
14#ifndef _LINUX_BCM_PHY_LIB_H 14#ifndef _LINUX_BCM_PHY_LIB_H
15#define _LINUX_BCM_PHY_LIB_H 15#define _LINUX_BCM_PHY_LIB_H
16 16
17#include <linux/brcmphy.h>
17#include <linux/phy.h> 18#include <linux/phy.h>
18 19
19int bcm_phy_write_exp(struct phy_device *phydev, u16 reg, u16 val); 20int bcm_phy_write_exp(struct phy_device *phydev, u16 reg, u16 val);
20int bcm_phy_read_exp(struct phy_device *phydev, u16 reg); 21int bcm_phy_read_exp(struct phy_device *phydev, u16 reg);
21 22
23static inline int bcm_phy_write_exp_sel(struct phy_device *phydev,
24 u16 reg, u16 val)
25{
26 return bcm_phy_write_exp(phydev, reg | MII_BCM54XX_EXP_SEL_ER, val);
27}
28
22int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val); 29int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val);
23int bcm54xx_auxctl_read(struct phy_device *phydev, u16 regnum); 30int bcm54xx_auxctl_read(struct phy_device *phydev, u16 regnum);
24 31
diff --git a/drivers/net/phy/bcm7xxx.c b/drivers/net/phy/bcm7xxx.c
index 29b1c88b55cc..01d2ff2f6241 100644
--- a/drivers/net/phy/bcm7xxx.c
+++ b/drivers/net/phy/bcm7xxx.c
@@ -65,10 +65,10 @@ struct bcm7xxx_phy_priv {
65static void r_rc_cal_reset(struct phy_device *phydev) 65static void r_rc_cal_reset(struct phy_device *phydev)
66{ 66{
67 /* Reset R_CAL/RC_CAL Engine */ 67 /* Reset R_CAL/RC_CAL Engine */
68 bcm_phy_write_exp(phydev, 0x00b0, 0x0010); 68 bcm_phy_write_exp_sel(phydev, 0x00b0, 0x0010);
69 69
70 /* Disable Reset R_AL/RC_CAL Engine */ 70 /* Disable Reset R_AL/RC_CAL Engine */
71 bcm_phy_write_exp(phydev, 0x00b0, 0x0000); 71 bcm_phy_write_exp_sel(phydev, 0x00b0, 0x0000);
72} 72}
73 73
74static int bcm7xxx_28nm_b0_afe_config_init(struct phy_device *phydev) 74static int bcm7xxx_28nm_b0_afe_config_init(struct phy_device *phydev)
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index dc7c7ec43202..02ad03a2fab7 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -605,30 +605,13 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
605 605
606 if (cmd == PPPIOCDETACH) { 606 if (cmd == PPPIOCDETACH) {
607 /* 607 /*
608 * We have to be careful here... if the file descriptor 608 * PPPIOCDETACH is no longer supported as it was heavily broken,
609 * has been dup'd, we could have another process in the 609 * and is only known to have been used by pppd older than
610 * middle of a poll using the same file *, so we had 610 * ppp-2.4.2 (released November 2003).
611 * better not free the interface data structures -
612 * instead we fail the ioctl. Even in this case, we
613 * shut down the interface if we are the owner of it.
614 * Actually, we should get rid of PPPIOCDETACH, userland
615 * (i.e. pppd) could achieve the same effect by closing
616 * this fd and reopening /dev/ppp.
617 */ 611 */
612 pr_warn_once("%s (%d) used obsolete PPPIOCDETACH ioctl\n",
613 current->comm, current->pid);
618 err = -EINVAL; 614 err = -EINVAL;
619 if (pf->kind == INTERFACE) {
620 ppp = PF_TO_PPP(pf);
621 rtnl_lock();
622 if (file == ppp->owner)
623 unregister_netdevice(ppp->dev);
624 rtnl_unlock();
625 }
626 if (atomic_long_read(&file->f_count) < 2) {
627 ppp_release(NULL, file);
628 err = 0;
629 } else
630 pr_warn("PPPIOCDETACH file->f_count=%ld\n",
631 atomic_long_read(&file->f_count));
632 goto out; 615 goto out;
633 } 616 }
634 617
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index d45ac37e1287..45d807796a18 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1423,6 +1423,13 @@ static void tun_net_init(struct net_device *dev)
1423 dev->max_mtu = MAX_MTU - dev->hard_header_len; 1423 dev->max_mtu = MAX_MTU - dev->hard_header_len;
1424} 1424}
1425 1425
1426static bool tun_sock_writeable(struct tun_struct *tun, struct tun_file *tfile)
1427{
1428 struct sock *sk = tfile->socket.sk;
1429
1430 return (tun->dev->flags & IFF_UP) && sock_writeable(sk);
1431}
1432
1426/* Character device part */ 1433/* Character device part */
1427 1434
1428/* Poll */ 1435/* Poll */
@@ -1445,10 +1452,14 @@ static __poll_t tun_chr_poll(struct file *file, poll_table *wait)
1445 if (!ptr_ring_empty(&tfile->tx_ring)) 1452 if (!ptr_ring_empty(&tfile->tx_ring))
1446 mask |= EPOLLIN | EPOLLRDNORM; 1453 mask |= EPOLLIN | EPOLLRDNORM;
1447 1454
1448 if (tun->dev->flags & IFF_UP && 1455 /* Make sure SOCKWQ_ASYNC_NOSPACE is set if not writable to
1449 (sock_writeable(sk) || 1456 * guarantee EPOLLOUT to be raised by either here or
1450 (!test_and_set_bit(SOCKWQ_ASYNC_NOSPACE, &sk->sk_socket->flags) && 1457 * tun_sock_write_space(). Then process could get notification
1451 sock_writeable(sk)))) 1458 * after it writes to a down device and meets -EIO.
1459 */
1460 if (tun_sock_writeable(tun, tfile) ||
1461 (!test_and_set_bit(SOCKWQ_ASYNC_NOSPACE, &sk->sk_socket->flags) &&
1462 tun_sock_writeable(tun, tfile)))
1452 mask |= EPOLLOUT | EPOLLWRNORM; 1463 mask |= EPOLLOUT | EPOLLWRNORM;
1453 1464
1454 if (tun->dev->reg_state != NETREG_REGISTERED) 1465 if (tun->dev->reg_state != NETREG_REGISTERED)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 770422e953f7..032e1ac10a30 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -707,6 +707,13 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
707 void *data; 707 void *data;
708 u32 act; 708 u32 act;
709 709
710 /* Transient failure which in theory could occur if
711 * in-flight packets from before XDP was enabled reach
712 * the receive path after XDP is loaded.
713 */
714 if (unlikely(hdr->hdr.gso_type))
715 goto err_xdp;
716
710 /* This happens when rx buffer size is underestimated 717 /* This happens when rx buffer size is underestimated
711 * or headroom is not enough because of the buffer 718 * or headroom is not enough because of the buffer
712 * was refilled before XDP is set. This should only 719 * was refilled before XDP is set. This should only
@@ -727,14 +734,6 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
727 xdp_page = page; 734 xdp_page = page;
728 } 735 }
729 736
730 /* Transient failure which in theory could occur if
731 * in-flight packets from before XDP was enabled reach
732 * the receive path after XDP is loaded. In practice I
733 * was not able to create this condition.
734 */
735 if (unlikely(hdr->hdr.gso_type))
736 goto err_xdp;
737
738 /* Allow consuming headroom but reserve enough space to push 737 /* Allow consuming headroom but reserve enough space to push
739 * the descriptor on if we get an XDP_TX return code. 738 * the descriptor on if we get an XDP_TX return code.
740 */ 739 */
@@ -775,7 +774,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
775 } 774 }
776 *xdp_xmit = true; 775 *xdp_xmit = true;
777 if (unlikely(xdp_page != page)) 776 if (unlikely(xdp_page != page))
778 goto err_xdp; 777 put_page(page);
779 rcu_read_unlock(); 778 rcu_read_unlock();
780 goto xdp_xmit; 779 goto xdp_xmit;
781 case XDP_REDIRECT: 780 case XDP_REDIRECT:
@@ -787,7 +786,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
787 } 786 }
788 *xdp_xmit = true; 787 *xdp_xmit = true;
789 if (unlikely(xdp_page != page)) 788 if (unlikely(xdp_page != page))
790 goto err_xdp; 789 put_page(page);
791 rcu_read_unlock(); 790 rcu_read_unlock();
792 goto xdp_xmit; 791 goto xdp_xmit;
793 default: 792 default:
@@ -875,7 +874,7 @@ err_xdp:
875 rcu_read_unlock(); 874 rcu_read_unlock();
876err_skb: 875err_skb:
877 put_page(page); 876 put_page(page);
878 while (--num_buf) { 877 while (num_buf-- > 1) {
879 buf = virtqueue_get_buf(rq->vq, &len); 878 buf = virtqueue_get_buf(rq->vq, &len);
880 if (unlikely(!buf)) { 879 if (unlikely(!buf)) {
881 pr_debug("%s: rx error: %d buffers missing\n", 880 pr_debug("%s: rx error: %d buffers missing\n",
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 4a017a0d71ea..920c23e542a5 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -3340,7 +3340,7 @@ out_err:
3340static int hwsim_dump_radio_nl(struct sk_buff *skb, 3340static int hwsim_dump_radio_nl(struct sk_buff *skb,
3341 struct netlink_callback *cb) 3341 struct netlink_callback *cb)
3342{ 3342{
3343 int last_idx = cb->args[0]; 3343 int last_idx = cb->args[0] - 1;
3344 struct mac80211_hwsim_data *data = NULL; 3344 struct mac80211_hwsim_data *data = NULL;
3345 int res = 0; 3345 int res = 0;
3346 void *hdr; 3346 void *hdr;
@@ -3368,7 +3368,7 @@ static int hwsim_dump_radio_nl(struct sk_buff *skb,
3368 last_idx = data->idx; 3368 last_idx = data->idx;
3369 } 3369 }
3370 3370
3371 cb->args[0] = last_idx; 3371 cb->args[0] = last_idx + 1;
3372 3372
3373 /* list changed, but no new element sent, set interrupted flag */ 3373 /* list changed, but no new element sent, set interrupted flag */
3374 if (skb->len == 0 && cb->prev_seq && cb->seq != cb->prev_seq) { 3374 if (skb->len == 0 && cb->prev_seq && cb->seq != cb->prev_seq) {
diff --git a/drivers/ssb/Kconfig b/drivers/ssb/Kconfig
index 9371651d8017..c574dd210500 100644
--- a/drivers/ssb/Kconfig
+++ b/drivers/ssb/Kconfig
@@ -117,7 +117,7 @@ config SSB_SERIAL
117 117
118config SSB_DRIVER_PCICORE_POSSIBLE 118config SSB_DRIVER_PCICORE_POSSIBLE
119 bool 119 bool
120 depends on SSB_PCIHOST && SSB = y 120 depends on SSB_PCIHOST
121 default y 121 default y
122 122
123config SSB_DRIVER_PCICORE 123config SSB_DRIVER_PCICORE
@@ -131,7 +131,7 @@ config SSB_DRIVER_PCICORE
131 131
132config SSB_PCICORE_HOSTMODE 132config SSB_PCICORE_HOSTMODE
133 bool "Hostmode support for SSB PCI core" 133 bool "Hostmode support for SSB PCI core"
134 depends on SSB_DRIVER_PCICORE && SSB_DRIVER_MIPS 134 depends on SSB_DRIVER_PCICORE && SSB_DRIVER_MIPS && SSB = y
135 help 135 help
136 PCIcore hostmode operation (external PCI bus). 136 PCIcore hostmode operation (external PCI bus).
137 137
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index f3bd8e941224..f0be5f35ab28 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -981,6 +981,7 @@ static int vhost_process_iotlb_msg(struct vhost_dev *dev,
981{ 981{
982 int ret = 0; 982 int ret = 0;
983 983
984 mutex_lock(&dev->mutex);
984 vhost_dev_lock_vqs(dev); 985 vhost_dev_lock_vqs(dev);
985 switch (msg->type) { 986 switch (msg->type) {
986 case VHOST_IOTLB_UPDATE: 987 case VHOST_IOTLB_UPDATE:
@@ -1016,6 +1017,8 @@ static int vhost_process_iotlb_msg(struct vhost_dev *dev,
1016 } 1017 }
1017 1018
1018 vhost_dev_unlock_vqs(dev); 1019 vhost_dev_unlock_vqs(dev);
1020 mutex_unlock(&dev->mutex);
1021
1019 return ret; 1022 return ret;
1020} 1023}
1021ssize_t vhost_chr_write_iter(struct vhost_dev *dev, 1024ssize_t vhost_chr_write_iter(struct vhost_dev *dev,
diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
index 65cfc2f59db9..df36b1b08af0 100644
--- a/include/linux/bpf_verifier.h
+++ b/include/linux/bpf_verifier.h
@@ -142,7 +142,7 @@ struct bpf_verifier_state_list {
142struct bpf_insn_aux_data { 142struct bpf_insn_aux_data {
143 union { 143 union {
144 enum bpf_reg_type ptr_type; /* pointer type for load/store insns */ 144 enum bpf_reg_type ptr_type; /* pointer type for load/store insns */
145 struct bpf_map *map_ptr; /* pointer for call insn into lookup_elem */ 145 unsigned long map_state; /* pointer/poison value for maps */
146 s32 call_imm; /* saved imm field of call insn */ 146 s32 call_imm; /* saved imm field of call insn */
147 }; 147 };
148 int ctx_field_size; /* the ctx field size for load insn, maybe 0 */ 148 int ctx_field_size; /* the ctx field size for load insn, maybe 0 */
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 28b996d63490..35498e613ff5 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -103,6 +103,8 @@ void sctp_addr_wq_mgmt(struct net *, struct sctp_sockaddr_entry *, int);
103/* 103/*
104 * sctp/socket.c 104 * sctp/socket.c
105 */ 105 */
106int sctp_inet_connect(struct socket *sock, struct sockaddr *uaddr,
107 int addr_len, int flags);
106int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb); 108int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb);
107int sctp_inet_listen(struct socket *sock, int backlog); 109int sctp_inet_listen(struct socket *sock, int backlog);
108void sctp_write_space(struct sock *sk); 110void sctp_write_space(struct sock *sk);
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 9c3630146cec..271b93783d28 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2698,7 +2698,7 @@ enum nl80211_attrs {
2698#define NL80211_ATTR_KEYS NL80211_ATTR_KEYS 2698#define NL80211_ATTR_KEYS NL80211_ATTR_KEYS
2699#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS 2699#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS
2700 2700
2701#define NL80211_WIPHY_NAME_MAXLEN 128 2701#define NL80211_WIPHY_NAME_MAXLEN 64
2702 2702
2703#define NL80211_MAX_SUPP_RATES 32 2703#define NL80211_MAX_SUPP_RATES 32
2704#define NL80211_MAX_SUPP_HT_RATES 77 2704#define NL80211_MAX_SUPP_HT_RATES 77
diff --git a/include/uapi/linux/ppp-ioctl.h b/include/uapi/linux/ppp-ioctl.h
index b19a9c249b15..784c2e3e572e 100644
--- a/include/uapi/linux/ppp-ioctl.h
+++ b/include/uapi/linux/ppp-ioctl.h
@@ -106,7 +106,7 @@ struct pppol2tp_ioc_stats {
106#define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */ 106#define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */
107#define PPPIOCNEWUNIT _IOWR('t', 62, int) /* create new ppp unit */ 107#define PPPIOCNEWUNIT _IOWR('t', 62, int) /* create new ppp unit */
108#define PPPIOCATTACH _IOW('t', 61, int) /* attach to ppp unit */ 108#define PPPIOCATTACH _IOW('t', 61, int) /* attach to ppp unit */
109#define PPPIOCDETACH _IOW('t', 60, int) /* detach from ppp unit/chan */ 109#define PPPIOCDETACH _IOW('t', 60, int) /* obsolete, do not use */
110#define PPPIOCSMRRU _IOW('t', 59, int) /* set multilink MRU */ 110#define PPPIOCSMRRU _IOW('t', 59, int) /* set multilink MRU */
111#define PPPIOCCONNECT _IOW('t', 58, int) /* connect channel to unit */ 111#define PPPIOCCONNECT _IOW('t', 58, int) /* connect channel to unit */
112#define PPPIOCDISCONN _IO('t', 57) /* disconnect channel */ 112#define PPPIOCDISCONN _IO('t', 57) /* disconnect channel */
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 2ce967a63ede..1904e814f282 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -156,7 +156,29 @@ struct bpf_verifier_stack_elem {
156#define BPF_COMPLEXITY_LIMIT_INSNS 131072 156#define BPF_COMPLEXITY_LIMIT_INSNS 131072
157#define BPF_COMPLEXITY_LIMIT_STACK 1024 157#define BPF_COMPLEXITY_LIMIT_STACK 1024
158 158
159#define BPF_MAP_PTR_POISON ((void *)0xeB9F + POISON_POINTER_DELTA) 159#define BPF_MAP_PTR_UNPRIV 1UL
160#define BPF_MAP_PTR_POISON ((void *)((0xeB9FUL << 1) + \
161 POISON_POINTER_DELTA))
162#define BPF_MAP_PTR(X) ((struct bpf_map *)((X) & ~BPF_MAP_PTR_UNPRIV))
163
164static bool bpf_map_ptr_poisoned(const struct bpf_insn_aux_data *aux)
165{
166 return BPF_MAP_PTR(aux->map_state) == BPF_MAP_PTR_POISON;
167}
168
169static bool bpf_map_ptr_unpriv(const struct bpf_insn_aux_data *aux)
170{
171 return aux->map_state & BPF_MAP_PTR_UNPRIV;
172}
173
174static void bpf_map_ptr_store(struct bpf_insn_aux_data *aux,
175 const struct bpf_map *map, bool unpriv)
176{
177 BUILD_BUG_ON((unsigned long)BPF_MAP_PTR_POISON & BPF_MAP_PTR_UNPRIV);
178 unpriv |= bpf_map_ptr_unpriv(aux);
179 aux->map_state = (unsigned long)map |
180 (unpriv ? BPF_MAP_PTR_UNPRIV : 0UL);
181}
160 182
161struct bpf_call_arg_meta { 183struct bpf_call_arg_meta {
162 struct bpf_map *map_ptr; 184 struct bpf_map *map_ptr;
@@ -2358,6 +2380,29 @@ static int prepare_func_exit(struct bpf_verifier_env *env, int *insn_idx)
2358 return 0; 2380 return 0;
2359} 2381}
2360 2382
2383static int
2384record_func_map(struct bpf_verifier_env *env, struct bpf_call_arg_meta *meta,
2385 int func_id, int insn_idx)
2386{
2387 struct bpf_insn_aux_data *aux = &env->insn_aux_data[insn_idx];
2388
2389 if (func_id != BPF_FUNC_tail_call &&
2390 func_id != BPF_FUNC_map_lookup_elem)
2391 return 0;
2392 if (meta->map_ptr == NULL) {
2393 verbose(env, "kernel subsystem misconfigured verifier\n");
2394 return -EINVAL;
2395 }
2396
2397 if (!BPF_MAP_PTR(aux->map_state))
2398 bpf_map_ptr_store(aux, meta->map_ptr,
2399 meta->map_ptr->unpriv_array);
2400 else if (BPF_MAP_PTR(aux->map_state) != meta->map_ptr)
2401 bpf_map_ptr_store(aux, BPF_MAP_PTR_POISON,
2402 meta->map_ptr->unpriv_array);
2403 return 0;
2404}
2405
2361static int check_helper_call(struct bpf_verifier_env *env, int func_id, int insn_idx) 2406static int check_helper_call(struct bpf_verifier_env *env, int func_id, int insn_idx)
2362{ 2407{
2363 const struct bpf_func_proto *fn = NULL; 2408 const struct bpf_func_proto *fn = NULL;
@@ -2412,13 +2457,6 @@ static int check_helper_call(struct bpf_verifier_env *env, int func_id, int insn
2412 err = check_func_arg(env, BPF_REG_2, fn->arg2_type, &meta); 2457 err = check_func_arg(env, BPF_REG_2, fn->arg2_type, &meta);
2413 if (err) 2458 if (err)
2414 return err; 2459 return err;
2415 if (func_id == BPF_FUNC_tail_call) {
2416 if (meta.map_ptr == NULL) {
2417 verbose(env, "verifier bug\n");
2418 return -EINVAL;
2419 }
2420 env->insn_aux_data[insn_idx].map_ptr = meta.map_ptr;
2421 }
2422 err = check_func_arg(env, BPF_REG_3, fn->arg3_type, &meta); 2460 err = check_func_arg(env, BPF_REG_3, fn->arg3_type, &meta);
2423 if (err) 2461 if (err)
2424 return err; 2462 return err;
@@ -2429,6 +2467,10 @@ static int check_helper_call(struct bpf_verifier_env *env, int func_id, int insn
2429 if (err) 2467 if (err)
2430 return err; 2468 return err;
2431 2469
2470 err = record_func_map(env, &meta, func_id, insn_idx);
2471 if (err)
2472 return err;
2473
2432 /* Mark slots with STACK_MISC in case of raw mode, stack offset 2474 /* Mark slots with STACK_MISC in case of raw mode, stack offset
2433 * is inferred from register state. 2475 * is inferred from register state.
2434 */ 2476 */
@@ -2453,8 +2495,6 @@ static int check_helper_call(struct bpf_verifier_env *env, int func_id, int insn
2453 } else if (fn->ret_type == RET_VOID) { 2495 } else if (fn->ret_type == RET_VOID) {
2454 regs[BPF_REG_0].type = NOT_INIT; 2496 regs[BPF_REG_0].type = NOT_INIT;
2455 } else if (fn->ret_type == RET_PTR_TO_MAP_VALUE_OR_NULL) { 2497 } else if (fn->ret_type == RET_PTR_TO_MAP_VALUE_OR_NULL) {
2456 struct bpf_insn_aux_data *insn_aux;
2457
2458 regs[BPF_REG_0].type = PTR_TO_MAP_VALUE_OR_NULL; 2498 regs[BPF_REG_0].type = PTR_TO_MAP_VALUE_OR_NULL;
2459 /* There is no offset yet applied, variable or fixed */ 2499 /* There is no offset yet applied, variable or fixed */
2460 mark_reg_known_zero(env, regs, BPF_REG_0); 2500 mark_reg_known_zero(env, regs, BPF_REG_0);
@@ -2470,11 +2510,6 @@ static int check_helper_call(struct bpf_verifier_env *env, int func_id, int insn
2470 } 2510 }
2471 regs[BPF_REG_0].map_ptr = meta.map_ptr; 2511 regs[BPF_REG_0].map_ptr = meta.map_ptr;
2472 regs[BPF_REG_0].id = ++env->id_gen; 2512 regs[BPF_REG_0].id = ++env->id_gen;
2473 insn_aux = &env->insn_aux_data[insn_idx];
2474 if (!insn_aux->map_ptr)
2475 insn_aux->map_ptr = meta.map_ptr;
2476 else if (insn_aux->map_ptr != meta.map_ptr)
2477 insn_aux->map_ptr = BPF_MAP_PTR_POISON;
2478 } else { 2513 } else {
2479 verbose(env, "unknown return type %d of func %s#%d\n", 2514 verbose(env, "unknown return type %d of func %s#%d\n",
2480 fn->ret_type, func_id_name(func_id), func_id); 2515 fn->ret_type, func_id_name(func_id), func_id);
@@ -5470,6 +5505,7 @@ static int fixup_bpf_calls(struct bpf_verifier_env *env)
5470 struct bpf_insn *insn = prog->insnsi; 5505 struct bpf_insn *insn = prog->insnsi;
5471 const struct bpf_func_proto *fn; 5506 const struct bpf_func_proto *fn;
5472 const int insn_cnt = prog->len; 5507 const int insn_cnt = prog->len;
5508 struct bpf_insn_aux_data *aux;
5473 struct bpf_insn insn_buf[16]; 5509 struct bpf_insn insn_buf[16];
5474 struct bpf_prog *new_prog; 5510 struct bpf_prog *new_prog;
5475 struct bpf_map *map_ptr; 5511 struct bpf_map *map_ptr;
@@ -5544,19 +5580,22 @@ static int fixup_bpf_calls(struct bpf_verifier_env *env)
5544 insn->imm = 0; 5580 insn->imm = 0;
5545 insn->code = BPF_JMP | BPF_TAIL_CALL; 5581 insn->code = BPF_JMP | BPF_TAIL_CALL;
5546 5582
5583 aux = &env->insn_aux_data[i + delta];
5584 if (!bpf_map_ptr_unpriv(aux))
5585 continue;
5586
5547 /* instead of changing every JIT dealing with tail_call 5587 /* instead of changing every JIT dealing with tail_call
5548 * emit two extra insns: 5588 * emit two extra insns:
5549 * if (index >= max_entries) goto out; 5589 * if (index >= max_entries) goto out;
5550 * index &= array->index_mask; 5590 * index &= array->index_mask;
5551 * to avoid out-of-bounds cpu speculation 5591 * to avoid out-of-bounds cpu speculation
5552 */ 5592 */
5553 map_ptr = env->insn_aux_data[i + delta].map_ptr; 5593 if (bpf_map_ptr_poisoned(aux)) {
5554 if (map_ptr == BPF_MAP_PTR_POISON) {
5555 verbose(env, "tail_call abusing map_ptr\n"); 5594 verbose(env, "tail_call abusing map_ptr\n");
5556 return -EINVAL; 5595 return -EINVAL;
5557 } 5596 }
5558 if (!map_ptr->unpriv_array) 5597
5559 continue; 5598 map_ptr = BPF_MAP_PTR(aux->map_state);
5560 insn_buf[0] = BPF_JMP_IMM(BPF_JGE, BPF_REG_3, 5599 insn_buf[0] = BPF_JMP_IMM(BPF_JGE, BPF_REG_3,
5561 map_ptr->max_entries, 2); 5600 map_ptr->max_entries, 2);
5562 insn_buf[1] = BPF_ALU32_IMM(BPF_AND, BPF_REG_3, 5601 insn_buf[1] = BPF_ALU32_IMM(BPF_AND, BPF_REG_3,
@@ -5580,9 +5619,12 @@ static int fixup_bpf_calls(struct bpf_verifier_env *env)
5580 */ 5619 */
5581 if (prog->jit_requested && BITS_PER_LONG == 64 && 5620 if (prog->jit_requested && BITS_PER_LONG == 64 &&
5582 insn->imm == BPF_FUNC_map_lookup_elem) { 5621 insn->imm == BPF_FUNC_map_lookup_elem) {
5583 map_ptr = env->insn_aux_data[i + delta].map_ptr; 5622 aux = &env->insn_aux_data[i + delta];
5584 if (map_ptr == BPF_MAP_PTR_POISON || 5623 if (bpf_map_ptr_poisoned(aux))
5585 !map_ptr->ops->map_gen_lookup) 5624 goto patch_call_imm;
5625
5626 map_ptr = BPF_MAP_PTR(aux->map_state);
5627 if (!map_ptr->ops->map_gen_lookup)
5586 goto patch_call_imm; 5628 goto patch_call_imm;
5587 5629
5588 cnt = map_ptr->ops->map_gen_lookup(map_ptr, insn_buf); 5630 cnt = map_ptr->ops->map_gen_lookup(map_ptr, insn_buf);
diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c
index a11d3d89f012..a35f597e8c8b 100644
--- a/net/batman-adv/multicast.c
+++ b/net/batman-adv/multicast.c
@@ -1536,7 +1536,7 @@ out:
1536 1536
1537 if (!ret && primary_if) 1537 if (!ret && primary_if)
1538 *primary_if = hard_iface; 1538 *primary_if = hard_iface;
1539 else 1539 else if (hard_iface)
1540 batadv_hardif_put(hard_iface); 1540 batadv_hardif_put(hard_iface);
1541 1541
1542 return ret; 1542 return ret;
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 0225616d5771..3986551397ca 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -862,7 +862,7 @@ batadv_tt_prepare_tvlv_global_data(struct batadv_orig_node *orig_node,
862 struct batadv_orig_node_vlan *vlan; 862 struct batadv_orig_node_vlan *vlan;
863 u8 *tt_change_ptr; 863 u8 *tt_change_ptr;
864 864
865 rcu_read_lock(); 865 spin_lock_bh(&orig_node->vlan_list_lock);
866 hlist_for_each_entry_rcu(vlan, &orig_node->vlan_list, list) { 866 hlist_for_each_entry_rcu(vlan, &orig_node->vlan_list, list) {
867 num_vlan++; 867 num_vlan++;
868 num_entries += atomic_read(&vlan->tt.num_entries); 868 num_entries += atomic_read(&vlan->tt.num_entries);
@@ -900,7 +900,7 @@ batadv_tt_prepare_tvlv_global_data(struct batadv_orig_node *orig_node,
900 *tt_change = (struct batadv_tvlv_tt_change *)tt_change_ptr; 900 *tt_change = (struct batadv_tvlv_tt_change *)tt_change_ptr;
901 901
902out: 902out:
903 rcu_read_unlock(); 903 spin_unlock_bh(&orig_node->vlan_list_lock);
904 return tvlv_len; 904 return tvlv_len;
905} 905}
906 906
@@ -931,15 +931,20 @@ batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv,
931 struct batadv_tvlv_tt_vlan_data *tt_vlan; 931 struct batadv_tvlv_tt_vlan_data *tt_vlan;
932 struct batadv_softif_vlan *vlan; 932 struct batadv_softif_vlan *vlan;
933 u16 num_vlan = 0; 933 u16 num_vlan = 0;
934 u16 num_entries = 0; 934 u16 vlan_entries = 0;
935 u16 total_entries = 0;
935 u16 tvlv_len; 936 u16 tvlv_len;
936 u8 *tt_change_ptr; 937 u8 *tt_change_ptr;
937 int change_offset; 938 int change_offset;
938 939
939 rcu_read_lock(); 940 spin_lock_bh(&bat_priv->softif_vlan_list_lock);
940 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { 941 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) {
942 vlan_entries = atomic_read(&vlan->tt.num_entries);
943 if (vlan_entries < 1)
944 continue;
945
941 num_vlan++; 946 num_vlan++;
942 num_entries += atomic_read(&vlan->tt.num_entries); 947 total_entries += vlan_entries;
943 } 948 }
944 949
945 change_offset = sizeof(**tt_data); 950 change_offset = sizeof(**tt_data);
@@ -947,7 +952,7 @@ batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv,
947 952
948 /* if tt_len is negative, allocate the space needed by the full table */ 953 /* if tt_len is negative, allocate the space needed by the full table */
949 if (*tt_len < 0) 954 if (*tt_len < 0)
950 *tt_len = batadv_tt_len(num_entries); 955 *tt_len = batadv_tt_len(total_entries);
951 956
952 tvlv_len = *tt_len; 957 tvlv_len = *tt_len;
953 tvlv_len += change_offset; 958 tvlv_len += change_offset;
@@ -964,6 +969,10 @@ batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv,
964 969
965 tt_vlan = (struct batadv_tvlv_tt_vlan_data *)(*tt_data + 1); 970 tt_vlan = (struct batadv_tvlv_tt_vlan_data *)(*tt_data + 1);
966 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { 971 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) {
972 vlan_entries = atomic_read(&vlan->tt.num_entries);
973 if (vlan_entries < 1)
974 continue;
975
967 tt_vlan->vid = htons(vlan->vid); 976 tt_vlan->vid = htons(vlan->vid);
968 tt_vlan->crc = htonl(vlan->tt.crc); 977 tt_vlan->crc = htonl(vlan->tt.crc);
969 978
@@ -974,7 +983,7 @@ batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv,
974 *tt_change = (struct batadv_tvlv_tt_change *)tt_change_ptr; 983 *tt_change = (struct batadv_tvlv_tt_change *)tt_change_ptr;
975 984
976out: 985out:
977 rcu_read_unlock(); 986 spin_unlock_bh(&bat_priv->softif_vlan_list_lock);
978 return tvlv_len; 987 return tvlv_len;
979} 988}
980 989
@@ -1538,6 +1547,8 @@ batadv_tt_global_orig_entry_find(const struct batadv_tt_global_entry *entry,
1538 * handled by a given originator 1547 * handled by a given originator
1539 * @entry: the TT global entry to check 1548 * @entry: the TT global entry to check
1540 * @orig_node: the originator to search in the list 1549 * @orig_node: the originator to search in the list
1550 * @flags: a pointer to store TT flags for the given @entry received
1551 * from @orig_node
1541 * 1552 *
1542 * find out if an orig_node is already in the list of a tt_global_entry. 1553 * find out if an orig_node is already in the list of a tt_global_entry.
1543 * 1554 *
@@ -1545,7 +1556,8 @@ batadv_tt_global_orig_entry_find(const struct batadv_tt_global_entry *entry,
1545 */ 1556 */
1546static bool 1557static bool
1547batadv_tt_global_entry_has_orig(const struct batadv_tt_global_entry *entry, 1558batadv_tt_global_entry_has_orig(const struct batadv_tt_global_entry *entry,
1548 const struct batadv_orig_node *orig_node) 1559 const struct batadv_orig_node *orig_node,
1560 u8 *flags)
1549{ 1561{
1550 struct batadv_tt_orig_list_entry *orig_entry; 1562 struct batadv_tt_orig_list_entry *orig_entry;
1551 bool found = false; 1563 bool found = false;
@@ -1553,6 +1565,10 @@ batadv_tt_global_entry_has_orig(const struct batadv_tt_global_entry *entry,
1553 orig_entry = batadv_tt_global_orig_entry_find(entry, orig_node); 1565 orig_entry = batadv_tt_global_orig_entry_find(entry, orig_node);
1554 if (orig_entry) { 1566 if (orig_entry) {
1555 found = true; 1567 found = true;
1568
1569 if (flags)
1570 *flags = orig_entry->flags;
1571
1556 batadv_tt_orig_list_entry_put(orig_entry); 1572 batadv_tt_orig_list_entry_put(orig_entry);
1557 } 1573 }
1558 1574
@@ -1731,7 +1747,7 @@ static bool batadv_tt_global_add(struct batadv_priv *bat_priv,
1731 if (!(common->flags & BATADV_TT_CLIENT_TEMP)) 1747 if (!(common->flags & BATADV_TT_CLIENT_TEMP))
1732 goto out; 1748 goto out;
1733 if (batadv_tt_global_entry_has_orig(tt_global_entry, 1749 if (batadv_tt_global_entry_has_orig(tt_global_entry,
1734 orig_node)) 1750 orig_node, NULL))
1735 goto out_remove; 1751 goto out_remove;
1736 batadv_tt_global_del_orig_list(tt_global_entry); 1752 batadv_tt_global_del_orig_list(tt_global_entry);
1737 goto add_orig_entry; 1753 goto add_orig_entry;
@@ -2880,23 +2896,46 @@ unlock:
2880} 2896}
2881 2897
2882/** 2898/**
2883 * batadv_tt_local_valid() - verify that given tt entry is a valid one 2899 * batadv_tt_local_valid() - verify local tt entry and get flags
2884 * @entry_ptr: to be checked local tt entry 2900 * @entry_ptr: to be checked local tt entry
2885 * @data_ptr: not used but definition required to satisfy the callback prototype 2901 * @data_ptr: not used but definition required to satisfy the callback prototype
2902 * @flags: a pointer to store TT flags for this client to
2903 *
2904 * Checks the validity of the given local TT entry. If it is, then the provided
2905 * flags pointer is updated.
2886 * 2906 *
2887 * Return: true if the entry is a valid, false otherwise. 2907 * Return: true if the entry is a valid, false otherwise.
2888 */ 2908 */
2889static bool batadv_tt_local_valid(const void *entry_ptr, const void *data_ptr) 2909static bool batadv_tt_local_valid(const void *entry_ptr,
2910 const void *data_ptr,
2911 u8 *flags)
2890{ 2912{
2891 const struct batadv_tt_common_entry *tt_common_entry = entry_ptr; 2913 const struct batadv_tt_common_entry *tt_common_entry = entry_ptr;
2892 2914
2893 if (tt_common_entry->flags & BATADV_TT_CLIENT_NEW) 2915 if (tt_common_entry->flags & BATADV_TT_CLIENT_NEW)
2894 return false; 2916 return false;
2917
2918 if (flags)
2919 *flags = tt_common_entry->flags;
2920
2895 return true; 2921 return true;
2896} 2922}
2897 2923
2924/**
2925 * batadv_tt_global_valid() - verify global tt entry and get flags
2926 * @entry_ptr: to be checked global tt entry
2927 * @data_ptr: an orig_node object (may be NULL)
2928 * @flags: a pointer to store TT flags for this client to
2929 *
2930 * Checks the validity of the given global TT entry. If it is, then the provided
2931 * flags pointer is updated either with the common (summed) TT flags if data_ptr
2932 * is NULL or the specific, per originator TT flags otherwise.
2933 *
2934 * Return: true if the entry is a valid, false otherwise.
2935 */
2898static bool batadv_tt_global_valid(const void *entry_ptr, 2936static bool batadv_tt_global_valid(const void *entry_ptr,
2899 const void *data_ptr) 2937 const void *data_ptr,
2938 u8 *flags)
2900{ 2939{
2901 const struct batadv_tt_common_entry *tt_common_entry = entry_ptr; 2940 const struct batadv_tt_common_entry *tt_common_entry = entry_ptr;
2902 const struct batadv_tt_global_entry *tt_global_entry; 2941 const struct batadv_tt_global_entry *tt_global_entry;
@@ -2910,7 +2949,8 @@ static bool batadv_tt_global_valid(const void *entry_ptr,
2910 struct batadv_tt_global_entry, 2949 struct batadv_tt_global_entry,
2911 common); 2950 common);
2912 2951
2913 return batadv_tt_global_entry_has_orig(tt_global_entry, orig_node); 2952 return batadv_tt_global_entry_has_orig(tt_global_entry, orig_node,
2953 flags);
2914} 2954}
2915 2955
2916/** 2956/**
@@ -2920,25 +2960,34 @@ static bool batadv_tt_global_valid(const void *entry_ptr,
2920 * @hash: hash table containing the tt entries 2960 * @hash: hash table containing the tt entries
2921 * @tt_len: expected tvlv tt data buffer length in number of bytes 2961 * @tt_len: expected tvlv tt data buffer length in number of bytes
2922 * @tvlv_buff: pointer to the buffer to fill with the TT data 2962 * @tvlv_buff: pointer to the buffer to fill with the TT data
2923 * @valid_cb: function to filter tt change entries 2963 * @valid_cb: function to filter tt change entries and to return TT flags
2924 * @cb_data: data passed to the filter function as argument 2964 * @cb_data: data passed to the filter function as argument
2965 *
2966 * Fills the tvlv buff with the tt entries from the specified hash. If valid_cb
2967 * is not provided then this becomes a no-op.
2925 */ 2968 */
2926static void batadv_tt_tvlv_generate(struct batadv_priv *bat_priv, 2969static void batadv_tt_tvlv_generate(struct batadv_priv *bat_priv,
2927 struct batadv_hashtable *hash, 2970 struct batadv_hashtable *hash,
2928 void *tvlv_buff, u16 tt_len, 2971 void *tvlv_buff, u16 tt_len,
2929 bool (*valid_cb)(const void *, 2972 bool (*valid_cb)(const void *,
2930 const void *), 2973 const void *,
2974 u8 *flags),
2931 void *cb_data) 2975 void *cb_data)
2932{ 2976{
2933 struct batadv_tt_common_entry *tt_common_entry; 2977 struct batadv_tt_common_entry *tt_common_entry;
2934 struct batadv_tvlv_tt_change *tt_change; 2978 struct batadv_tvlv_tt_change *tt_change;
2935 struct hlist_head *head; 2979 struct hlist_head *head;
2936 u16 tt_tot, tt_num_entries = 0; 2980 u16 tt_tot, tt_num_entries = 0;
2981 u8 flags;
2982 bool ret;
2937 u32 i; 2983 u32 i;
2938 2984
2939 tt_tot = batadv_tt_entries(tt_len); 2985 tt_tot = batadv_tt_entries(tt_len);
2940 tt_change = (struct batadv_tvlv_tt_change *)tvlv_buff; 2986 tt_change = (struct batadv_tvlv_tt_change *)tvlv_buff;
2941 2987
2988 if (!valid_cb)
2989 return;
2990
2942 rcu_read_lock(); 2991 rcu_read_lock();
2943 for (i = 0; i < hash->size; i++) { 2992 for (i = 0; i < hash->size; i++) {
2944 head = &hash->table[i]; 2993 head = &hash->table[i];
@@ -2948,11 +2997,12 @@ static void batadv_tt_tvlv_generate(struct batadv_priv *bat_priv,
2948 if (tt_tot == tt_num_entries) 2997 if (tt_tot == tt_num_entries)
2949 break; 2998 break;
2950 2999
2951 if ((valid_cb) && (!valid_cb(tt_common_entry, cb_data))) 3000 ret = valid_cb(tt_common_entry, cb_data, &flags);
3001 if (!ret)
2952 continue; 3002 continue;
2953 3003
2954 ether_addr_copy(tt_change->addr, tt_common_entry->addr); 3004 ether_addr_copy(tt_change->addr, tt_common_entry->addr);
2955 tt_change->flags = tt_common_entry->flags; 3005 tt_change->flags = flags;
2956 tt_change->vid = htons(tt_common_entry->vid); 3006 tt_change->vid = htons(tt_common_entry->vid);
2957 memset(tt_change->reserved, 0, 3007 memset(tt_change->reserved, 0,
2958 sizeof(tt_change->reserved)); 3008 sizeof(tt_change->reserved));
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index 84cd4e3fd01b..0d56e36a6db7 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -283,9 +283,7 @@ int dccp_disconnect(struct sock *sk, int flags)
283 283
284 dccp_clear_xmit_timers(sk); 284 dccp_clear_xmit_timers(sk);
285 ccid_hc_rx_delete(dp->dccps_hc_rx_ccid, sk); 285 ccid_hc_rx_delete(dp->dccps_hc_rx_ccid, sk);
286 ccid_hc_tx_delete(dp->dccps_hc_tx_ccid, sk);
287 dp->dccps_hc_rx_ccid = NULL; 286 dp->dccps_hc_rx_ccid = NULL;
288 dp->dccps_hc_tx_ccid = NULL;
289 287
290 __skb_queue_purge(&sk->sk_receive_queue); 288 __skb_queue_purge(&sk->sk_receive_queue);
291 __skb_queue_purge(&sk->sk_write_queue); 289 __skb_queue_purge(&sk->sk_write_queue);
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 4d622112bf95..e66172aaf241 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -649,6 +649,7 @@ const struct nla_policy rtm_ipv4_policy[RTA_MAX + 1] = {
649 [RTA_ENCAP] = { .type = NLA_NESTED }, 649 [RTA_ENCAP] = { .type = NLA_NESTED },
650 [RTA_UID] = { .type = NLA_U32 }, 650 [RTA_UID] = { .type = NLA_U32 },
651 [RTA_MARK] = { .type = NLA_U32 }, 651 [RTA_MARK] = { .type = NLA_U32 },
652 [RTA_TABLE] = { .type = NLA_U32 },
652}; 653};
653 654
654static int rtm_to_fib_config(struct net *net, struct sk_buff *skb, 655static int rtm_to_fib_config(struct net *net, struct sk_buff *skb,
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 5ad2d8ed3a3f..57bbb060faaf 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -505,8 +505,6 @@ int ip_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len)
505 int err; 505 int err;
506 int copied; 506 int copied;
507 507
508 WARN_ON_ONCE(sk->sk_family == AF_INET6);
509
510 err = -EAGAIN; 508 err = -EAGAIN;
511 skb = sock_dequeue_err_skb(sk); 509 skb = sock_dequeue_err_skb(sk);
512 if (!skb) 510 if (!skb)
diff --git a/net/ipv4/ipmr_base.c b/net/ipv4/ipmr_base.c
index 4fe97723b53f..30221701614c 100644
--- a/net/ipv4/ipmr_base.c
+++ b/net/ipv4/ipmr_base.c
@@ -43,7 +43,10 @@ mr_table_alloc(struct net *net, u32 id,
43 write_pnet(&mrt->net, net); 43 write_pnet(&mrt->net, net);
44 44
45 mrt->ops = *ops; 45 mrt->ops = *ops;
46 rhltable_init(&mrt->mfc_hash, mrt->ops.rht_params); 46 if (rhltable_init(&mrt->mfc_hash, mrt->ops.rht_params)) {
47 kfree(mrt);
48 return NULL;
49 }
47 INIT_LIST_HEAD(&mrt->mfc_cache_list); 50 INIT_LIST_HEAD(&mrt->mfc_cache_list);
48 INIT_LIST_HEAD(&mrt->mfc_unres_queue); 51 INIT_LIST_HEAD(&mrt->mfc_unres_queue);
49 52
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index 0f6c9ca59062..5b5b0f95ffd1 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -401,7 +401,7 @@ u32 mesh_plink_deactivate(struct sta_info *sta)
401 401
402static void mesh_sta_info_init(struct ieee80211_sub_if_data *sdata, 402static void mesh_sta_info_init(struct ieee80211_sub_if_data *sdata,
403 struct sta_info *sta, 403 struct sta_info *sta,
404 struct ieee802_11_elems *elems, bool insert) 404 struct ieee802_11_elems *elems)
405{ 405{
406 struct ieee80211_local *local = sdata->local; 406 struct ieee80211_local *local = sdata->local;
407 struct ieee80211_supported_band *sband; 407 struct ieee80211_supported_band *sband;
@@ -447,7 +447,7 @@ static void mesh_sta_info_init(struct ieee80211_sub_if_data *sdata,
447 sta->sta.bandwidth = IEEE80211_STA_RX_BW_20; 447 sta->sta.bandwidth = IEEE80211_STA_RX_BW_20;
448 } 448 }
449 449
450 if (insert) 450 if (!test_sta_flag(sta, WLAN_STA_RATE_CONTROL))
451 rate_control_rate_init(sta); 451 rate_control_rate_init(sta);
452 else 452 else
453 rate_control_rate_update(local, sband, sta, changed); 453 rate_control_rate_update(local, sband, sta, changed);
@@ -551,7 +551,7 @@ mesh_sta_info_get(struct ieee80211_sub_if_data *sdata,
551 rcu_read_lock(); 551 rcu_read_lock();
552 sta = sta_info_get(sdata, addr); 552 sta = sta_info_get(sdata, addr);
553 if (sta) { 553 if (sta) {
554 mesh_sta_info_init(sdata, sta, elems, false); 554 mesh_sta_info_init(sdata, sta, elems);
555 } else { 555 } else {
556 rcu_read_unlock(); 556 rcu_read_unlock();
557 /* can't run atomic */ 557 /* can't run atomic */
@@ -561,7 +561,7 @@ mesh_sta_info_get(struct ieee80211_sub_if_data *sdata,
561 return NULL; 561 return NULL;
562 } 562 }
563 563
564 mesh_sta_info_init(sdata, sta, elems, true); 564 mesh_sta_info_init(sdata, sta, elems);
565 565
566 if (sta_info_insert_rcu(sta)) 566 if (sta_info_insert_rcu(sta))
567 return NULL; 567 return NULL;
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index e9422fe45179..acb7b86574cd 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2911,7 +2911,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
2911 if (unlikely(offset < 0)) 2911 if (unlikely(offset < 0))
2912 goto out_free; 2912 goto out_free;
2913 } else if (reserve) { 2913 } else if (reserve) {
2914 skb_push(skb, reserve); 2914 skb_reserve(skb, -reserve);
2915 } 2915 }
2916 2916
2917 /* Returns -EFAULT on error */ 2917 /* Returns -EFAULT on error */
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 963e4bf0aab8..a57e112d9b3e 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -1588,7 +1588,7 @@ int tc_setup_cb_call(struct tcf_block *block, struct tcf_exts *exts,
1588 return ret; 1588 return ret;
1589 ok_count = ret; 1589 ok_count = ret;
1590 1590
1591 if (!exts) 1591 if (!exts || ok_count)
1592 return ok_count; 1592 return ok_count;
1593 ret = tc_exts_setup_cb_egdev_call(exts, type, type_data, err_stop); 1593 ret = tc_exts_setup_cb_egdev_call(exts, type, type_data, err_stop);
1594 if (ret < 0) 1594 if (ret < 0)
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 42247110d842..0cd2e764f47f 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -1006,7 +1006,7 @@ static const struct proto_ops inet6_seqpacket_ops = {
1006 .owner = THIS_MODULE, 1006 .owner = THIS_MODULE,
1007 .release = inet6_release, 1007 .release = inet6_release,
1008 .bind = inet6_bind, 1008 .bind = inet6_bind,
1009 .connect = inet_dgram_connect, 1009 .connect = sctp_inet_connect,
1010 .socketpair = sock_no_socketpair, 1010 .socketpair = sock_no_socketpair,
1011 .accept = inet_accept, 1011 .accept = inet_accept,
1012 .getname = sctp_getname, 1012 .getname = sctp_getname,
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index d685f8456762..6bf0a9971888 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -1012,7 +1012,7 @@ static const struct proto_ops inet_seqpacket_ops = {
1012 .owner = THIS_MODULE, 1012 .owner = THIS_MODULE,
1013 .release = inet_release, /* Needs to be wrapped... */ 1013 .release = inet_release, /* Needs to be wrapped... */
1014 .bind = inet_bind, 1014 .bind = inet_bind,
1015 .connect = inet_dgram_connect, 1015 .connect = sctp_inet_connect,
1016 .socketpair = sock_no_socketpair, 1016 .socketpair = sock_no_socketpair,
1017 .accept = inet_accept, 1017 .accept = inet_accept,
1018 .getname = inet_getname, /* Semantics are different. */ 1018 .getname = inet_getname, /* Semantics are different. */
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 80835ac26d2c..ae7e7c606f72 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -1086,7 +1086,7 @@ out:
1086 */ 1086 */
1087static int __sctp_connect(struct sock *sk, 1087static int __sctp_connect(struct sock *sk,
1088 struct sockaddr *kaddrs, 1088 struct sockaddr *kaddrs,
1089 int addrs_size, 1089 int addrs_size, int flags,
1090 sctp_assoc_t *assoc_id) 1090 sctp_assoc_t *assoc_id)
1091{ 1091{
1092 struct net *net = sock_net(sk); 1092 struct net *net = sock_net(sk);
@@ -1104,7 +1104,6 @@ static int __sctp_connect(struct sock *sk,
1104 union sctp_addr *sa_addr = NULL; 1104 union sctp_addr *sa_addr = NULL;
1105 void *addr_buf; 1105 void *addr_buf;
1106 unsigned short port; 1106 unsigned short port;
1107 unsigned int f_flags = 0;
1108 1107
1109 sp = sctp_sk(sk); 1108 sp = sctp_sk(sk);
1110 ep = sp->ep; 1109 ep = sp->ep;
@@ -1254,13 +1253,7 @@ static int __sctp_connect(struct sock *sk,
1254 sp->pf->to_sk_daddr(sa_addr, sk); 1253 sp->pf->to_sk_daddr(sa_addr, sk);
1255 sk->sk_err = 0; 1254 sk->sk_err = 0;
1256 1255
1257 /* in-kernel sockets don't generally have a file allocated to them 1256 timeo = sock_sndtimeo(sk, flags & O_NONBLOCK);
1258 * if all they do is call sock_create_kern().
1259 */
1260 if (sk->sk_socket->file)
1261 f_flags = sk->sk_socket->file->f_flags;
1262
1263 timeo = sock_sndtimeo(sk, f_flags & O_NONBLOCK);
1264 1257
1265 if (assoc_id) 1258 if (assoc_id)
1266 *assoc_id = asoc->assoc_id; 1259 *assoc_id = asoc->assoc_id;
@@ -1348,7 +1341,7 @@ static int __sctp_setsockopt_connectx(struct sock *sk,
1348 sctp_assoc_t *assoc_id) 1341 sctp_assoc_t *assoc_id)
1349{ 1342{
1350 struct sockaddr *kaddrs; 1343 struct sockaddr *kaddrs;
1351 int err = 0; 1344 int err = 0, flags = 0;
1352 1345
1353 pr_debug("%s: sk:%p addrs:%p addrs_size:%d\n", 1346 pr_debug("%s: sk:%p addrs:%p addrs_size:%d\n",
1354 __func__, sk, addrs, addrs_size); 1347 __func__, sk, addrs, addrs_size);
@@ -1367,7 +1360,13 @@ static int __sctp_setsockopt_connectx(struct sock *sk,
1367 if (err) 1360 if (err)
1368 goto out_free; 1361 goto out_free;
1369 1362
1370 err = __sctp_connect(sk, kaddrs, addrs_size, assoc_id); 1363 /* in-kernel sockets don't generally have a file allocated to them
1364 * if all they do is call sock_create_kern().
1365 */
1366 if (sk->sk_socket->file)
1367 flags = sk->sk_socket->file->f_flags;
1368
1369 err = __sctp_connect(sk, kaddrs, addrs_size, flags, assoc_id);
1371 1370
1372out_free: 1371out_free:
1373 kvfree(kaddrs); 1372 kvfree(kaddrs);
@@ -4397,16 +4396,26 @@ out_nounlock:
4397 * len: the size of the address. 4396 * len: the size of the address.
4398 */ 4397 */
4399static int sctp_connect(struct sock *sk, struct sockaddr *addr, 4398static int sctp_connect(struct sock *sk, struct sockaddr *addr,
4400 int addr_len) 4399 int addr_len, int flags)
4401{ 4400{
4402 int err = 0; 4401 struct inet_sock *inet = inet_sk(sk);
4403 struct sctp_af *af; 4402 struct sctp_af *af;
4403 int err = 0;
4404 4404
4405 lock_sock(sk); 4405 lock_sock(sk);
4406 4406
4407 pr_debug("%s: sk:%p, sockaddr:%p, addr_len:%d\n", __func__, sk, 4407 pr_debug("%s: sk:%p, sockaddr:%p, addr_len:%d\n", __func__, sk,
4408 addr, addr_len); 4408 addr, addr_len);
4409 4409
4410 /* We may need to bind the socket. */
4411 if (!inet->inet_num) {
4412 if (sk->sk_prot->get_port(sk, 0)) {
4413 release_sock(sk);
4414 return -EAGAIN;
4415 }
4416 inet->inet_sport = htons(inet->inet_num);
4417 }
4418
4410 /* Validate addr_len before calling common connect/connectx routine. */ 4419 /* Validate addr_len before calling common connect/connectx routine. */
4411 af = sctp_get_af_specific(addr->sa_family); 4420 af = sctp_get_af_specific(addr->sa_family);
4412 if (!af || addr_len < af->sockaddr_len) { 4421 if (!af || addr_len < af->sockaddr_len) {
@@ -4415,13 +4424,25 @@ static int sctp_connect(struct sock *sk, struct sockaddr *addr,
4415 /* Pass correct addr len to common routine (so it knows there 4424 /* Pass correct addr len to common routine (so it knows there
4416 * is only one address being passed. 4425 * is only one address being passed.
4417 */ 4426 */
4418 err = __sctp_connect(sk, addr, af->sockaddr_len, NULL); 4427 err = __sctp_connect(sk, addr, af->sockaddr_len, flags, NULL);
4419 } 4428 }
4420 4429
4421 release_sock(sk); 4430 release_sock(sk);
4422 return err; 4431 return err;
4423} 4432}
4424 4433
4434int sctp_inet_connect(struct socket *sock, struct sockaddr *uaddr,
4435 int addr_len, int flags)
4436{
4437 if (addr_len < sizeof(uaddr->sa_family))
4438 return -EINVAL;
4439
4440 if (uaddr->sa_family == AF_UNSPEC)
4441 return -EOPNOTSUPP;
4442
4443 return sctp_connect(sock->sk, uaddr, addr_len, flags);
4444}
4445
4425/* FIXME: Write comments. */ 4446/* FIXME: Write comments. */
4426static int sctp_disconnect(struct sock *sk, int flags) 4447static int sctp_disconnect(struct sock *sk, int flags)
4427{ 4448{
@@ -8724,7 +8745,6 @@ struct proto sctp_prot = {
8724 .name = "SCTP", 8745 .name = "SCTP",
8725 .owner = THIS_MODULE, 8746 .owner = THIS_MODULE,
8726 .close = sctp_close, 8747 .close = sctp_close,
8727 .connect = sctp_connect,
8728 .disconnect = sctp_disconnect, 8748 .disconnect = sctp_disconnect,
8729 .accept = sctp_accept, 8749 .accept = sctp_accept,
8730 .ioctl = sctp_ioctl, 8750 .ioctl = sctp_ioctl,
@@ -8767,7 +8787,6 @@ struct proto sctpv6_prot = {
8767 .name = "SCTPv6", 8787 .name = "SCTPv6",
8768 .owner = THIS_MODULE, 8788 .owner = THIS_MODULE,
8769 .close = sctp_close, 8789 .close = sctp_close,
8770 .connect = sctp_connect,
8771 .disconnect = sctp_disconnect, 8790 .disconnect = sctp_disconnect,
8772 .accept = sctp_accept, 8791 .accept = sctp_accept,
8773 .ioctl = sctp_ioctl, 8792 .ioctl = sctp_ioctl,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index a052693c2e85..7c5135a92d76 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -15555,7 +15555,8 @@ void cfg80211_ft_event(struct net_device *netdev,
15555 if (!ft_event->target_ap) 15555 if (!ft_event->target_ap)
15556 return; 15556 return;
15557 15557
15558 msg = nlmsg_new(100 + ft_event->ric_ies_len, GFP_KERNEL); 15558 msg = nlmsg_new(100 + ft_event->ies_len + ft_event->ric_ies_len,
15559 GFP_KERNEL);
15559 if (!msg) 15560 if (!msg)
15560 return; 15561 return;
15561 15562
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index ac3e12c32aa3..5fcec5c94eb7 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -916,6 +916,9 @@ int reg_query_regdb_wmm(char *alpha2, int freq, u32 *dbptr,
916 const struct fwdb_header *hdr = regdb; 916 const struct fwdb_header *hdr = regdb;
917 const struct fwdb_country *country; 917 const struct fwdb_country *country;
918 918
919 if (!regdb)
920 return -ENODATA;
921
919 if (IS_ERR(regdb)) 922 if (IS_ERR(regdb))
920 return PTR_ERR(regdb); 923 return PTR_ERR(regdb);
921 924
diff --git a/tools/testing/selftests/bpf/config b/tools/testing/selftests/bpf/config
index 983dd25d49f4..1eefe211a4a8 100644
--- a/tools/testing/selftests/bpf/config
+++ b/tools/testing/selftests/bpf/config
@@ -5,3 +5,5 @@ CONFIG_BPF_EVENTS=y
5CONFIG_TEST_BPF=m 5CONFIG_TEST_BPF=m
6CONFIG_CGROUP_BPF=y 6CONFIG_CGROUP_BPF=y
7CONFIG_NETDEVSIM=m 7CONFIG_NETDEVSIM=m
8CONFIG_NET_CLS_ACT=y
9CONFIG_NET_SCH_INGRESS=y
diff --git a/tools/testing/selftests/net/config b/tools/testing/selftests/net/config
index 6a75a3ea44ad..7ba089b33e8b 100644
--- a/tools/testing/selftests/net/config
+++ b/tools/testing/selftests/net/config
@@ -7,3 +7,8 @@ CONFIG_NET_L3_MASTER_DEV=y
7CONFIG_IPV6=y 7CONFIG_IPV6=y
8CONFIG_IPV6_MULTIPLE_TABLES=y 8CONFIG_IPV6_MULTIPLE_TABLES=y
9CONFIG_VETH=y 9CONFIG_VETH=y
10CONFIG_INET_XFRM_MODE_TUNNEL=y
11CONFIG_NET_IPVTI=y
12CONFIG_INET6_XFRM_MODE_TUNNEL=y
13CONFIG_IPV6_VTI=y
14CONFIG_DUMMY=y
diff --git a/tools/testing/selftests/net/reuseport_bpf_numa.c b/tools/testing/selftests/net/reuseport_bpf_numa.c
index 365c32e84189..c9f478b40996 100644
--- a/tools/testing/selftests/net/reuseport_bpf_numa.c
+++ b/tools/testing/selftests/net/reuseport_bpf_numa.c
@@ -23,6 +23,8 @@
23#include <unistd.h> 23#include <unistd.h>
24#include <numa.h> 24#include <numa.h>
25 25
26#include "../kselftest.h"
27
26static const int PORT = 8888; 28static const int PORT = 8888;
27 29
28static void build_rcv_group(int *rcv_fd, size_t len, int family, int proto) 30static void build_rcv_group(int *rcv_fd, size_t len, int family, int proto)
@@ -229,7 +231,7 @@ int main(void)
229 int *rcv_fd, nodes; 231 int *rcv_fd, nodes;
230 232
231 if (numa_available() < 0) 233 if (numa_available() < 0)
232 error(1, errno, "no numa api support"); 234 ksft_exit_skip("no numa api support\n");
233 235
234 nodes = numa_max_node() + 1; 236 nodes = numa_max_node() + 1;
235 237