diff options
author | Ingo Molnar <mingo@kernel.org> | 2017-11-08 04:17:15 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-11-08 04:17:15 -0500 |
commit | 8a103df440afea30c91ebd42e61dc644e647f4bd (patch) | |
tree | 2cfa99e9c6e1e138e1404bce4294e46cb0034cce /net | |
parent | a9903f04e0a4ea522d959c2f287cdf0ab029e324 (diff) | |
parent | fbc3edf7d7731d7a22c483c679700589bab936a3 (diff) |
Merge branch 'linus' into sched/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'net')
330 files changed, 1091 insertions, 361 deletions
diff --git a/net/6lowpan/6lowpan_i.h b/net/6lowpan/6lowpan_i.h index a67caee11929..53cf446ce2e3 100644 --- a/net/6lowpan/6lowpan_i.h +++ b/net/6lowpan/6lowpan_i.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef __6LOWPAN_I_H | 2 | #ifndef __6LOWPAN_I_H |
2 | #define __6LOWPAN_I_H | 3 | #define __6LOWPAN_I_H |
3 | 4 | ||
diff --git a/net/6lowpan/Makefile b/net/6lowpan/Makefile index 12d131ab2324..2247b96dbc75 100644 --- a/net/6lowpan/Makefile +++ b/net/6lowpan/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | obj-$(CONFIG_6LOWPAN) += 6lowpan.o | 2 | obj-$(CONFIG_6LOWPAN) += 6lowpan.o |
2 | 3 | ||
3 | 6lowpan-y := core.o iphc.o nhc.o ndisc.o | 4 | 6lowpan-y := core.o iphc.o nhc.o ndisc.o |
diff --git a/net/6lowpan/nhc.h b/net/6lowpan/nhc.h index 803041400136..67951c40734b 100644 --- a/net/6lowpan/nhc.h +++ b/net/6lowpan/nhc.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef __6LOWPAN_NHC_H | 2 | #ifndef __6LOWPAN_NHC_H |
2 | #define __6LOWPAN_NHC_H | 3 | #define __6LOWPAN_NHC_H |
3 | 4 | ||
diff --git a/net/802/Makefile b/net/802/Makefile index 37e654d6615e..19406a87bdaa 100644 --- a/net/802/Makefile +++ b/net/802/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the Linux 802.x protocol layers. | 3 | # Makefile for the Linux 802.x protocol layers. |
3 | # | 4 | # |
diff --git a/net/8021q/Makefile b/net/8021q/Makefile index 7bc8db08d7ef..9b703454b93e 100644 --- a/net/8021q/Makefile +++ b/net/8021q/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the Linux VLAN layer. | 3 | # Makefile for the Linux VLAN layer. |
3 | # | 4 | # |
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h index df8bd65dd370..0e7afdf86127 100644 --- a/net/8021q/vlan.h +++ b/net/8021q/vlan.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef __BEN_VLAN_802_1Q_INC__ | 2 | #ifndef __BEN_VLAN_802_1Q_INC__ |
2 | #define __BEN_VLAN_802_1Q_INC__ | 3 | #define __BEN_VLAN_802_1Q_INC__ |
3 | 4 | ||
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c index 0bc31de9071a..64aa9f755e1d 100644 --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/skbuff.h> | 2 | #include <linux/skbuff.h> |
2 | #include <linux/netdevice.h> | 3 | #include <linux/netdevice.h> |
3 | #include <linux/if_vlan.h> | 4 | #include <linux/if_vlan.h> |
diff --git a/net/8021q/vlanproc.h b/net/8021q/vlanproc.h index 8838a2e92eb6..48cd4b4784e8 100644 --- a/net/8021q/vlanproc.h +++ b/net/8021q/vlanproc.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef __BEN_VLAN_PROC_INC__ | 2 | #ifndef __BEN_VLAN_PROC_INC__ |
2 | #define __BEN_VLAN_PROC_INC__ | 3 | #define __BEN_VLAN_PROC_INC__ |
3 | 4 | ||
diff --git a/net/9p/Makefile b/net/9p/Makefile index 697ea7caf466..c0486cfc85d9 100644 --- a/net/9p/Makefile +++ b/net/9p/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | obj-$(CONFIG_NET_9P) := 9pnet.o | 2 | obj-$(CONFIG_NET_9P) := 9pnet.o |
2 | obj-$(CONFIG_NET_9P_XEN) += 9pnet_xen.o | 3 | obj-$(CONFIG_NET_9P_XEN) += 9pnet_xen.o |
3 | obj-$(CONFIG_NET_9P_VIRTIO) += 9pnet_virtio.o | 4 | obj-$(CONFIG_NET_9P_VIRTIO) += 9pnet_virtio.o |
diff --git a/net/Makefile b/net/Makefile index ae2fe2283d2f..14fede520840 100644 --- a/net/Makefile +++ b/net/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the linux networking. | 3 | # Makefile for the linux networking. |
3 | # | 4 | # |
diff --git a/net/appletalk/dev.c b/net/appletalk/dev.c index e4158b8b926d..284c8e585533 100644 --- a/net/appletalk/dev.c +++ b/net/appletalk/dev.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Moved here from drivers/net/net_init.c, which is: | 3 | * Moved here from drivers/net/net_init.c, which is: |
3 | * Written 1993,1994,1995 by Donald Becker. | 4 | * Written 1993,1994,1995 by Donald Becker. |
diff --git a/net/appletalk/sysctl_net_atalk.c b/net/appletalk/sysctl_net_atalk.c index ebb864361f7a..c744a853fa5f 100644 --- a/net/appletalk/sysctl_net_atalk.c +++ b/net/appletalk/sysctl_net_atalk.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * sysctl_net_atalk.c: sysctl interface to net AppleTalk subsystem. | 3 | * sysctl_net_atalk.c: sysctl interface to net AppleTalk subsystem. |
3 | * | 4 | * |
diff --git a/net/atm/Makefile b/net/atm/Makefile index cc50bd1ff1de..bfec0f2d83b5 100644 --- a/net/atm/Makefile +++ b/net/atm/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the ATM Protocol Families. | 3 | # Makefile for the ATM Protocol Families. |
3 | # | 4 | # |
diff --git a/net/atm/addr.c b/net/atm/addr.c index dcda35c66f15..0530b63f509a 100644 --- a/net/atm/addr.c +++ b/net/atm/addr.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* net/atm/addr.c - Local ATM address registry */ | 2 | /* net/atm/addr.c - Local ATM address registry */ |
2 | 3 | ||
3 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ | 4 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ |
diff --git a/net/atm/addr.h b/net/atm/addr.h index 6837e9e7eb13..da3f848411a0 100644 --- a/net/atm/addr.h +++ b/net/atm/addr.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* net/atm/addr.h - Local ATM address registry */ | 2 | /* net/atm/addr.h - Local ATM address registry */ |
2 | 3 | ||
3 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ | 4 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ |
diff --git a/net/atm/atm_misc.c b/net/atm/atm_misc.c index 876fbe83e2e4..a30b83c1cb3f 100644 --- a/net/atm/atm_misc.c +++ b/net/atm/atm_misc.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* net/atm/atm_misc.c - Various functions for use by ATM drivers */ | 2 | /* net/atm/atm_misc.c - Various functions for use by ATM drivers */ |
2 | 3 | ||
3 | /* Written 1995-2000 by Werner Almesberger, EPFL ICA */ | 4 | /* Written 1995-2000 by Werner Almesberger, EPFL ICA */ |
diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c index 350bf62b2ae3..5d2fed9f5710 100644 --- a/net/atm/atm_sysfs.c +++ b/net/atm/atm_sysfs.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* ATM driver model support. */ | 2 | /* ATM driver model support. */ |
2 | 3 | ||
3 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
diff --git a/net/atm/common.h b/net/atm/common.h index 959436b87182..d9d583712a91 100644 --- a/net/atm/common.h +++ b/net/atm/common.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* net/atm/common.h - ATM sockets (common part for PVC and SVC) */ | 2 | /* net/atm/common.h - ATM sockets (common part for PVC and SVC) */ |
2 | 3 | ||
3 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ | 4 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ |
diff --git a/net/atm/ioctl.c b/net/atm/ioctl.c index bbd3b639992e..2ff0e5e470e3 100644 --- a/net/atm/ioctl.c +++ b/net/atm/ioctl.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* ATM ioctl handling */ | 2 | /* ATM ioctl handling */ |
2 | 3 | ||
3 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ | 4 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ |
diff --git a/net/atm/lec.h b/net/atm/lec.h index 4149db1b7885..be0e2667bd8c 100644 --- a/net/atm/lec.h +++ b/net/atm/lec.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Lan Emulation client header file | 3 | * Lan Emulation client header file |
3 | * | 4 | * |
diff --git a/net/atm/lec_arpc.h b/net/atm/lec_arpc.h index d923f53812a3..1205d8792d28 100644 --- a/net/atm/lec_arpc.h +++ b/net/atm/lec_arpc.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Lec arp cache | 3 | * Lec arp cache |
3 | * | 4 | * |
diff --git a/net/atm/mpc.h b/net/atm/mpc.h index cfc7b745aa91..454abd07651a 100644 --- a/net/atm/mpc.h +++ b/net/atm/mpc.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef _MPC_H_ | 2 | #ifndef _MPC_H_ |
2 | #define _MPC_H_ | 3 | #define _MPC_H_ |
3 | 4 | ||
diff --git a/net/atm/mpoa_caches.c b/net/atm/mpoa_caches.c index 4ccaa16b1eb1..e01450bb32d6 100644 --- a/net/atm/mpoa_caches.c +++ b/net/atm/mpoa_caches.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/types.h> | 2 | #include <linux/types.h> |
2 | #include <linux/atmmpc.h> | 3 | #include <linux/atmmpc.h> |
3 | #include <linux/slab.h> | 4 | #include <linux/slab.h> |
diff --git a/net/atm/mpoa_caches.h b/net/atm/mpoa_caches.h index 30fe34841ced..6a266669ebf4 100644 --- a/net/atm/mpoa_caches.h +++ b/net/atm/mpoa_caches.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef MPOA_CACHES_H | 2 | #ifndef MPOA_CACHES_H |
2 | #define MPOA_CACHES_H | 3 | #define MPOA_CACHES_H |
3 | 4 | ||
diff --git a/net/atm/mpoa_proc.c b/net/atm/mpoa_proc.c index 2df34eb5d65f..8a0c17e1c203 100644 --- a/net/atm/mpoa_proc.c +++ b/net/atm/mpoa_proc.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__ | 2 | #define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__ |
2 | 3 | ||
3 | #ifdef CONFIG_PROC_FS | 4 | #ifdef CONFIG_PROC_FS |
diff --git a/net/atm/proc.c b/net/atm/proc.c index 4caca2a90ec4..642f9272ab95 100644 --- a/net/atm/proc.c +++ b/net/atm/proc.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* net/atm/proc.c - ATM /proc interface | 2 | /* net/atm/proc.c - ATM /proc interface |
2 | * | 3 | * |
3 | * Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA | 4 | * Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA |
diff --git a/net/atm/protocols.h b/net/atm/protocols.h index acdfc856222d..18d4d008bac3 100644 --- a/net/atm/protocols.h +++ b/net/atm/protocols.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* net/atm/protocols.h - ATM protocol handler entry points */ | 2 | /* net/atm/protocols.h - ATM protocol handler entry points */ |
2 | 3 | ||
3 | /* Written 1995-1997 by Werner Almesberger, EPFL LRC */ | 4 | /* Written 1995-1997 by Werner Almesberger, EPFL LRC */ |
diff --git a/net/atm/pvc.c b/net/atm/pvc.c index 040207ec399f..e1140b3bdcaa 100644 --- a/net/atm/pvc.c +++ b/net/atm/pvc.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* net/atm/pvc.c - ATM PVC sockets */ | 2 | /* net/atm/pvc.c - ATM PVC sockets */ |
2 | 3 | ||
3 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ | 4 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ |
diff --git a/net/atm/raw.c b/net/atm/raw.c index 821c0797553d..ee10e8d46185 100644 --- a/net/atm/raw.c +++ b/net/atm/raw.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* net/atm/raw.c - Raw AAL0 and AAL5 transports */ | 2 | /* net/atm/raw.c - Raw AAL0 and AAL5 transports */ |
2 | 3 | ||
3 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ | 4 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ |
diff --git a/net/atm/resources.c b/net/atm/resources.c index 918244757b7d..bada395ecdb1 100644 --- a/net/atm/resources.c +++ b/net/atm/resources.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* net/atm/resources.c - Statically allocated resources */ | 2 | /* net/atm/resources.c - Statically allocated resources */ |
2 | 3 | ||
3 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ | 4 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ |
diff --git a/net/atm/resources.h b/net/atm/resources.h index 521431e30507..048232e4d4c6 100644 --- a/net/atm/resources.h +++ b/net/atm/resources.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* net/atm/resources.h - ATM-related resources */ | 2 | /* net/atm/resources.h - ATM-related resources */ |
2 | 3 | ||
3 | /* Written 1995-1998 by Werner Almesberger, EPFL LRC/ICA */ | 4 | /* Written 1995-1998 by Werner Almesberger, EPFL LRC/ICA */ |
diff --git a/net/atm/signaling.c b/net/atm/signaling.c index 0a20f6e953ac..6c11cdf4dd4c 100644 --- a/net/atm/signaling.c +++ b/net/atm/signaling.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* net/atm/signaling.c - ATM signaling */ | 2 | /* net/atm/signaling.c - ATM signaling */ |
2 | 3 | ||
3 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ | 4 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ |
diff --git a/net/atm/signaling.h b/net/atm/signaling.h index 08b2a69cc572..2df8220f7ab5 100644 --- a/net/atm/signaling.h +++ b/net/atm/signaling.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* net/atm/signaling.h - ATM signaling */ | 2 | /* net/atm/signaling.h - ATM signaling */ |
2 | 3 | ||
3 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ | 4 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ |
diff --git a/net/atm/svc.c b/net/atm/svc.c index 5589de7086af..c458adcbc177 100644 --- a/net/atm/svc.c +++ b/net/atm/svc.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* net/atm/svc.c - ATM SVC sockets */ | 2 | /* net/atm/svc.c - ATM SVC sockets */ |
2 | 3 | ||
3 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ | 4 | /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ |
diff --git a/net/ax25/Makefile b/net/ax25/Makefile index 43c46d2cafb6..2e53affc8568 100644 --- a/net/ax25/Makefile +++ b/net/ax25/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the Linux AX.25 layer. | 3 | # Makefile for the Linux AX.25 layer. |
3 | # | 4 | # |
diff --git a/net/bluetooth/Makefile b/net/bluetooth/Makefile index 5d0a113e2e40..fda41c0b4781 100644 --- a/net/bluetooth/Makefile +++ b/net/bluetooth/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the Linux Bluetooth subsystem. | 3 | # Makefile for the Linux Bluetooth subsystem. |
3 | # | 4 | # |
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index aa300f3a0d51..d5c7c89ec4d6 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* Bluetooth HCI driver model support. */ | 2 | /* Bluetooth HCI driver model support. */ |
2 | 3 | ||
3 | #include <linux/module.h> | 4 | #include <linux/module.h> |
diff --git a/net/bridge/Makefile b/net/bridge/Makefile index 40b1ede527ca..f760e62a672a 100644 --- a/net/bridge/Makefile +++ b/net/bridge/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the IEEE 802.1d ethernet bridging layer. | 3 | # Makefile for the IEEE 802.1d ethernet bridging layer. |
3 | # | 4 | # |
diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index ca01def49af0..31ddff22563e 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/err.h> | 2 | #include <linux/err.h> |
2 | #include <linux/igmp.h> | 3 | #include <linux/igmp.h> |
3 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index 3bc890716c89..de2152730809 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c | |||
@@ -573,7 +573,7 @@ static int br_process_vlan_info(struct net_bridge *br, | |||
573 | } | 573 | } |
574 | *vinfo_last = NULL; | 574 | *vinfo_last = NULL; |
575 | 575 | ||
576 | return 0; | 576 | return err; |
577 | } | 577 | } |
578 | 578 | ||
579 | return br_vlan_info(br, p, cmd, vinfo_curr); | 579 | return br_vlan_info(br, p, cmd, vinfo_curr); |
diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c index f6b1c7de059d..9700e0f3307b 100644 --- a/net/bridge/br_switchdev.c +++ b/net/bridge/br_switchdev.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/kernel.h> | 2 | #include <linux/kernel.h> |
2 | #include <linux/list.h> | 3 | #include <linux/list.h> |
3 | #include <linux/netdevice.h> | 4 | #include <linux/netdevice.h> |
diff --git a/net/bridge/netfilter/Makefile b/net/bridge/netfilter/Makefile index be4d0cea78ce..2f28e16de6c7 100644 --- a/net/bridge/netfilter/Makefile +++ b/net/bridge/netfilter/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the netfilter modules for Link Layer filtering on a bridge. | 3 | # Makefile for the netfilter modules for Link Layer filtering on a bridge. |
3 | # | 4 | # |
diff --git a/net/caif/Makefile b/net/caif/Makefile index cc2b51154d03..4f6c0517cdfb 100644 --- a/net/caif/Makefile +++ b/net/caif/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | ccflags-$(CONFIG_CAIF_DEBUG) := -DDEBUG | 2 | ccflags-$(CONFIG_CAIF_DEBUG) := -DDEBUG |
2 | 3 | ||
3 | caif-y := caif_dev.o \ | 4 | caif-y := caif_dev.o \ |
diff --git a/net/can/Makefile b/net/can/Makefile index 10936754e3f2..1242bbbfe57f 100644 --- a/net/can/Makefile +++ b/net/can/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the Linux Controller Area Network core. | 3 | # Makefile for the Linux Controller Area Network core. |
3 | # | 4 | # |
diff --git a/net/can/af_can.c b/net/can/af_can.c index 88edac0f3e36..ecd5c703d11e 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c | |||
@@ -78,7 +78,7 @@ MODULE_PARM_DESC(stats_timer, "enable timer for statistics (default:on)"); | |||
78 | static struct kmem_cache *rcv_cache __read_mostly; | 78 | static struct kmem_cache *rcv_cache __read_mostly; |
79 | 79 | ||
80 | /* table of registered CAN protocols */ | 80 | /* table of registered CAN protocols */ |
81 | static const struct can_proto *proto_tab[CAN_NPROTO] __read_mostly; | 81 | static const struct can_proto __rcu *proto_tab[CAN_NPROTO] __read_mostly; |
82 | static DEFINE_MUTEX(proto_tab_lock); | 82 | static DEFINE_MUTEX(proto_tab_lock); |
83 | 83 | ||
84 | static atomic_t skbcounter = ATOMIC_INIT(0); | 84 | static atomic_t skbcounter = ATOMIC_INIT(0); |
@@ -788,7 +788,7 @@ int can_proto_register(const struct can_proto *cp) | |||
788 | 788 | ||
789 | mutex_lock(&proto_tab_lock); | 789 | mutex_lock(&proto_tab_lock); |
790 | 790 | ||
791 | if (proto_tab[proto]) { | 791 | if (rcu_access_pointer(proto_tab[proto])) { |
792 | pr_err("can: protocol %d already registered\n", proto); | 792 | pr_err("can: protocol %d already registered\n", proto); |
793 | err = -EBUSY; | 793 | err = -EBUSY; |
794 | } else | 794 | } else |
@@ -812,7 +812,7 @@ void can_proto_unregister(const struct can_proto *cp) | |||
812 | int proto = cp->protocol; | 812 | int proto = cp->protocol; |
813 | 813 | ||
814 | mutex_lock(&proto_tab_lock); | 814 | mutex_lock(&proto_tab_lock); |
815 | BUG_ON(proto_tab[proto] != cp); | 815 | BUG_ON(rcu_access_pointer(proto_tab[proto]) != cp); |
816 | RCU_INIT_POINTER(proto_tab[proto], NULL); | 816 | RCU_INIT_POINTER(proto_tab[proto], NULL); |
817 | mutex_unlock(&proto_tab_lock); | 817 | mutex_unlock(&proto_tab_lock); |
818 | 818 | ||
@@ -875,9 +875,14 @@ static int can_pernet_init(struct net *net) | |||
875 | spin_lock_init(&net->can.can_rcvlists_lock); | 875 | spin_lock_init(&net->can.can_rcvlists_lock); |
876 | net->can.can_rx_alldev_list = | 876 | net->can.can_rx_alldev_list = |
877 | kzalloc(sizeof(struct dev_rcv_lists), GFP_KERNEL); | 877 | kzalloc(sizeof(struct dev_rcv_lists), GFP_KERNEL); |
878 | 878 | if (!net->can.can_rx_alldev_list) | |
879 | goto out; | ||
879 | net->can.can_stats = kzalloc(sizeof(struct s_stats), GFP_KERNEL); | 880 | net->can.can_stats = kzalloc(sizeof(struct s_stats), GFP_KERNEL); |
881 | if (!net->can.can_stats) | ||
882 | goto out_free_alldev_list; | ||
880 | net->can.can_pstats = kzalloc(sizeof(struct s_pstats), GFP_KERNEL); | 883 | net->can.can_pstats = kzalloc(sizeof(struct s_pstats), GFP_KERNEL); |
884 | if (!net->can.can_pstats) | ||
885 | goto out_free_can_stats; | ||
881 | 886 | ||
882 | if (IS_ENABLED(CONFIG_PROC_FS)) { | 887 | if (IS_ENABLED(CONFIG_PROC_FS)) { |
883 | /* the statistics are updated every second (timer triggered) */ | 888 | /* the statistics are updated every second (timer triggered) */ |
@@ -892,6 +897,13 @@ static int can_pernet_init(struct net *net) | |||
892 | } | 897 | } |
893 | 898 | ||
894 | return 0; | 899 | return 0; |
900 | |||
901 | out_free_can_stats: | ||
902 | kfree(net->can.can_stats); | ||
903 | out_free_alldev_list: | ||
904 | kfree(net->can.can_rx_alldev_list); | ||
905 | out: | ||
906 | return -ENOMEM; | ||
895 | } | 907 | } |
896 | 908 | ||
897 | static void can_pernet_exit(struct net *net) | 909 | static void can_pernet_exit(struct net *net) |
diff --git a/net/can/bcm.c b/net/can/bcm.c index 47a8748d953a..13690334efa3 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c | |||
@@ -1493,13 +1493,14 @@ static int bcm_init(struct sock *sk) | |||
1493 | static int bcm_release(struct socket *sock) | 1493 | static int bcm_release(struct socket *sock) |
1494 | { | 1494 | { |
1495 | struct sock *sk = sock->sk; | 1495 | struct sock *sk = sock->sk; |
1496 | struct net *net = sock_net(sk); | 1496 | struct net *net; |
1497 | struct bcm_sock *bo; | 1497 | struct bcm_sock *bo; |
1498 | struct bcm_op *op, *next; | 1498 | struct bcm_op *op, *next; |
1499 | 1499 | ||
1500 | if (sk == NULL) | 1500 | if (!sk) |
1501 | return 0; | 1501 | return 0; |
1502 | 1502 | ||
1503 | net = sock_net(sk); | ||
1503 | bo = bcm_sk(sk); | 1504 | bo = bcm_sk(sk); |
1504 | 1505 | ||
1505 | /* remove bcm_ops, timer, rx_unregister(), etc. */ | 1506 | /* remove bcm_ops, timer, rx_unregister(), etc. */ |
diff --git a/net/ceph/Makefile b/net/ceph/Makefile index 6a5180903e7b..b4bded4b5396 100644 --- a/net/ceph/Makefile +++ b/net/ceph/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for CEPH filesystem. | 3 | # Makefile for CEPH filesystem. |
3 | # | 4 | # |
diff --git a/net/ceph/armor.c b/net/ceph/armor.c index 1fc1ee11dfa2..0db8065928df 100644 --- a/net/ceph/armor.c +++ b/net/ceph/armor.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | 2 | ||
2 | #include <linux/errno.h> | 3 | #include <linux/errno.h> |
3 | 4 | ||
diff --git a/net/ceph/auth.c b/net/ceph/auth.c index 48bb8d95195b..dbde2b3c3c15 100644 --- a/net/ceph/auth.c +++ b/net/ceph/auth.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/ceph/ceph_debug.h> | 2 | #include <linux/ceph/ceph_debug.h> |
2 | 3 | ||
3 | #include <linux/module.h> | 4 | #include <linux/module.h> |
diff --git a/net/ceph/auth_none.c b/net/ceph/auth_none.c index df45e467c81f..41d2a0c72236 100644 --- a/net/ceph/auth_none.c +++ b/net/ceph/auth_none.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | 2 | ||
2 | #include <linux/ceph/ceph_debug.h> | 3 | #include <linux/ceph/ceph_debug.h> |
3 | 4 | ||
diff --git a/net/ceph/auth_none.h b/net/ceph/auth_none.h index 62021535ae4a..860ed9875791 100644 --- a/net/ceph/auth_none.h +++ b/net/ceph/auth_none.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef _FS_CEPH_AUTH_NONE_H | 2 | #ifndef _FS_CEPH_AUTH_NONE_H |
2 | #define _FS_CEPH_AUTH_NONE_H | 3 | #define _FS_CEPH_AUTH_NONE_H |
3 | 4 | ||
diff --git a/net/ceph/auth_x.c b/net/ceph/auth_x.c index 8757fb87dab8..2f4a1baf5f52 100644 --- a/net/ceph/auth_x.c +++ b/net/ceph/auth_x.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | 2 | ||
2 | #include <linux/ceph/ceph_debug.h> | 3 | #include <linux/ceph/ceph_debug.h> |
3 | 4 | ||
diff --git a/net/ceph/auth_x.h b/net/ceph/auth_x.h index 48e9ad41bd2a..454cb54568af 100644 --- a/net/ceph/auth_x.h +++ b/net/ceph/auth_x.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef _FS_CEPH_AUTH_X_H | 2 | #ifndef _FS_CEPH_AUTH_X_H |
2 | #define _FS_CEPH_AUTH_X_H | 3 | #define _FS_CEPH_AUTH_X_H |
3 | 4 | ||
diff --git a/net/ceph/auth_x_protocol.h b/net/ceph/auth_x_protocol.h index 671d30576c4f..32c13d763b9a 100644 --- a/net/ceph/auth_x_protocol.h +++ b/net/ceph/auth_x_protocol.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef __FS_CEPH_AUTH_X_PROTOCOL | 2 | #ifndef __FS_CEPH_AUTH_X_PROTOCOL |
2 | #define __FS_CEPH_AUTH_X_PROTOCOL | 3 | #define __FS_CEPH_AUTH_X_PROTOCOL |
3 | 4 | ||
diff --git a/net/ceph/buffer.c b/net/ceph/buffer.c index add5f921a0ff..5622763ad402 100644 --- a/net/ceph/buffer.c +++ b/net/ceph/buffer.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | 2 | ||
2 | #include <linux/ceph/ceph_debug.h> | 3 | #include <linux/ceph/ceph_debug.h> |
3 | 4 | ||
diff --git a/net/ceph/ceph_fs.c b/net/ceph/ceph_fs.c index dcbe67ff3e2b..756a2dc10d27 100644 --- a/net/ceph/ceph_fs.c +++ b/net/ceph/ceph_fs.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Some non-inline ceph helpers | 3 | * Some non-inline ceph helpers |
3 | */ | 4 | */ |
diff --git a/net/ceph/ceph_strings.c b/net/ceph/ceph_strings.c index 19b7d8aa915c..10e01494993c 100644 --- a/net/ceph/ceph_strings.c +++ b/net/ceph/ceph_strings.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Ceph string constants | 3 | * Ceph string constants |
3 | */ | 4 | */ |
diff --git a/net/ceph/cls_lock_client.c b/net/ceph/cls_lock_client.c index 08ada893f01e..8d2032b2f225 100644 --- a/net/ceph/cls_lock_client.c +++ b/net/ceph/cls_lock_client.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/ceph/ceph_debug.h> | 2 | #include <linux/ceph/ceph_debug.h> |
2 | 3 | ||
3 | #include <linux/types.h> | 4 | #include <linux/types.h> |
diff --git a/net/ceph/crush/crush.c b/net/ceph/crush/crush.c index 4b428f46a8ca..3d70244bc1b6 100644 --- a/net/ceph/crush/crush.c +++ b/net/ceph/crush/crush.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #ifdef __KERNEL__ | 2 | #ifdef __KERNEL__ |
2 | # include <linux/slab.h> | 3 | # include <linux/slab.h> |
3 | # include <linux/crush/crush.h> | 4 | # include <linux/crush/crush.h> |
diff --git a/net/ceph/crush/hash.c b/net/ceph/crush/hash.c index ed123af49eba..e5cc603cdb17 100644 --- a/net/ceph/crush/hash.c +++ b/net/ceph/crush/hash.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #ifdef __KERNEL__ | 2 | #ifdef __KERNEL__ |
2 | # include <linux/crush/hash.h> | 3 | # include <linux/crush/hash.h> |
3 | #else | 4 | #else |
diff --git a/net/ceph/crypto.c b/net/ceph/crypto.c index 46008d5ac504..489610ac1cdd 100644 --- a/net/ceph/crypto.c +++ b/net/ceph/crypto.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | 2 | ||
2 | #include <linux/ceph/ceph_debug.h> | 3 | #include <linux/ceph/ceph_debug.h> |
3 | 4 | ||
diff --git a/net/ceph/crypto.h b/net/ceph/crypto.h index 58d83aa7740f..bb45c7d43739 100644 --- a/net/ceph/crypto.h +++ b/net/ceph/crypto.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef _FS_CEPH_CRYPTO_H | 2 | #ifndef _FS_CEPH_CRYPTO_H |
2 | #define _FS_CEPH_CRYPTO_H | 3 | #define _FS_CEPH_CRYPTO_H |
3 | 4 | ||
diff --git a/net/ceph/debugfs.c b/net/ceph/debugfs.c index fa5233e0d01c..1eef6806aa1a 100644 --- a/net/ceph/debugfs.c +++ b/net/ceph/debugfs.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/ceph/ceph_debug.h> | 2 | #include <linux/ceph/ceph_debug.h> |
2 | 3 | ||
3 | #include <linux/device.h> | 4 | #include <linux/device.h> |
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index a67298c7e0cd..ad93342c90d7 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/ceph/ceph_debug.h> | 2 | #include <linux/ceph/ceph_debug.h> |
2 | 3 | ||
3 | #include <linux/crc32c.h> | 4 | #include <linux/crc32c.h> |
diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c index 63edc6e5f026..9ae1bab8c05d 100644 --- a/net/ceph/mon_client.c +++ b/net/ceph/mon_client.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/ceph/ceph_debug.h> | 2 | #include <linux/ceph/ceph_debug.h> |
2 | 3 | ||
3 | #include <linux/module.h> | 4 | #include <linux/module.h> |
diff --git a/net/ceph/msgpool.c b/net/ceph/msgpool.c index aaed59a47b1d..72571535883f 100644 --- a/net/ceph/msgpool.c +++ b/net/ceph/msgpool.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/ceph/ceph_debug.h> | 2 | #include <linux/ceph/ceph_debug.h> |
2 | 3 | ||
3 | #include <linux/err.h> | 4 | #include <linux/err.h> |
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index e02f01f534e2..2814dba5902d 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | 2 | ||
2 | #include <linux/ceph/ceph_debug.h> | 3 | #include <linux/ceph/ceph_debug.h> |
3 | 4 | ||
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c index 79d14d70b7ea..0da27c66349a 100644 --- a/net/ceph/osdmap.c +++ b/net/ceph/osdmap.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | 2 | ||
2 | #include <linux/ceph/ceph_debug.h> | 3 | #include <linux/ceph/ceph_debug.h> |
3 | 4 | ||
diff --git a/net/ceph/pagelist.c b/net/ceph/pagelist.c index ce09f73be759..2ea0564771d2 100644 --- a/net/ceph/pagelist.c +++ b/net/ceph/pagelist.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/module.h> | 2 | #include <linux/module.h> |
2 | #include <linux/gfp.h> | 3 | #include <linux/gfp.h> |
3 | #include <linux/slab.h> | 4 | #include <linux/slab.h> |
diff --git a/net/ceph/pagevec.c b/net/ceph/pagevec.c index 1a7c9a79a53c..ee43bc13221c 100644 --- a/net/ceph/pagevec.c +++ b/net/ceph/pagevec.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/ceph/ceph_debug.h> | 2 | #include <linux/ceph/ceph_debug.h> |
2 | 3 | ||
3 | #include <linux/module.h> | 4 | #include <linux/module.h> |
diff --git a/net/ceph/string_table.c b/net/ceph/string_table.c index 22fb96efcf34..3191d9d160a2 100644 --- a/net/ceph/string_table.c +++ b/net/ceph/string_table.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/slab.h> | 2 | #include <linux/slab.h> |
2 | #include <linux/gfp.h> | 3 | #include <linux/gfp.h> |
3 | #include <linux/string.h> | 4 | #include <linux/string.h> |
diff --git a/net/core/Makefile b/net/core/Makefile index 56d771a887b6..1fd0a9c88b1b 100644 --- a/net/core/Makefile +++ b/net/core/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the Linux networking core. | 3 | # Makefile for the Linux networking core. |
3 | # | 4 | # |
diff --git a/net/core/datagram.c b/net/core/datagram.c index f7fb7e3f2acf..3964c108b169 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * SUCS NET3: | 3 | * SUCS NET3: |
3 | * | 4 | * |
diff --git a/net/core/dev.c b/net/core/dev.c index 588b473194a8..11596a302a26 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1147,9 +1147,8 @@ static int dev_alloc_name_ns(struct net *net, | |||
1147 | return ret; | 1147 | return ret; |
1148 | } | 1148 | } |
1149 | 1149 | ||
1150 | static int dev_get_valid_name(struct net *net, | 1150 | int dev_get_valid_name(struct net *net, struct net_device *dev, |
1151 | struct net_device *dev, | 1151 | const char *name) |
1152 | const char *name) | ||
1153 | { | 1152 | { |
1154 | BUG_ON(!net); | 1153 | BUG_ON(!net); |
1155 | 1154 | ||
@@ -1165,6 +1164,7 @@ static int dev_get_valid_name(struct net *net, | |||
1165 | 1164 | ||
1166 | return 0; | 1165 | return 0; |
1167 | } | 1166 | } |
1167 | EXPORT_SYMBOL(dev_get_valid_name); | ||
1168 | 1168 | ||
1169 | /** | 1169 | /** |
1170 | * dev_change_name - change name of a device | 1170 | * dev_change_name - change name of a device |
diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c index 709a4e6fb447..7e690d0ccd05 100644 --- a/net/core/dev_ioctl.c +++ b/net/core/dev_ioctl.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/kmod.h> | 2 | #include <linux/kmod.h> |
2 | #include <linux/netdevice.h> | 3 | #include <linux/netdevice.h> |
3 | #include <linux/etherdevice.h> | 4 | #include <linux/etherdevice.h> |
@@ -303,7 +304,18 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, unsigned int cmd) | |||
303 | case SIOCSIFTXQLEN: | 304 | case SIOCSIFTXQLEN: |
304 | if (ifr->ifr_qlen < 0) | 305 | if (ifr->ifr_qlen < 0) |
305 | return -EINVAL; | 306 | return -EINVAL; |
306 | dev->tx_queue_len = ifr->ifr_qlen; | 307 | if (dev->tx_queue_len ^ ifr->ifr_qlen) { |
308 | unsigned int orig_len = dev->tx_queue_len; | ||
309 | |||
310 | dev->tx_queue_len = ifr->ifr_qlen; | ||
311 | err = call_netdevice_notifiers( | ||
312 | NETDEV_CHANGE_TX_QUEUE_LEN, dev); | ||
313 | err = notifier_to_errno(err); | ||
314 | if (err) { | ||
315 | dev->tx_queue_len = orig_len; | ||
316 | return err; | ||
317 | } | ||
318 | } | ||
307 | return 0; | 319 | return 0; |
308 | 320 | ||
309 | case SIOCSIFNAME: | 321 | case SIOCSIFNAME: |
diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 3228411ada0f..9a9a3d77e327 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c | |||
@@ -436,7 +436,7 @@ bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32, | |||
436 | EXPORT_SYMBOL(ethtool_convert_link_mode_to_legacy_u32); | 436 | EXPORT_SYMBOL(ethtool_convert_link_mode_to_legacy_u32); |
437 | 437 | ||
438 | /* return false if legacy contained non-0 deprecated fields | 438 | /* return false if legacy contained non-0 deprecated fields |
439 | * transceiver/maxtxpkt/maxrxpkt. rest of ksettings always updated | 439 | * maxtxpkt/maxrxpkt. rest of ksettings always updated |
440 | */ | 440 | */ |
441 | static bool | 441 | static bool |
442 | convert_legacy_settings_to_link_ksettings( | 442 | convert_legacy_settings_to_link_ksettings( |
@@ -451,8 +451,7 @@ convert_legacy_settings_to_link_ksettings( | |||
451 | * deprecated legacy fields, and they should not use | 451 | * deprecated legacy fields, and they should not use |
452 | * %ETHTOOL_GLINKSETTINGS/%ETHTOOL_SLINKSETTINGS | 452 | * %ETHTOOL_GLINKSETTINGS/%ETHTOOL_SLINKSETTINGS |
453 | */ | 453 | */ |
454 | if (legacy_settings->transceiver || | 454 | if (legacy_settings->maxtxpkt || |
455 | legacy_settings->maxtxpkt || | ||
456 | legacy_settings->maxrxpkt) | 455 | legacy_settings->maxrxpkt) |
457 | retval = false; | 456 | retval = false; |
458 | 457 | ||
diff --git a/net/core/filter.c b/net/core/filter.c index 74b8c91fb5f4..6ae94f825f72 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -1839,31 +1839,32 @@ static const struct bpf_func_proto bpf_redirect_proto = { | |||
1839 | .arg2_type = ARG_ANYTHING, | 1839 | .arg2_type = ARG_ANYTHING, |
1840 | }; | 1840 | }; |
1841 | 1841 | ||
1842 | BPF_CALL_3(bpf_sk_redirect_map, struct bpf_map *, map, u32, key, u64, flags) | 1842 | BPF_CALL_4(bpf_sk_redirect_map, struct sk_buff *, skb, |
1843 | struct bpf_map *, map, u32, key, u64, flags) | ||
1843 | { | 1844 | { |
1844 | struct redirect_info *ri = this_cpu_ptr(&redirect_info); | 1845 | struct tcp_skb_cb *tcb = TCP_SKB_CB(skb); |
1845 | 1846 | ||
1847 | /* If user passes invalid input drop the packet. */ | ||
1846 | if (unlikely(flags)) | 1848 | if (unlikely(flags)) |
1847 | return SK_ABORTED; | 1849 | return SK_DROP; |
1848 | 1850 | ||
1849 | ri->ifindex = key; | 1851 | tcb->bpf.key = key; |
1850 | ri->flags = flags; | 1852 | tcb->bpf.flags = flags; |
1851 | ri->map = map; | 1853 | tcb->bpf.map = map; |
1852 | 1854 | ||
1853 | return SK_REDIRECT; | 1855 | return SK_PASS; |
1854 | } | 1856 | } |
1855 | 1857 | ||
1856 | struct sock *do_sk_redirect_map(void) | 1858 | struct sock *do_sk_redirect_map(struct sk_buff *skb) |
1857 | { | 1859 | { |
1858 | struct redirect_info *ri = this_cpu_ptr(&redirect_info); | 1860 | struct tcp_skb_cb *tcb = TCP_SKB_CB(skb); |
1859 | struct sock *sk = NULL; | 1861 | struct sock *sk = NULL; |
1860 | 1862 | ||
1861 | if (ri->map) { | 1863 | if (tcb->bpf.map) { |
1862 | sk = __sock_map_lookup_elem(ri->map, ri->ifindex); | 1864 | sk = __sock_map_lookup_elem(tcb->bpf.map, tcb->bpf.key); |
1863 | 1865 | ||
1864 | ri->ifindex = 0; | 1866 | tcb->bpf.key = 0; |
1865 | ri->map = NULL; | 1867 | tcb->bpf.map = NULL; |
1866 | /* we do not clear flags for future lookup */ | ||
1867 | } | 1868 | } |
1868 | 1869 | ||
1869 | return sk; | 1870 | return sk; |
@@ -1873,9 +1874,10 @@ static const struct bpf_func_proto bpf_sk_redirect_map_proto = { | |||
1873 | .func = bpf_sk_redirect_map, | 1874 | .func = bpf_sk_redirect_map, |
1874 | .gpl_only = false, | 1875 | .gpl_only = false, |
1875 | .ret_type = RET_INTEGER, | 1876 | .ret_type = RET_INTEGER, |
1876 | .arg1_type = ARG_CONST_MAP_PTR, | 1877 | .arg1_type = ARG_PTR_TO_CTX, |
1877 | .arg2_type = ARG_ANYTHING, | 1878 | .arg2_type = ARG_CONST_MAP_PTR, |
1878 | .arg3_type = ARG_ANYTHING, | 1879 | .arg3_type = ARG_ANYTHING, |
1880 | .arg4_type = ARG_ANYTHING, | ||
1879 | }; | 1881 | }; |
1880 | 1882 | ||
1881 | BPF_CALL_1(bpf_get_cgroup_classid, const struct sk_buff *, skb) | 1883 | BPF_CALL_1(bpf_get_cgroup_classid, const struct sk_buff *, skb) |
@@ -3683,7 +3685,6 @@ static bool sk_skb_is_valid_access(int off, int size, | |||
3683 | { | 3685 | { |
3684 | if (type == BPF_WRITE) { | 3686 | if (type == BPF_WRITE) { |
3685 | switch (off) { | 3687 | switch (off) { |
3686 | case bpf_ctx_range(struct __sk_buff, mark): | ||
3687 | case bpf_ctx_range(struct __sk_buff, tc_index): | 3688 | case bpf_ctx_range(struct __sk_buff, tc_index): |
3688 | case bpf_ctx_range(struct __sk_buff, priority): | 3689 | case bpf_ctx_range(struct __sk_buff, priority): |
3689 | break; | 3690 | break; |
@@ -3693,6 +3694,7 @@ static bool sk_skb_is_valid_access(int off, int size, | |||
3693 | } | 3694 | } |
3694 | 3695 | ||
3695 | switch (off) { | 3696 | switch (off) { |
3697 | case bpf_ctx_range(struct __sk_buff, mark): | ||
3696 | case bpf_ctx_range(struct __sk_buff, tc_classid): | 3698 | case bpf_ctx_range(struct __sk_buff, tc_classid): |
3697 | return false; | 3699 | return false; |
3698 | case bpf_ctx_range(struct __sk_buff, data): | 3700 | case bpf_ctx_range(struct __sk_buff, data): |
@@ -4242,6 +4244,31 @@ static u32 sock_ops_convert_ctx_access(enum bpf_access_type type, | |||
4242 | return insn - insn_buf; | 4244 | return insn - insn_buf; |
4243 | } | 4245 | } |
4244 | 4246 | ||
4247 | static u32 sk_skb_convert_ctx_access(enum bpf_access_type type, | ||
4248 | const struct bpf_insn *si, | ||
4249 | struct bpf_insn *insn_buf, | ||
4250 | struct bpf_prog *prog, u32 *target_size) | ||
4251 | { | ||
4252 | struct bpf_insn *insn = insn_buf; | ||
4253 | int off; | ||
4254 | |||
4255 | switch (si->off) { | ||
4256 | case offsetof(struct __sk_buff, data_end): | ||
4257 | off = si->off; | ||
4258 | off -= offsetof(struct __sk_buff, data_end); | ||
4259 | off += offsetof(struct sk_buff, cb); | ||
4260 | off += offsetof(struct tcp_skb_cb, bpf.data_end); | ||
4261 | *insn++ = BPF_LDX_MEM(BPF_SIZEOF(void *), si->dst_reg, | ||
4262 | si->src_reg, off); | ||
4263 | break; | ||
4264 | default: | ||
4265 | return bpf_convert_ctx_access(type, si, insn_buf, prog, | ||
4266 | target_size); | ||
4267 | } | ||
4268 | |||
4269 | return insn - insn_buf; | ||
4270 | } | ||
4271 | |||
4245 | const struct bpf_verifier_ops sk_filter_prog_ops = { | 4272 | const struct bpf_verifier_ops sk_filter_prog_ops = { |
4246 | .get_func_proto = sk_filter_func_proto, | 4273 | .get_func_proto = sk_filter_func_proto, |
4247 | .is_valid_access = sk_filter_is_valid_access, | 4274 | .is_valid_access = sk_filter_is_valid_access, |
@@ -4300,7 +4327,7 @@ const struct bpf_verifier_ops sock_ops_prog_ops = { | |||
4300 | const struct bpf_verifier_ops sk_skb_prog_ops = { | 4327 | const struct bpf_verifier_ops sk_skb_prog_ops = { |
4301 | .get_func_proto = sk_skb_func_proto, | 4328 | .get_func_proto = sk_skb_func_proto, |
4302 | .is_valid_access = sk_skb_is_valid_access, | 4329 | .is_valid_access = sk_skb_is_valid_access, |
4303 | .convert_ctx_access = bpf_convert_ctx_access, | 4330 | .convert_ctx_access = sk_skb_convert_ctx_access, |
4304 | .gen_prologue = sk_skb_prologue, | 4331 | .gen_prologue = sk_skb_prologue, |
4305 | }; | 4332 | }; |
4306 | 4333 | ||
diff --git a/net/core/gro_cells.c b/net/core/gro_cells.c index 814e58a3ce8b..4b54e5f107c6 100644 --- a/net/core/gro_cells.c +++ b/net/core/gro_cells.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/skbuff.h> | 2 | #include <linux/skbuff.h> |
2 | #include <linux/slab.h> | 3 | #include <linux/slab.h> |
3 | #include <linux/netdevice.h> | 4 | #include <linux/netdevice.h> |
diff --git a/net/core/net-procfs.c b/net/core/net-procfs.c index 4847964931df..615ccab55f38 100644 --- a/net/core/net-procfs.c +++ b/net/core/net-procfs.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/netdevice.h> | 2 | #include <linux/netdevice.h> |
2 | #include <linux/proc_fs.h> | 3 | #include <linux/proc_fs.h> |
3 | #include <linux/seq_file.h> | 4 | #include <linux/seq_file.h> |
diff --git a/net/core/net-sysfs.h b/net/core/net-sysfs.h index 2745a1b51e03..006876c7b78d 100644 --- a/net/core/net-sysfs.h +++ b/net/core/net-sysfs.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef __NET_SYSFS_H__ | 2 | #ifndef __NET_SYSFS_H__ |
2 | #define __NET_SYSFS_H__ | 3 | #define __NET_SYSFS_H__ |
3 | 4 | ||
diff --git a/net/core/net-traces.c b/net/core/net-traces.c index 1132820c8e62..71f209542364 100644 --- a/net/core/net-traces.c +++ b/net/core/net-traces.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * consolidates trace point definitions | 3 | * consolidates trace point definitions |
3 | * | 4 | * |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index d4bcdcc68e92..5ace48926b19 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -1483,7 +1483,10 @@ static const struct nla_policy ifla_policy[IFLA_MAX+1] = { | |||
1483 | [IFLA_LINKINFO] = { .type = NLA_NESTED }, | 1483 | [IFLA_LINKINFO] = { .type = NLA_NESTED }, |
1484 | [IFLA_NET_NS_PID] = { .type = NLA_U32 }, | 1484 | [IFLA_NET_NS_PID] = { .type = NLA_U32 }, |
1485 | [IFLA_NET_NS_FD] = { .type = NLA_U32 }, | 1485 | [IFLA_NET_NS_FD] = { .type = NLA_U32 }, |
1486 | [IFLA_IFALIAS] = { .type = NLA_STRING, .len = IFALIASZ-1 }, | 1486 | /* IFLA_IFALIAS is a string, but policy is set to NLA_BINARY to |
1487 | * allow 0-length string (needed to remove an alias). | ||
1488 | */ | ||
1489 | [IFLA_IFALIAS] = { .type = NLA_BINARY, .len = IFALIASZ - 1 }, | ||
1487 | [IFLA_VFINFO_LIST] = {. type = NLA_NESTED }, | 1490 | [IFLA_VFINFO_LIST] = {. type = NLA_NESTED }, |
1488 | [IFLA_VF_PORTS] = { .type = NLA_NESTED }, | 1491 | [IFLA_VF_PORTS] = { .type = NLA_NESTED }, |
1489 | [IFLA_PORT_SELF] = { .type = NLA_NESTED }, | 1492 | [IFLA_PORT_SELF] = { .type = NLA_NESTED }, |
@@ -2093,7 +2096,7 @@ static int do_setlink(const struct sk_buff *skb, | |||
2093 | dev->tx_queue_len = orig_len; | 2096 | dev->tx_queue_len = orig_len; |
2094 | goto errout; | 2097 | goto errout; |
2095 | } | 2098 | } |
2096 | status |= DO_SETLINK_NOTIFY; | 2099 | status |= DO_SETLINK_MODIFIED; |
2097 | } | 2100 | } |
2098 | } | 2101 | } |
2099 | 2102 | ||
@@ -2248,7 +2251,7 @@ static int do_setlink(const struct sk_buff *skb, | |||
2248 | 2251 | ||
2249 | errout: | 2252 | errout: |
2250 | if (status & DO_SETLINK_MODIFIED) { | 2253 | if (status & DO_SETLINK_MODIFIED) { |
2251 | if (status & DO_SETLINK_NOTIFY) | 2254 | if ((status & DO_SETLINK_NOTIFY) == DO_SETLINK_NOTIFY) |
2252 | netdev_state_change(dev); | 2255 | netdev_state_change(dev); |
2253 | 2256 | ||
2254 | if (err < 0) | 2257 | if (err < 0) |
@@ -4279,13 +4282,17 @@ static int rtnetlink_event(struct notifier_block *this, unsigned long event, voi | |||
4279 | 4282 | ||
4280 | switch (event) { | 4283 | switch (event) { |
4281 | case NETDEV_REBOOT: | 4284 | case NETDEV_REBOOT: |
4285 | case NETDEV_CHANGEMTU: | ||
4282 | case NETDEV_CHANGEADDR: | 4286 | case NETDEV_CHANGEADDR: |
4283 | case NETDEV_CHANGENAME: | 4287 | case NETDEV_CHANGENAME: |
4284 | case NETDEV_FEAT_CHANGE: | 4288 | case NETDEV_FEAT_CHANGE: |
4285 | case NETDEV_BONDING_FAILOVER: | 4289 | case NETDEV_BONDING_FAILOVER: |
4290 | case NETDEV_POST_TYPE_CHANGE: | ||
4286 | case NETDEV_NOTIFY_PEERS: | 4291 | case NETDEV_NOTIFY_PEERS: |
4292 | case NETDEV_CHANGEUPPER: | ||
4287 | case NETDEV_RESEND_IGMP: | 4293 | case NETDEV_RESEND_IGMP: |
4288 | case NETDEV_CHANGEINFODATA: | 4294 | case NETDEV_CHANGEINFODATA: |
4295 | case NETDEV_CHANGE_TX_QUEUE_LEN: | ||
4289 | rtmsg_ifinfo_event(RTM_NEWLINK, dev, 0, rtnl_get_event(event), | 4296 | rtmsg_ifinfo_event(RTM_NEWLINK, dev, 0, rtnl_get_event(event), |
4290 | GFP_KERNEL); | 4297 | GFP_KERNEL); |
4291 | break; | 4298 | break; |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 16982de649b9..24656076906d 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -1124,9 +1124,13 @@ int skb_zerocopy_iter_stream(struct sock *sk, struct sk_buff *skb, | |||
1124 | 1124 | ||
1125 | err = __zerocopy_sg_from_iter(sk, skb, &msg->msg_iter, len); | 1125 | err = __zerocopy_sg_from_iter(sk, skb, &msg->msg_iter, len); |
1126 | if (err == -EFAULT || (err == -EMSGSIZE && skb->len == orig_len)) { | 1126 | if (err == -EFAULT || (err == -EMSGSIZE && skb->len == orig_len)) { |
1127 | struct sock *save_sk = skb->sk; | ||
1128 | |||
1127 | /* Streams do not free skb on error. Reset to prev state. */ | 1129 | /* Streams do not free skb on error. Reset to prev state. */ |
1128 | msg->msg_iter = orig_iter; | 1130 | msg->msg_iter = orig_iter; |
1131 | skb->sk = sk; | ||
1129 | ___pskb_trim(skb, orig_len); | 1132 | ___pskb_trim(skb, orig_len); |
1133 | skb->sk = save_sk; | ||
1130 | return err; | 1134 | return err; |
1131 | } | 1135 | } |
1132 | 1136 | ||
@@ -1896,7 +1900,7 @@ void *__pskb_pull_tail(struct sk_buff *skb, int delta) | |||
1896 | } | 1900 | } |
1897 | 1901 | ||
1898 | /* If we need update frag list, we are in troubles. | 1902 | /* If we need update frag list, we are in troubles. |
1899 | * Certainly, it possible to add an offset to skb data, | 1903 | * Certainly, it is possible to add an offset to skb data, |
1900 | * but taking into account that pulling is expected to | 1904 | * but taking into account that pulling is expected to |
1901 | * be very rare operation, it is worth to fight against | 1905 | * be very rare operation, it is worth to fight against |
1902 | * further bloating skb head and crucify ourselves here instead. | 1906 | * further bloating skb head and crucify ourselves here instead. |
diff --git a/net/core/sock.c b/net/core/sock.c index 23953b741a41..415f441c63b9 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -1677,12 +1677,17 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority) | |||
1677 | newsk->sk_dst_pending_confirm = 0; | 1677 | newsk->sk_dst_pending_confirm = 0; |
1678 | newsk->sk_wmem_queued = 0; | 1678 | newsk->sk_wmem_queued = 0; |
1679 | newsk->sk_forward_alloc = 0; | 1679 | newsk->sk_forward_alloc = 0; |
1680 | |||
1681 | /* sk->sk_memcg will be populated at accept() time */ | ||
1682 | newsk->sk_memcg = NULL; | ||
1683 | |||
1680 | atomic_set(&newsk->sk_drops, 0); | 1684 | atomic_set(&newsk->sk_drops, 0); |
1681 | newsk->sk_send_head = NULL; | 1685 | newsk->sk_send_head = NULL; |
1682 | newsk->sk_userlocks = sk->sk_userlocks & ~SOCK_BINDPORT_LOCK; | 1686 | newsk->sk_userlocks = sk->sk_userlocks & ~SOCK_BINDPORT_LOCK; |
1683 | atomic_set(&newsk->sk_zckey, 0); | 1687 | atomic_set(&newsk->sk_zckey, 0); |
1684 | 1688 | ||
1685 | sock_reset_flag(newsk, SOCK_DONE); | 1689 | sock_reset_flag(newsk, SOCK_DONE); |
1690 | cgroup_sk_alloc(&newsk->sk_cgrp_data); | ||
1686 | 1691 | ||
1687 | rcu_read_lock(); | 1692 | rcu_read_lock(); |
1688 | filter = rcu_dereference(sk->sk_filter); | 1693 | filter = rcu_dereference(sk->sk_filter); |
@@ -1714,9 +1719,6 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority) | |||
1714 | newsk->sk_incoming_cpu = raw_smp_processor_id(); | 1719 | newsk->sk_incoming_cpu = raw_smp_processor_id(); |
1715 | atomic64_set(&newsk->sk_cookie, 0); | 1720 | atomic64_set(&newsk->sk_cookie, 0); |
1716 | 1721 | ||
1717 | mem_cgroup_sk_alloc(newsk); | ||
1718 | cgroup_sk_alloc(&newsk->sk_cgrp_data); | ||
1719 | |||
1720 | /* | 1722 | /* |
1721 | * Before updating sk_refcnt, we must commit prior changes to memory | 1723 | * Before updating sk_refcnt, we must commit prior changes to memory |
1722 | * (Documentation/RCU/rculist_nulls.txt for details) | 1724 | * (Documentation/RCU/rculist_nulls.txt for details) |
diff --git a/net/core/sock_reuseport.c b/net/core/sock_reuseport.c index eed1ebf7f29d..5eeb1d20cc38 100644 --- a/net/core/sock_reuseport.c +++ b/net/core/sock_reuseport.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * To speed up listener socket lookup, create an array to store all sockets | 3 | * To speed up listener socket lookup, create an array to store all sockets |
3 | * listening on the same port. This allows a decision to be made after finding | 4 | * listening on the same port. This allows a decision to be made after finding |
@@ -36,9 +37,14 @@ int reuseport_alloc(struct sock *sk) | |||
36 | * soft irq of receive path or setsockopt from process context | 37 | * soft irq of receive path or setsockopt from process context |
37 | */ | 38 | */ |
38 | spin_lock_bh(&reuseport_lock); | 39 | spin_lock_bh(&reuseport_lock); |
39 | WARN_ONCE(rcu_dereference_protected(sk->sk_reuseport_cb, | 40 | |
40 | lockdep_is_held(&reuseport_lock)), | 41 | /* Allocation attempts can occur concurrently via the setsockopt path |
41 | "multiple allocations for the same socket"); | 42 | * and the bind/hash path. Nothing to do when we lose the race. |
43 | */ | ||
44 | if (rcu_dereference_protected(sk->sk_reuseport_cb, | ||
45 | lockdep_is_held(&reuseport_lock))) | ||
46 | goto out; | ||
47 | |||
42 | reuse = __reuseport_alloc(INIT_SOCKS); | 48 | reuse = __reuseport_alloc(INIT_SOCKS); |
43 | if (!reuse) { | 49 | if (!reuse) { |
44 | spin_unlock_bh(&reuseport_lock); | 50 | spin_unlock_bh(&reuseport_lock); |
@@ -49,6 +55,7 @@ int reuseport_alloc(struct sock *sk) | |||
49 | reuse->num_socks = 1; | 55 | reuse->num_socks = 1; |
50 | rcu_assign_pointer(sk->sk_reuseport_cb, reuse); | 56 | rcu_assign_pointer(sk->sk_reuseport_cb, reuse); |
51 | 57 | ||
58 | out: | ||
52 | spin_unlock_bh(&reuseport_lock); | 59 | spin_unlock_bh(&reuseport_lock); |
53 | 60 | ||
54 | return 0; | 61 | return 0; |
diff --git a/net/core/stream.c b/net/core/stream.c index 20231dbb1da0..1cff9c6270c6 100644 --- a/net/core/stream.c +++ b/net/core/stream.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * SUCS NET3: | 3 | * SUCS NET3: |
3 | * | 4 | * |
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c index b7cd9aafe99e..cbc3dde4cfcc 100644 --- a/net/core/sysctl_net_core.c +++ b/net/core/sysctl_net_core.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* -*- linux-c -*- | 2 | /* -*- linux-c -*- |
2 | * sysctl_net_core.c: sysctl interface to net core subsystem. | 3 | * sysctl_net_core.c: sysctl interface to net core subsystem. |
3 | * | 4 | * |
diff --git a/net/core/tso.c b/net/core/tso.c index 5dca7ce8ee9f..43f4eba61933 100644 --- a/net/core/tso.c +++ b/net/core/tso.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/export.h> | 2 | #include <linux/export.h> |
2 | #include <linux/if_vlan.h> | 3 | #include <linux/if_vlan.h> |
3 | #include <net/ip.h> | 4 | #include <net/ip.h> |
diff --git a/net/dccp/Makefile b/net/dccp/Makefile index 5c8362b037ed..2e7b56097bc4 100644 --- a/net/dccp/Makefile +++ b/net/dccp/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | obj-$(CONFIG_IP_DCCP) += dccp.o dccp_ipv4.o | 2 | obj-$(CONFIG_IP_DCCP) += dccp.o dccp_ipv4.o |
2 | 3 | ||
3 | dccp-y := ccid.o feat.o input.o minisocks.o options.o output.o proto.o timer.o \ | 4 | dccp-y := ccid.o feat.o input.o minisocks.o options.o output.o proto.o timer.o \ |
diff --git a/net/dccp/ccids/lib/tfrc.c b/net/dccp/ccids/lib/tfrc.c index 62b5828acde0..d7f265e1f50c 100644 --- a/net/dccp/ccids/lib/tfrc.c +++ b/net/dccp/ccids/lib/tfrc.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * TFRC library initialisation | 3 | * TFRC library initialisation |
3 | * | 4 | * |
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 001c08696334..e65fcb45c3f6 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -414,8 +414,7 @@ struct sock *dccp_v4_request_recv_sock(const struct sock *sk, | |||
414 | sk_daddr_set(newsk, ireq->ir_rmt_addr); | 414 | sk_daddr_set(newsk, ireq->ir_rmt_addr); |
415 | sk_rcv_saddr_set(newsk, ireq->ir_loc_addr); | 415 | sk_rcv_saddr_set(newsk, ireq->ir_loc_addr); |
416 | newinet->inet_saddr = ireq->ir_loc_addr; | 416 | newinet->inet_saddr = ireq->ir_loc_addr; |
417 | newinet->inet_opt = ireq->opt; | 417 | RCU_INIT_POINTER(newinet->inet_opt, rcu_dereference(ireq->ireq_opt)); |
418 | ireq->opt = NULL; | ||
419 | newinet->mc_index = inet_iif(skb); | 418 | newinet->mc_index = inet_iif(skb); |
420 | newinet->mc_ttl = ip_hdr(skb)->ttl; | 419 | newinet->mc_ttl = ip_hdr(skb)->ttl; |
421 | newinet->inet_id = jiffies; | 420 | newinet->inet_id = jiffies; |
@@ -430,7 +429,10 @@ struct sock *dccp_v4_request_recv_sock(const struct sock *sk, | |||
430 | if (__inet_inherit_port(sk, newsk) < 0) | 429 | if (__inet_inherit_port(sk, newsk) < 0) |
431 | goto put_and_exit; | 430 | goto put_and_exit; |
432 | *own_req = inet_ehash_nolisten(newsk, req_to_sk(req_unhash)); | 431 | *own_req = inet_ehash_nolisten(newsk, req_to_sk(req_unhash)); |
433 | 432 | if (*own_req) | |
433 | ireq->ireq_opt = NULL; | ||
434 | else | ||
435 | newinet->inet_opt = NULL; | ||
434 | return newsk; | 436 | return newsk; |
435 | 437 | ||
436 | exit_overflow: | 438 | exit_overflow: |
@@ -441,6 +443,7 @@ exit: | |||
441 | __NET_INC_STATS(sock_net(sk), LINUX_MIB_LISTENDROPS); | 443 | __NET_INC_STATS(sock_net(sk), LINUX_MIB_LISTENDROPS); |
442 | return NULL; | 444 | return NULL; |
443 | put_and_exit: | 445 | put_and_exit: |
446 | newinet->inet_opt = NULL; | ||
444 | inet_csk_prepare_forced_close(newsk); | 447 | inet_csk_prepare_forced_close(newsk); |
445 | dccp_done(newsk); | 448 | dccp_done(newsk); |
446 | goto exit; | 449 | goto exit; |
@@ -492,7 +495,7 @@ static int dccp_v4_send_response(const struct sock *sk, struct request_sock *req | |||
492 | ireq->ir_rmt_addr); | 495 | ireq->ir_rmt_addr); |
493 | err = ip_build_and_send_pkt(skb, sk, ireq->ir_loc_addr, | 496 | err = ip_build_and_send_pkt(skb, sk, ireq->ir_loc_addr, |
494 | ireq->ir_rmt_addr, | 497 | ireq->ir_rmt_addr, |
495 | ireq->opt); | 498 | ireq_opt_deref(ireq)); |
496 | err = net_xmit_eval(err); | 499 | err = net_xmit_eval(err); |
497 | } | 500 | } |
498 | 501 | ||
@@ -548,7 +551,7 @@ out: | |||
548 | static void dccp_v4_reqsk_destructor(struct request_sock *req) | 551 | static void dccp_v4_reqsk_destructor(struct request_sock *req) |
549 | { | 552 | { |
550 | dccp_feat_list_purge(&dccp_rsk(req)->dreq_featneg); | 553 | dccp_feat_list_purge(&dccp_rsk(req)->dreq_featneg); |
551 | kfree(inet_rsk(req)->opt); | 554 | kfree(rcu_dereference_protected(inet_rsk(req)->ireq_opt, 1)); |
552 | } | 555 | } |
553 | 556 | ||
554 | void dccp_syn_ack_timeout(const struct request_sock *req) | 557 | void dccp_syn_ack_timeout(const struct request_sock *req) |
diff --git a/net/decnet/Makefile b/net/decnet/Makefile index e44003af71f6..9e38122d942b 100644 --- a/net/decnet/Makefile +++ b/net/decnet/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | 2 | ||
2 | obj-$(CONFIG_DECNET) += decnet.o | 3 | obj-$(CONFIG_DECNET) += decnet.o |
3 | 4 | ||
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index 4d339de56862..df042b6d80b8 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * DECnet An implementation of the DECnet protocol suite for the LINUX | 3 | * DECnet An implementation of the DECnet protocol suite for the LINUX |
3 | * operating system. DECnet is implemented using the BSD Socket | 4 | * operating system. DECnet is implemented using the BSD Socket |
diff --git a/net/decnet/dn_fib.c b/net/decnet/dn_fib.c index 3d37464c8b4a..b37a1b833c77 100644 --- a/net/decnet/dn_fib.c +++ b/net/decnet/dn_fib.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * DECnet An implementation of the DECnet protocol suite for the LINUX | 3 | * DECnet An implementation of the DECnet protocol suite for the LINUX |
3 | * operating system. DECnet is implemented using the BSD Socket | 4 | * operating system. DECnet is implemented using the BSD Socket |
diff --git a/net/decnet/dn_neigh.c b/net/decnet/dn_neigh.c index 22bf0b95d6ed..528119a5618e 100644 --- a/net/decnet/dn_neigh.c +++ b/net/decnet/dn_neigh.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * DECnet An implementation of the DECnet protocol suite for the LINUX | 3 | * DECnet An implementation of the DECnet protocol suite for the LINUX |
3 | * operating system. DECnet is implemented using the BSD Socket | 4 | * operating system. DECnet is implemented using the BSD Socket |
diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c index 295bbd6a56f2..c795c3f509c9 100644 --- a/net/decnet/dn_rules.c +++ b/net/decnet/dn_rules.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | 2 | ||
2 | /* | 3 | /* |
3 | * DECnet An implementation of the DECnet protocol suite for the LINUX | 4 | * DECnet An implementation of the DECnet protocol suite for the LINUX |
diff --git a/net/decnet/dn_table.c b/net/decnet/dn_table.c index 232675480756..08667f68e601 100644 --- a/net/decnet/dn_table.c +++ b/net/decnet/dn_table.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * DECnet An implementation of the DECnet protocol suite for the LINUX | 3 | * DECnet An implementation of the DECnet protocol suite for the LINUX |
3 | * operating system. DECnet is implemented using the BSD Socket | 4 | * operating system. DECnet is implemented using the BSD Socket |
diff --git a/net/decnet/dn_timer.c b/net/decnet/dn_timer.c index 1d330fd43dc7..f430daed24a0 100644 --- a/net/decnet/dn_timer.c +++ b/net/decnet/dn_timer.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * DECnet An implementation of the DECnet protocol suite for the LINUX | 3 | * DECnet An implementation of the DECnet protocol suite for the LINUX |
3 | * operating system. DECnet is implemented using the BSD Socket | 4 | * operating system. DECnet is implemented using the BSD Socket |
diff --git a/net/decnet/sysctl_net_decnet.c b/net/decnet/sysctl_net_decnet.c index 6c7da6c29bf0..55bf64a22b59 100644 --- a/net/decnet/sysctl_net_decnet.c +++ b/net/decnet/sysctl_net_decnet.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * DECnet An implementation of the DECnet protocol suite for the LINUX | 3 | * DECnet An implementation of the DECnet protocol suite for the LINUX |
3 | * operating system. DECnet is implemented using the BSD Socket | 4 | * operating system. DECnet is implemented using the BSD Socket |
diff --git a/net/dns_resolver/dns_key.c b/net/dns_resolver/dns_key.c index 8737412c7b27..e1d4d898a007 100644 --- a/net/dns_resolver/dns_key.c +++ b/net/dns_resolver/dns_key.c | |||
@@ -224,7 +224,7 @@ static int dns_resolver_match_preparse(struct key_match_data *match_data) | |||
224 | static void dns_resolver_describe(const struct key *key, struct seq_file *m) | 224 | static void dns_resolver_describe(const struct key *key, struct seq_file *m) |
225 | { | 225 | { |
226 | seq_puts(m, key->description); | 226 | seq_puts(m, key->description); |
227 | if (key_is_instantiated(key)) { | 227 | if (key_is_positive(key)) { |
228 | int err = PTR_ERR(key->payload.data[dns_key_error]); | 228 | int err = PTR_ERR(key->payload.data[dns_key_error]); |
229 | 229 | ||
230 | if (err) | 230 | if (err) |
diff --git a/net/dsa/Makefile b/net/dsa/Makefile index fcce25da937c..3d3c74193d06 100644 --- a/net/dsa/Makefile +++ b/net/dsa/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # the core | 2 | # the core |
2 | obj-$(CONFIG_NET_DSA) += dsa_core.o | 3 | obj-$(CONFIG_NET_DSA) += dsa_core.o |
3 | dsa_core-y += dsa.o dsa2.o legacy.o port.o slave.o switch.o | 4 | dsa_core-y += dsa.o dsa2.o legacy.o port.o slave.o switch.o |
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index 873af0108e24..045d8a176279 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c | |||
@@ -496,14 +496,15 @@ static int dsa_cpu_parse(struct dsa_port *port, u32 index, | |||
496 | if (!ethernet) | 496 | if (!ethernet) |
497 | return -EINVAL; | 497 | return -EINVAL; |
498 | ethernet_dev = of_find_net_device_by_node(ethernet); | 498 | ethernet_dev = of_find_net_device_by_node(ethernet); |
499 | if (!ethernet_dev) | ||
500 | return -EPROBE_DEFER; | ||
499 | } else { | 501 | } else { |
500 | ethernet_dev = dsa_dev_to_net_device(ds->cd->netdev[index]); | 502 | ethernet_dev = dsa_dev_to_net_device(ds->cd->netdev[index]); |
503 | if (!ethernet_dev) | ||
504 | return -EPROBE_DEFER; | ||
501 | dev_put(ethernet_dev); | 505 | dev_put(ethernet_dev); |
502 | } | 506 | } |
503 | 507 | ||
504 | if (!ethernet_dev) | ||
505 | return -EPROBE_DEFER; | ||
506 | |||
507 | if (!dst->cpu_dp) { | 508 | if (!dst->cpu_dp) { |
508 | dst->cpu_dp = port; | 509 | dst->cpu_dp = port; |
509 | dst->cpu_dp->netdev = ethernet_dev; | 510 | dst->cpu_dp->netdev = ethernet_dev; |
diff --git a/net/ieee802154/6lowpan/6lowpan_i.h b/net/ieee802154/6lowpan/6lowpan_i.h index ac7c96b73ad5..d8de3bcfb103 100644 --- a/net/ieee802154/6lowpan/6lowpan_i.h +++ b/net/ieee802154/6lowpan/6lowpan_i.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef __IEEE802154_6LOWPAN_I_H__ | 2 | #ifndef __IEEE802154_6LOWPAN_I_H__ |
2 | #define __IEEE802154_6LOWPAN_I_H__ | 3 | #define __IEEE802154_6LOWPAN_I_H__ |
3 | 4 | ||
diff --git a/net/ieee802154/Makefile b/net/ieee802154/Makefile index 9b92ade687a3..f05b7bdae2aa 100644 --- a/net/ieee802154/Makefile +++ b/net/ieee802154/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | obj-$(CONFIG_IEEE802154) += ieee802154.o | 2 | obj-$(CONFIG_IEEE802154) += ieee802154.o |
2 | obj-$(CONFIG_IEEE802154_SOCKET) += ieee802154_socket.o | 3 | obj-$(CONFIG_IEEE802154_SOCKET) += ieee802154_socket.o |
3 | obj-y += 6lowpan/ | 4 | obj-y += 6lowpan/ |
diff --git a/net/ieee802154/core.h b/net/ieee802154/core.h index 81141f58d079..1c19f575d574 100644 --- a/net/ieee802154/core.h +++ b/net/ieee802154/core.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef __IEEE802154_CORE_H | 2 | #ifndef __IEEE802154_CORE_H |
2 | #define __IEEE802154_CORE_H | 3 | #define __IEEE802154_CORE_H |
3 | 4 | ||
diff --git a/net/ieee802154/nl802154.h b/net/ieee802154/nl802154.h index 3846a89d0958..8c4b6d08954c 100644 --- a/net/ieee802154/nl802154.h +++ b/net/ieee802154/nl802154.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef __IEEE802154_NL802154_H | 2 | #ifndef __IEEE802154_NL802154_H |
2 | #define __IEEE802154_NL802154_H | 3 | #define __IEEE802154_NL802154_H |
3 | 4 | ||
diff --git a/net/ieee802154/rdev-ops.h b/net/ieee802154/rdev-ops.h index 4441c63b3ea6..598f5af49775 100644 --- a/net/ieee802154/rdev-ops.h +++ b/net/ieee802154/rdev-ops.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef __CFG802154_RDEV_OPS | 2 | #ifndef __CFG802154_RDEV_OPS |
2 | #define __CFG802154_RDEV_OPS | 3 | #define __CFG802154_RDEV_OPS |
3 | 4 | ||
diff --git a/net/ieee802154/sysfs.h b/net/ieee802154/sysfs.h index aa42e39ecbec..337545b639e9 100644 --- a/net/ieee802154/sysfs.h +++ b/net/ieee802154/sysfs.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef __IEEE802154_SYSFS_H | 2 | #ifndef __IEEE802154_SYSFS_H |
2 | #define __IEEE802154_SYSFS_H | 3 | #define __IEEE802154_SYSFS_H |
3 | 4 | ||
diff --git a/net/ieee802154/trace.h b/net/ieee802154/trace.h index 9a471e41ec73..19c2e5d60e76 100644 --- a/net/ieee802154/trace.h +++ b/net/ieee802154/trace.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* Based on net/wireless/trace.h */ | 2 | /* Based on net/wireless/trace.h */ |
2 | 3 | ||
3 | #undef TRACE_SYSTEM | 4 | #undef TRACE_SYSTEM |
diff --git a/net/ife/ife.c b/net/ife/ife.c index f360341c72eb..7d1ec76e7f43 100644 --- a/net/ife/ife.c +++ b/net/ife/ife.c | |||
@@ -137,6 +137,6 @@ int ife_tlv_meta_encode(void *skbdata, u16 attrtype, u16 dlen, const void *dval) | |||
137 | EXPORT_SYMBOL_GPL(ife_tlv_meta_encode); | 137 | EXPORT_SYMBOL_GPL(ife_tlv_meta_encode); |
138 | 138 | ||
139 | MODULE_AUTHOR("Jamal Hadi Salim <jhs@mojatatu.com>"); | 139 | MODULE_AUTHOR("Jamal Hadi Salim <jhs@mojatatu.com>"); |
140 | MODULE_AUTHOR("Yotam Gigi <yotamg@mellanox.com>"); | 140 | MODULE_AUTHOR("Yotam Gigi <yotam.gi@gmail.com>"); |
141 | MODULE_DESCRIPTION("Inter-FE LFB action"); | 141 | MODULE_DESCRIPTION("Inter-FE LFB action"); |
142 | MODULE_LICENSE("GPL"); | 142 | MODULE_LICENSE("GPL"); |
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig index 91a2557942fa..f48fe6fc7e8c 100644 --- a/net/ipv4/Kconfig +++ b/net/ipv4/Kconfig | |||
@@ -70,11 +70,9 @@ config IP_MULTIPLE_TABLES | |||
70 | address into account. Furthermore, the TOS (Type-Of-Service) field | 70 | address into account. Furthermore, the TOS (Type-Of-Service) field |
71 | of the packet can be used for routing decisions as well. | 71 | of the packet can be used for routing decisions as well. |
72 | 72 | ||
73 | If you are interested in this, please see the preliminary | 73 | If you need more information, see the Linux Advanced |
74 | documentation at <http://www.compendium.com.ar/policy-routing.txt> | 74 | Routing and Traffic Control documentation at |
75 | and <ftp://post.tepkom.ru/pub/vol2/Linux/docs/advanced-routing.tex>. | 75 | <http://lartc.org/howto/lartc.rpdb.html> |
76 | You will need supporting software from | ||
77 | <ftp://ftp.tux.org/pub/net/ip-routing/>. | ||
78 | 76 | ||
79 | If unsure, say N. | 77 | If unsure, say N. |
80 | 78 | ||
diff --git a/net/ipv4/Makefile b/net/ipv4/Makefile index afcb435adfbe..c6c8ad1d4b6d 100644 --- a/net/ipv4/Makefile +++ b/net/ipv4/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the Linux TCP/IP (INET) layer. | 3 | # Makefile for the Linux TCP/IP (INET) layer. |
3 | # | 4 | # |
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c index 2ae8f54cb321..82178cc69c96 100644 --- a/net/ipv4/cipso_ipv4.c +++ b/net/ipv4/cipso_ipv4.c | |||
@@ -1951,7 +1951,7 @@ int cipso_v4_req_setattr(struct request_sock *req, | |||
1951 | buf = NULL; | 1951 | buf = NULL; |
1952 | 1952 | ||
1953 | req_inet = inet_rsk(req); | 1953 | req_inet = inet_rsk(req); |
1954 | opt = xchg(&req_inet->opt, opt); | 1954 | opt = xchg((__force struct ip_options_rcu **)&req_inet->ireq_opt, opt); |
1955 | if (opt) | 1955 | if (opt) |
1956 | kfree_rcu(opt, rcu); | 1956 | kfree_rcu(opt, rcu); |
1957 | 1957 | ||
@@ -1973,11 +1973,13 @@ req_setattr_failure: | |||
1973 | * values on failure. | 1973 | * values on failure. |
1974 | * | 1974 | * |
1975 | */ | 1975 | */ |
1976 | static int cipso_v4_delopt(struct ip_options_rcu **opt_ptr) | 1976 | static int cipso_v4_delopt(struct ip_options_rcu __rcu **opt_ptr) |
1977 | { | 1977 | { |
1978 | struct ip_options_rcu *opt = rcu_dereference_protected(*opt_ptr, 1); | ||
1978 | int hdr_delta = 0; | 1979 | int hdr_delta = 0; |
1979 | struct ip_options_rcu *opt = *opt_ptr; | ||
1980 | 1980 | ||
1981 | if (!opt || opt->opt.cipso == 0) | ||
1982 | return 0; | ||
1981 | if (opt->opt.srr || opt->opt.rr || opt->opt.ts || opt->opt.router_alert) { | 1983 | if (opt->opt.srr || opt->opt.rr || opt->opt.ts || opt->opt.router_alert) { |
1982 | u8 cipso_len; | 1984 | u8 cipso_len; |
1983 | u8 cipso_off; | 1985 | u8 cipso_off; |
@@ -2039,14 +2041,10 @@ static int cipso_v4_delopt(struct ip_options_rcu **opt_ptr) | |||
2039 | */ | 2041 | */ |
2040 | void cipso_v4_sock_delattr(struct sock *sk) | 2042 | void cipso_v4_sock_delattr(struct sock *sk) |
2041 | { | 2043 | { |
2042 | int hdr_delta; | ||
2043 | struct ip_options_rcu *opt; | ||
2044 | struct inet_sock *sk_inet; | 2044 | struct inet_sock *sk_inet; |
2045 | int hdr_delta; | ||
2045 | 2046 | ||
2046 | sk_inet = inet_sk(sk); | 2047 | sk_inet = inet_sk(sk); |
2047 | opt = rcu_dereference_protected(sk_inet->inet_opt, 1); | ||
2048 | if (!opt || opt->opt.cipso == 0) | ||
2049 | return; | ||
2050 | 2048 | ||
2051 | hdr_delta = cipso_v4_delopt(&sk_inet->inet_opt); | 2049 | hdr_delta = cipso_v4_delopt(&sk_inet->inet_opt); |
2052 | if (sk_inet->is_icsk && hdr_delta > 0) { | 2050 | if (sk_inet->is_icsk && hdr_delta > 0) { |
@@ -2066,15 +2064,7 @@ void cipso_v4_sock_delattr(struct sock *sk) | |||
2066 | */ | 2064 | */ |
2067 | void cipso_v4_req_delattr(struct request_sock *req) | 2065 | void cipso_v4_req_delattr(struct request_sock *req) |
2068 | { | 2066 | { |
2069 | struct ip_options_rcu *opt; | 2067 | cipso_v4_delopt(&inet_rsk(req)->ireq_opt); |
2070 | struct inet_request_sock *req_inet; | ||
2071 | |||
2072 | req_inet = inet_rsk(req); | ||
2073 | opt = req_inet->opt; | ||
2074 | if (!opt || opt->opt.cipso == 0) | ||
2075 | return; | ||
2076 | |||
2077 | cipso_v4_delopt(&req_inet->opt); | ||
2078 | } | 2068 | } |
2079 | 2069 | ||
2080 | /** | 2070 | /** |
diff --git a/net/ipv4/fib_lookup.h b/net/ipv4/fib_lookup.h index 5b2af19cfb5b..e6ff282bb7f4 100644 --- a/net/ipv4/fib_lookup.h +++ b/net/ipv4/fib_lookup.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef _FIB_LOOKUP_H | 2 | #ifndef _FIB_LOOKUP_H |
2 | #define _FIB_LOOKUP_H | 3 | #define _FIB_LOOKUP_H |
3 | 4 | ||
diff --git a/net/ipv4/fib_notifier.c b/net/ipv4/fib_notifier.c index cfd420b0572c..b804ccbdb241 100644 --- a/net/ipv4/fib_notifier.c +++ b/net/ipv4/fib_notifier.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/rtnetlink.h> | 2 | #include <linux/rtnetlink.h> |
2 | #include <linux/notifier.h> | 3 | #include <linux/notifier.h> |
3 | #include <linux/socket.h> | 4 | #include <linux/socket.h> |
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 57a5d48acee8..01ed22139ac2 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -1365,8 +1365,6 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event, | |||
1365 | nla_put_in_addr(skb, RTA_PREFSRC, fi->fib_prefsrc)) | 1365 | nla_put_in_addr(skb, RTA_PREFSRC, fi->fib_prefsrc)) |
1366 | goto nla_put_failure; | 1366 | goto nla_put_failure; |
1367 | if (fi->fib_nhs == 1) { | 1367 | if (fi->fib_nhs == 1) { |
1368 | struct in_device *in_dev; | ||
1369 | |||
1370 | if (fi->fib_nh->nh_gw && | 1368 | if (fi->fib_nh->nh_gw && |
1371 | nla_put_in_addr(skb, RTA_GATEWAY, fi->fib_nh->nh_gw)) | 1369 | nla_put_in_addr(skb, RTA_GATEWAY, fi->fib_nh->nh_gw)) |
1372 | goto nla_put_failure; | 1370 | goto nla_put_failure; |
@@ -1374,10 +1372,14 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event, | |||
1374 | nla_put_u32(skb, RTA_OIF, fi->fib_nh->nh_oif)) | 1372 | nla_put_u32(skb, RTA_OIF, fi->fib_nh->nh_oif)) |
1375 | goto nla_put_failure; | 1373 | goto nla_put_failure; |
1376 | if (fi->fib_nh->nh_flags & RTNH_F_LINKDOWN) { | 1374 | if (fi->fib_nh->nh_flags & RTNH_F_LINKDOWN) { |
1377 | in_dev = __in_dev_get_rtnl(fi->fib_nh->nh_dev); | 1375 | struct in_device *in_dev; |
1376 | |||
1377 | rcu_read_lock(); | ||
1378 | in_dev = __in_dev_get_rcu(fi->fib_nh->nh_dev); | ||
1378 | if (in_dev && | 1379 | if (in_dev && |
1379 | IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN(in_dev)) | 1380 | IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN(in_dev)) |
1380 | rtm->rtm_flags |= RTNH_F_DEAD; | 1381 | rtm->rtm_flags |= RTNH_F_DEAD; |
1382 | rcu_read_unlock(); | ||
1381 | } | 1383 | } |
1382 | if (fi->fib_nh->nh_flags & RTNH_F_OFFLOAD) | 1384 | if (fi->fib_nh->nh_flags & RTNH_F_OFFLOAD) |
1383 | rtm->rtm_flags |= RTNH_F_OFFLOAD; | 1385 | rtm->rtm_flags |= RTNH_F_OFFLOAD; |
@@ -1400,18 +1402,20 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event, | |||
1400 | goto nla_put_failure; | 1402 | goto nla_put_failure; |
1401 | 1403 | ||
1402 | for_nexthops(fi) { | 1404 | for_nexthops(fi) { |
1403 | struct in_device *in_dev; | ||
1404 | |||
1405 | rtnh = nla_reserve_nohdr(skb, sizeof(*rtnh)); | 1405 | rtnh = nla_reserve_nohdr(skb, sizeof(*rtnh)); |
1406 | if (!rtnh) | 1406 | if (!rtnh) |
1407 | goto nla_put_failure; | 1407 | goto nla_put_failure; |
1408 | 1408 | ||
1409 | rtnh->rtnh_flags = nh->nh_flags & 0xFF; | 1409 | rtnh->rtnh_flags = nh->nh_flags & 0xFF; |
1410 | if (nh->nh_flags & RTNH_F_LINKDOWN) { | 1410 | if (nh->nh_flags & RTNH_F_LINKDOWN) { |
1411 | in_dev = __in_dev_get_rtnl(nh->nh_dev); | 1411 | struct in_device *in_dev; |
1412 | |||
1413 | rcu_read_lock(); | ||
1414 | in_dev = __in_dev_get_rcu(nh->nh_dev); | ||
1412 | if (in_dev && | 1415 | if (in_dev && |
1413 | IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN(in_dev)) | 1416 | IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN(in_dev)) |
1414 | rtnh->rtnh_flags |= RTNH_F_DEAD; | 1417 | rtnh->rtnh_flags |= RTNH_F_DEAD; |
1418 | rcu_read_unlock(); | ||
1415 | } | 1419 | } |
1416 | rtnh->rtnh_hops = nh->nh_weight - 1; | 1420 | rtnh->rtnh_hops = nh->nh_weight - 1; |
1417 | rtnh->rtnh_ifindex = nh->nh_oif; | 1421 | rtnh->rtnh_ifindex = nh->nh_oif; |
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index c039c937ba90..b47a59cb3573 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -475,6 +475,7 @@ struct sock *inet_csk_accept(struct sock *sk, int flags, int *err, bool kern) | |||
475 | } | 475 | } |
476 | spin_unlock_bh(&queue->fastopenq.lock); | 476 | spin_unlock_bh(&queue->fastopenq.lock); |
477 | } | 477 | } |
478 | mem_cgroup_sk_alloc(newsk); | ||
478 | out: | 479 | out: |
479 | release_sock(sk); | 480 | release_sock(sk); |
480 | if (req) | 481 | if (req) |
@@ -539,9 +540,11 @@ struct dst_entry *inet_csk_route_req(const struct sock *sk, | |||
539 | { | 540 | { |
540 | const struct inet_request_sock *ireq = inet_rsk(req); | 541 | const struct inet_request_sock *ireq = inet_rsk(req); |
541 | struct net *net = read_pnet(&ireq->ireq_net); | 542 | struct net *net = read_pnet(&ireq->ireq_net); |
542 | struct ip_options_rcu *opt = ireq->opt; | 543 | struct ip_options_rcu *opt; |
543 | struct rtable *rt; | 544 | struct rtable *rt; |
544 | 545 | ||
546 | opt = ireq_opt_deref(ireq); | ||
547 | |||
545 | flowi4_init_output(fl4, ireq->ir_iif, ireq->ir_mark, | 548 | flowi4_init_output(fl4, ireq->ir_iif, ireq->ir_mark, |
546 | RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, | 549 | RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, |
547 | sk->sk_protocol, inet_sk_flowi_flags(sk), | 550 | sk->sk_protocol, inet_sk_flowi_flags(sk), |
@@ -575,10 +578,9 @@ struct dst_entry *inet_csk_route_child_sock(const struct sock *sk, | |||
575 | struct flowi4 *fl4; | 578 | struct flowi4 *fl4; |
576 | struct rtable *rt; | 579 | struct rtable *rt; |
577 | 580 | ||
581 | opt = rcu_dereference(ireq->ireq_opt); | ||
578 | fl4 = &newinet->cork.fl.u.ip4; | 582 | fl4 = &newinet->cork.fl.u.ip4; |
579 | 583 | ||
580 | rcu_read_lock(); | ||
581 | opt = rcu_dereference(newinet->inet_opt); | ||
582 | flowi4_init_output(fl4, ireq->ir_iif, ireq->ir_mark, | 584 | flowi4_init_output(fl4, ireq->ir_iif, ireq->ir_mark, |
583 | RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, | 585 | RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, |
584 | sk->sk_protocol, inet_sk_flowi_flags(sk), | 586 | sk->sk_protocol, inet_sk_flowi_flags(sk), |
@@ -591,13 +593,11 @@ struct dst_entry *inet_csk_route_child_sock(const struct sock *sk, | |||
591 | goto no_route; | 593 | goto no_route; |
592 | if (opt && opt->opt.is_strictroute && rt->rt_uses_gateway) | 594 | if (opt && opt->opt.is_strictroute && rt->rt_uses_gateway) |
593 | goto route_err; | 595 | goto route_err; |
594 | rcu_read_unlock(); | ||
595 | return &rt->dst; | 596 | return &rt->dst; |
596 | 597 | ||
597 | route_err: | 598 | route_err: |
598 | ip_rt_put(rt); | 599 | ip_rt_put(rt); |
599 | no_route: | 600 | no_route: |
600 | rcu_read_unlock(); | ||
601 | __IP_INC_STATS(net, IPSTATS_MIB_OUTNOROUTES); | 601 | __IP_INC_STATS(net, IPSTATS_MIB_OUTNOROUTES); |
602 | return NULL; | 602 | return NULL; |
603 | } | 603 | } |
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index 597bb4cfe805..e7d15fb0d94d 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c | |||
@@ -456,10 +456,7 @@ static int inet_reuseport_add_sock(struct sock *sk, | |||
456 | return reuseport_add_sock(sk, sk2); | 456 | return reuseport_add_sock(sk, sk2); |
457 | } | 457 | } |
458 | 458 | ||
459 | /* Initial allocation may have already happened via setsockopt */ | 459 | return reuseport_alloc(sk); |
460 | if (!rcu_access_pointer(sk->sk_reuseport_cb)) | ||
461 | return reuseport_alloc(sk); | ||
462 | return 0; | ||
463 | } | 460 | } |
464 | 461 | ||
465 | int __inet_hash(struct sock *sk, struct sock *osk) | 462 | int __inet_hash(struct sock *sk, struct sock *osk) |
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c index 9f0a7b96646f..2dd21c3281a1 100644 --- a/net/ipv4/ip_forward.c +++ b/net/ipv4/ip_forward.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * INET An implementation of the TCP/IP protocol suite for the LINUX | 3 | * INET An implementation of the TCP/IP protocol suite for the LINUX |
3 | * operating system. INET is implemented using the BSD Socket | 4 | * operating system. INET is implemented using the BSD Socket |
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index 46408c220d9d..df8fe0503de0 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * INET An implementation of the TCP/IP protocol suite for the LINUX | 3 | * INET An implementation of the TCP/IP protocol suite for the LINUX |
3 | * operating system. INET is implemented using the BSD Socket | 4 | * operating system. INET is implemented using the BSD Socket |
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c index 525ae88d1e58..ed194d46c00e 100644 --- a/net/ipv4/ip_options.c +++ b/net/ipv4/ip_options.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * INET An implementation of the TCP/IP protocol suite for the LINUX | 3 | * INET An implementation of the TCP/IP protocol suite for the LINUX |
3 | * operating system. INET is implemented using the BSD Socket | 4 | * operating system. INET is implemented using the BSD Socket |
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index a599aa83fdad..60fb1eb7d7d8 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * INET An implementation of the TCP/IP protocol suite for the LINUX | 3 | * INET An implementation of the TCP/IP protocol suite for the LINUX |
3 | * operating system. INET is implemented using the BSD Socket | 4 | * operating system. INET is implemented using the BSD Socket |
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index 4c5dfe6bd34d..abdebca848c9 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Automatic Configuration of IP -- use DHCP, BOOTP, RARP, or | 3 | * Automatic Configuration of IP -- use DHCP, BOOTP, RARP, or |
3 | * user-supplied information to configure own IP address and routes. | 4 | * user-supplied information to configure own IP address and routes. |
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index fb1ad22b5e29..cdd627355ed1 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c | |||
@@ -128,43 +128,68 @@ static struct rtnl_link_ops ipip_link_ops __read_mostly; | |||
128 | 128 | ||
129 | static int ipip_err(struct sk_buff *skb, u32 info) | 129 | static int ipip_err(struct sk_buff *skb, u32 info) |
130 | { | 130 | { |
131 | 131 | /* All the routers (except for Linux) return only | |
132 | /* All the routers (except for Linux) return only | 132 | * 8 bytes of packet payload. It means, that precise relaying of |
133 | 8 bytes of packet payload. It means, that precise relaying of | 133 | * ICMP in the real Internet is absolutely infeasible. |
134 | ICMP in the real Internet is absolutely infeasible. | 134 | */ |
135 | */ | ||
136 | struct net *net = dev_net(skb->dev); | 135 | struct net *net = dev_net(skb->dev); |
137 | struct ip_tunnel_net *itn = net_generic(net, ipip_net_id); | 136 | struct ip_tunnel_net *itn = net_generic(net, ipip_net_id); |
138 | const struct iphdr *iph = (const struct iphdr *)skb->data; | 137 | const struct iphdr *iph = (const struct iphdr *)skb->data; |
139 | struct ip_tunnel *t; | ||
140 | int err; | ||
141 | const int type = icmp_hdr(skb)->type; | 138 | const int type = icmp_hdr(skb)->type; |
142 | const int code = icmp_hdr(skb)->code; | 139 | const int code = icmp_hdr(skb)->code; |
140 | struct ip_tunnel *t; | ||
141 | int err = 0; | ||
142 | |||
143 | switch (type) { | ||
144 | case ICMP_DEST_UNREACH: | ||
145 | switch (code) { | ||
146 | case ICMP_SR_FAILED: | ||
147 | /* Impossible event. */ | ||
148 | goto out; | ||
149 | default: | ||
150 | /* All others are translated to HOST_UNREACH. | ||
151 | * rfc2003 contains "deep thoughts" about NET_UNREACH, | ||
152 | * I believe they are just ether pollution. --ANK | ||
153 | */ | ||
154 | break; | ||
155 | } | ||
156 | break; | ||
157 | |||
158 | case ICMP_TIME_EXCEEDED: | ||
159 | if (code != ICMP_EXC_TTL) | ||
160 | goto out; | ||
161 | break; | ||
162 | |||
163 | case ICMP_REDIRECT: | ||
164 | break; | ||
165 | |||
166 | default: | ||
167 | goto out; | ||
168 | } | ||
143 | 169 | ||
144 | err = -ENOENT; | ||
145 | t = ip_tunnel_lookup(itn, skb->dev->ifindex, TUNNEL_NO_KEY, | 170 | t = ip_tunnel_lookup(itn, skb->dev->ifindex, TUNNEL_NO_KEY, |
146 | iph->daddr, iph->saddr, 0); | 171 | iph->daddr, iph->saddr, 0); |
147 | if (!t) | 172 | if (!t) { |
173 | err = -ENOENT; | ||
148 | goto out; | 174 | goto out; |
175 | } | ||
149 | 176 | ||
150 | if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) { | 177 | if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) { |
151 | ipv4_update_pmtu(skb, dev_net(skb->dev), info, | 178 | ipv4_update_pmtu(skb, net, info, t->parms.link, 0, |
152 | t->parms.link, 0, iph->protocol, 0); | 179 | iph->protocol, 0); |
153 | err = 0; | ||
154 | goto out; | 180 | goto out; |
155 | } | 181 | } |
156 | 182 | ||
157 | if (type == ICMP_REDIRECT) { | 183 | if (type == ICMP_REDIRECT) { |
158 | ipv4_redirect(skb, dev_net(skb->dev), t->parms.link, 0, | 184 | ipv4_redirect(skb, net, t->parms.link, 0, iph->protocol, 0); |
159 | iph->protocol, 0); | ||
160 | err = 0; | ||
161 | goto out; | 185 | goto out; |
162 | } | 186 | } |
163 | 187 | ||
164 | if (t->parms.iph.daddr == 0) | 188 | if (t->parms.iph.daddr == 0) { |
189 | err = -ENOENT; | ||
165 | goto out; | 190 | goto out; |
191 | } | ||
166 | 192 | ||
167 | err = 0; | ||
168 | if (t->parms.iph.ttl == 0 && type == ICMP_TIME_EXCEEDED) | 193 | if (t->parms.iph.ttl == 0 && type == ICMP_TIME_EXCEEDED) |
169 | goto out; | 194 | goto out; |
170 | 195 | ||
diff --git a/net/ipv4/netfilter/Makefile b/net/ipv4/netfilter/Makefile index f462fee66ac8..adcdae358365 100644 --- a/net/ipv4/netfilter/Makefile +++ b/net/ipv4/netfilter/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the netfilter modules on top of IPv4. | 3 | # Makefile for the netfilter modules on top of IPv4. |
3 | # | 4 | # |
diff --git a/net/ipv4/netfilter/nf_reject_ipv4.c b/net/ipv4/netfilter/nf_reject_ipv4.c index eeacbdaf7cdf..5cd06ba3535d 100644 --- a/net/ipv4/netfilter/nf_reject_ipv4.c +++ b/net/ipv4/netfilter/nf_reject_ipv4.c | |||
@@ -132,6 +132,8 @@ void nf_send_reset(struct net *net, struct sk_buff *oldskb, int hook) | |||
132 | if (ip_route_me_harder(net, nskb, RTN_UNSPEC)) | 132 | if (ip_route_me_harder(net, nskb, RTN_UNSPEC)) |
133 | goto free_nskb; | 133 | goto free_nskb; |
134 | 134 | ||
135 | niph = ip_hdr(nskb); | ||
136 | |||
135 | /* "Never happens" */ | 137 | /* "Never happens" */ |
136 | if (nskb->len > dst_mtu(skb_dst(nskb))) | 138 | if (nskb->len > dst_mtu(skb_dst(nskb))) |
137 | goto free_nskb; | 139 | goto free_nskb; |
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c index b1bb1b3a1082..77cf32a80952 100644 --- a/net/ipv4/syncookies.c +++ b/net/ipv4/syncookies.c | |||
@@ -355,7 +355,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb) | |||
355 | /* We throwed the options of the initial SYN away, so we hope | 355 | /* We throwed the options of the initial SYN away, so we hope |
356 | * the ACK carries the same options again (see RFC1122 4.2.3.8) | 356 | * the ACK carries the same options again (see RFC1122 4.2.3.8) |
357 | */ | 357 | */ |
358 | ireq->opt = tcp_v4_save_options(sock_net(sk), skb); | 358 | RCU_INIT_POINTER(ireq->ireq_opt, tcp_v4_save_options(sock_net(sk), skb)); |
359 | 359 | ||
360 | if (security_inet_conn_request(sk, skb, req)) { | 360 | if (security_inet_conn_request(sk, skb, req)) { |
361 | reqsk_free(req); | 361 | reqsk_free(req); |
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 0d3c038d7b04..0989e739d098 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * sysctl_net_ipv4.c: sysctl interface to net IPV4 subsystem. | 3 | * sysctl_net_ipv4.c: sysctl interface to net IPV4 subsystem. |
3 | * | 4 | * |
diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c index e3c33220c418..fbbeda647774 100644 --- a/net/ipv4/tcp_fastopen.c +++ b/net/ipv4/tcp_fastopen.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/crypto.h> | 2 | #include <linux/crypto.h> |
2 | #include <linux/err.h> | 3 | #include <linux/err.h> |
3 | #include <linux/init.h> | 4 | #include <linux/init.h> |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index c5d7656beeee..5a87a00641d3 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * INET An implementation of the TCP/IP protocol suite for the LINUX | 3 | * INET An implementation of the TCP/IP protocol suite for the LINUX |
3 | * operating system. INET is implemented using the BSD Socket | 4 | * operating system. INET is implemented using the BSD Socket |
@@ -6196,7 +6197,7 @@ struct request_sock *inet_reqsk_alloc(const struct request_sock_ops *ops, | |||
6196 | struct inet_request_sock *ireq = inet_rsk(req); | 6197 | struct inet_request_sock *ireq = inet_rsk(req); |
6197 | 6198 | ||
6198 | kmemcheck_annotate_bitfield(ireq, flags); | 6199 | kmemcheck_annotate_bitfield(ireq, flags); |
6199 | ireq->opt = NULL; | 6200 | ireq->ireq_opt = NULL; |
6200 | #if IS_ENABLED(CONFIG_IPV6) | 6201 | #if IS_ENABLED(CONFIG_IPV6) |
6201 | ireq->pktopts = NULL; | 6202 | ireq->pktopts = NULL; |
6202 | #endif | 6203 | #endif |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 85164d4d3e53..5b027c69cbc5 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -877,7 +877,7 @@ static int tcp_v4_send_synack(const struct sock *sk, struct dst_entry *dst, | |||
877 | 877 | ||
878 | err = ip_build_and_send_pkt(skb, sk, ireq->ir_loc_addr, | 878 | err = ip_build_and_send_pkt(skb, sk, ireq->ir_loc_addr, |
879 | ireq->ir_rmt_addr, | 879 | ireq->ir_rmt_addr, |
880 | ireq->opt); | 880 | ireq_opt_deref(ireq)); |
881 | err = net_xmit_eval(err); | 881 | err = net_xmit_eval(err); |
882 | } | 882 | } |
883 | 883 | ||
@@ -889,7 +889,7 @@ static int tcp_v4_send_synack(const struct sock *sk, struct dst_entry *dst, | |||
889 | */ | 889 | */ |
890 | static void tcp_v4_reqsk_destructor(struct request_sock *req) | 890 | static void tcp_v4_reqsk_destructor(struct request_sock *req) |
891 | { | 891 | { |
892 | kfree(inet_rsk(req)->opt); | 892 | kfree(rcu_dereference_protected(inet_rsk(req)->ireq_opt, 1)); |
893 | } | 893 | } |
894 | 894 | ||
895 | #ifdef CONFIG_TCP_MD5SIG | 895 | #ifdef CONFIG_TCP_MD5SIG |
@@ -1265,10 +1265,11 @@ static void tcp_v4_init_req(struct request_sock *req, | |||
1265 | struct sk_buff *skb) | 1265 | struct sk_buff *skb) |
1266 | { | 1266 | { |
1267 | struct inet_request_sock *ireq = inet_rsk(req); | 1267 | struct inet_request_sock *ireq = inet_rsk(req); |
1268 | struct net *net = sock_net(sk_listener); | ||
1268 | 1269 | ||
1269 | sk_rcv_saddr_set(req_to_sk(req), ip_hdr(skb)->daddr); | 1270 | sk_rcv_saddr_set(req_to_sk(req), ip_hdr(skb)->daddr); |
1270 | sk_daddr_set(req_to_sk(req), ip_hdr(skb)->saddr); | 1271 | sk_daddr_set(req_to_sk(req), ip_hdr(skb)->saddr); |
1271 | ireq->opt = tcp_v4_save_options(sock_net(sk_listener), skb); | 1272 | RCU_INIT_POINTER(ireq->ireq_opt, tcp_v4_save_options(net, skb)); |
1272 | } | 1273 | } |
1273 | 1274 | ||
1274 | static struct dst_entry *tcp_v4_route_req(const struct sock *sk, | 1275 | static struct dst_entry *tcp_v4_route_req(const struct sock *sk, |
@@ -1355,10 +1356,9 @@ struct sock *tcp_v4_syn_recv_sock(const struct sock *sk, struct sk_buff *skb, | |||
1355 | sk_daddr_set(newsk, ireq->ir_rmt_addr); | 1356 | sk_daddr_set(newsk, ireq->ir_rmt_addr); |
1356 | sk_rcv_saddr_set(newsk, ireq->ir_loc_addr); | 1357 | sk_rcv_saddr_set(newsk, ireq->ir_loc_addr); |
1357 | newsk->sk_bound_dev_if = ireq->ir_iif; | 1358 | newsk->sk_bound_dev_if = ireq->ir_iif; |
1358 | newinet->inet_saddr = ireq->ir_loc_addr; | 1359 | newinet->inet_saddr = ireq->ir_loc_addr; |
1359 | inet_opt = ireq->opt; | 1360 | inet_opt = rcu_dereference(ireq->ireq_opt); |
1360 | rcu_assign_pointer(newinet->inet_opt, inet_opt); | 1361 | RCU_INIT_POINTER(newinet->inet_opt, inet_opt); |
1361 | ireq->opt = NULL; | ||
1362 | newinet->mc_index = inet_iif(skb); | 1362 | newinet->mc_index = inet_iif(skb); |
1363 | newinet->mc_ttl = ip_hdr(skb)->ttl; | 1363 | newinet->mc_ttl = ip_hdr(skb)->ttl; |
1364 | newinet->rcv_tos = ip_hdr(skb)->tos; | 1364 | newinet->rcv_tos = ip_hdr(skb)->tos; |
@@ -1403,9 +1403,12 @@ struct sock *tcp_v4_syn_recv_sock(const struct sock *sk, struct sk_buff *skb, | |||
1403 | if (__inet_inherit_port(sk, newsk) < 0) | 1403 | if (__inet_inherit_port(sk, newsk) < 0) |
1404 | goto put_and_exit; | 1404 | goto put_and_exit; |
1405 | *own_req = inet_ehash_nolisten(newsk, req_to_sk(req_unhash)); | 1405 | *own_req = inet_ehash_nolisten(newsk, req_to_sk(req_unhash)); |
1406 | if (*own_req) | 1406 | if (likely(*own_req)) { |
1407 | tcp_move_syn(newtp, req); | 1407 | tcp_move_syn(newtp, req); |
1408 | 1408 | ireq->ireq_opt = NULL; | |
1409 | } else { | ||
1410 | newinet->inet_opt = NULL; | ||
1411 | } | ||
1409 | return newsk; | 1412 | return newsk; |
1410 | 1413 | ||
1411 | exit_overflow: | 1414 | exit_overflow: |
@@ -1416,6 +1419,7 @@ exit: | |||
1416 | tcp_listendrop(sk); | 1419 | tcp_listendrop(sk); |
1417 | return NULL; | 1420 | return NULL; |
1418 | put_and_exit: | 1421 | put_and_exit: |
1422 | newinet->inet_opt = NULL; | ||
1419 | inet_csk_prepare_forced_close(newsk); | 1423 | inet_csk_prepare_forced_close(newsk); |
1420 | tcp_done(newsk); | 1424 | tcp_done(newsk); |
1421 | goto exit; | 1425 | goto exit; |
diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c index 102b2c90bb80..0f0d740f6c8b 100644 --- a/net/ipv4/tcp_metrics.c +++ b/net/ipv4/tcp_metrics.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/rcupdate.h> | 2 | #include <linux/rcupdate.h> |
2 | #include <linux/spinlock.h> | 3 | #include <linux/spinlock.h> |
3 | #include <linux/jiffies.h> | 4 | #include <linux/jiffies.h> |
diff --git a/net/ipv4/tcp_nv.c b/net/ipv4/tcp_nv.c index 1ff73982e28c..125fc1450b01 100644 --- a/net/ipv4/tcp_nv.c +++ b/net/ipv4/tcp_nv.c | |||
@@ -252,7 +252,7 @@ static void tcpnv_acked(struct sock *sk, const struct ack_sample *sample) | |||
252 | 252 | ||
253 | /* rate in 100's bits per second */ | 253 | /* rate in 100's bits per second */ |
254 | rate64 = ((u64)sample->in_flight) * 8000000; | 254 | rate64 = ((u64)sample->in_flight) * 8000000; |
255 | rate = (u32)div64_u64(rate64, (u64)(avg_rtt * 100)); | 255 | rate = (u32)div64_u64(rate64, (u64)(avg_rtt ?: 1) * 100); |
256 | 256 | ||
257 | /* Remember the maximum rate seen during this RTT | 257 | /* Remember the maximum rate seen during this RTT |
258 | * Note: It may be more than one RTT. This function should be | 258 | * Note: It may be more than one RTT. This function should be |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 0bc9e46a5369..478909f4694d 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -739,8 +739,10 @@ static void tcp_tsq_handler(struct sock *sk) | |||
739 | struct tcp_sock *tp = tcp_sk(sk); | 739 | struct tcp_sock *tp = tcp_sk(sk); |
740 | 740 | ||
741 | if (tp->lost_out > tp->retrans_out && | 741 | if (tp->lost_out > tp->retrans_out && |
742 | tp->snd_cwnd > tcp_packets_in_flight(tp)) | 742 | tp->snd_cwnd > tcp_packets_in_flight(tp)) { |
743 | tcp_mstamp_refresh(tp); | ||
743 | tcp_xmit_retransmit_queue(sk); | 744 | tcp_xmit_retransmit_queue(sk); |
745 | } | ||
744 | 746 | ||
745 | tcp_write_xmit(sk, tcp_current_mss(sk), tp->nonagle, | 747 | tcp_write_xmit(sk, tcp_current_mss(sk), tp->nonagle, |
746 | 0, GFP_ATOMIC); | 748 | 0, GFP_ATOMIC); |
@@ -2060,6 +2062,7 @@ static int tcp_mtu_probe(struct sock *sk) | |||
2060 | nskb->ip_summed = skb->ip_summed; | 2062 | nskb->ip_summed = skb->ip_summed; |
2061 | 2063 | ||
2062 | tcp_insert_write_queue_before(nskb, skb, sk); | 2064 | tcp_insert_write_queue_before(nskb, skb, sk); |
2065 | tcp_highest_sack_replace(sk, skb, nskb); | ||
2063 | 2066 | ||
2064 | len = 0; | 2067 | len = 0; |
2065 | tcp_for_write_queue_from_safe(skb, next, sk) { | 2068 | tcp_for_write_queue_from_safe(skb, next, sk) { |
@@ -2237,6 +2240,7 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle, | |||
2237 | 2240 | ||
2238 | sent_pkts = 0; | 2241 | sent_pkts = 0; |
2239 | 2242 | ||
2243 | tcp_mstamp_refresh(tp); | ||
2240 | if (!push_one) { | 2244 | if (!push_one) { |
2241 | /* Do MTU probing. */ | 2245 | /* Do MTU probing. */ |
2242 | result = tcp_mtu_probe(sk); | 2246 | result = tcp_mtu_probe(sk); |
@@ -2248,7 +2252,6 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle, | |||
2248 | } | 2252 | } |
2249 | 2253 | ||
2250 | max_segs = tcp_tso_segs(sk, mss_now); | 2254 | max_segs = tcp_tso_segs(sk, mss_now); |
2251 | tcp_mstamp_refresh(tp); | ||
2252 | while ((skb = tcp_send_head(sk))) { | 2255 | while ((skb = tcp_send_head(sk))) { |
2253 | unsigned int limit; | 2256 | unsigned int limit; |
2254 | 2257 | ||
@@ -2663,7 +2666,7 @@ static bool tcp_collapse_retrans(struct sock *sk, struct sk_buff *skb) | |||
2663 | else if (!skb_shift(skb, next_skb, next_skb_size)) | 2666 | else if (!skb_shift(skb, next_skb, next_skb_size)) |
2664 | return false; | 2667 | return false; |
2665 | } | 2668 | } |
2666 | tcp_highest_sack_combine(sk, next_skb, skb); | 2669 | tcp_highest_sack_replace(sk, next_skb, skb); |
2667 | 2670 | ||
2668 | tcp_unlink_write_queue(next_skb, sk); | 2671 | tcp_unlink_write_queue(next_skb, sk); |
2669 | 2672 | ||
@@ -2841,8 +2844,10 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs) | |||
2841 | nskb = __pskb_copy(skb, MAX_TCP_HEADER, GFP_ATOMIC); | 2844 | nskb = __pskb_copy(skb, MAX_TCP_HEADER, GFP_ATOMIC); |
2842 | err = nskb ? tcp_transmit_skb(sk, nskb, 0, GFP_ATOMIC) : | 2845 | err = nskb ? tcp_transmit_skb(sk, nskb, 0, GFP_ATOMIC) : |
2843 | -ENOBUFS; | 2846 | -ENOBUFS; |
2844 | if (!err) | 2847 | if (!err) { |
2845 | skb->skb_mstamp = tp->tcp_mstamp; | 2848 | skb->skb_mstamp = tp->tcp_mstamp; |
2849 | tcp_rate_skb_sent(sk, skb); | ||
2850 | } | ||
2846 | } else { | 2851 | } else { |
2847 | err = tcp_transmit_skb(sk, skb, 1, GFP_ATOMIC); | 2852 | err = tcp_transmit_skb(sk, skb, 1, GFP_ATOMIC); |
2848 | } | 2853 | } |
@@ -3175,13 +3180,8 @@ struct sk_buff *tcp_make_synack(const struct sock *sk, struct dst_entry *dst, | |||
3175 | th->source = htons(ireq->ir_num); | 3180 | th->source = htons(ireq->ir_num); |
3176 | th->dest = ireq->ir_rmt_port; | 3181 | th->dest = ireq->ir_rmt_port; |
3177 | skb->mark = ireq->ir_mark; | 3182 | skb->mark = ireq->ir_mark; |
3178 | /* Setting of flags are superfluous here for callers (and ECE is | 3183 | skb->ip_summed = CHECKSUM_PARTIAL; |
3179 | * not even correctly set) | 3184 | th->seq = htonl(tcp_rsk(req)->snt_isn); |
3180 | */ | ||
3181 | tcp_init_nondata_skb(skb, tcp_rsk(req)->snt_isn, | ||
3182 | TCPHDR_SYN | TCPHDR_ACK); | ||
3183 | |||
3184 | th->seq = htonl(TCP_SKB_CB(skb)->seq); | ||
3185 | /* XXX data is queued and acked as is. No buffer/window check */ | 3185 | /* XXX data is queued and acked as is. No buffer/window check */ |
3186 | th->ack_seq = htonl(tcp_rsk(req)->rcv_nxt); | 3186 | th->ack_seq = htonl(tcp_rsk(req)->rcv_nxt); |
3187 | 3187 | ||
diff --git a/net/ipv4/tcp_recovery.c b/net/ipv4/tcp_recovery.c index 449cd914d58e..be8ef1e5dfef 100644 --- a/net/ipv4/tcp_recovery.c +++ b/net/ipv4/tcp_recovery.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/tcp.h> | 2 | #include <linux/tcp.h> |
2 | #include <net/tcp.h> | 3 | #include <net/tcp.h> |
3 | 4 | ||
diff --git a/net/ipv4/tcp_vegas.h b/net/ipv4/tcp_vegas.h index 248cfc0ff9ae..4f24d0e37d9c 100644 --- a/net/ipv4/tcp_vegas.h +++ b/net/ipv4/tcp_vegas.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * TCP Vegas congestion control interface | 3 | * TCP Vegas congestion control interface |
3 | */ | 4 | */ |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index e45177ceb0ee..ebfbccae62fd 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -231,10 +231,7 @@ static int udp_reuseport_add_sock(struct sock *sk, struct udp_hslot *hslot) | |||
231 | } | 231 | } |
232 | } | 232 | } |
233 | 233 | ||
234 | /* Initial allocation may have already happened via setsockopt */ | 234 | return reuseport_alloc(sk); |
235 | if (!rcu_access_pointer(sk->sk_reuseport_cb)) | ||
236 | return reuseport_alloc(sk); | ||
237 | return 0; | ||
238 | } | 235 | } |
239 | 236 | ||
240 | /** | 237 | /** |
@@ -1061,7 +1058,7 @@ back_from_confirm: | |||
1061 | /* ... which is an evident application bug. --ANK */ | 1058 | /* ... which is an evident application bug. --ANK */ |
1062 | release_sock(sk); | 1059 | release_sock(sk); |
1063 | 1060 | ||
1064 | net_dbg_ratelimited("cork app bug 2\n"); | 1061 | net_dbg_ratelimited("socket already corked\n"); |
1065 | err = -EINVAL; | 1062 | err = -EINVAL; |
1066 | goto out; | 1063 | goto out; |
1067 | } | 1064 | } |
@@ -1144,7 +1141,7 @@ int udp_sendpage(struct sock *sk, struct page *page, int offset, | |||
1144 | if (unlikely(!up->pending)) { | 1141 | if (unlikely(!up->pending)) { |
1145 | release_sock(sk); | 1142 | release_sock(sk); |
1146 | 1143 | ||
1147 | net_dbg_ratelimited("udp cork app bug 3\n"); | 1144 | net_dbg_ratelimited("cork failed\n"); |
1148 | return -EINVAL; | 1145 | return -EINVAL; |
1149 | } | 1146 | } |
1150 | 1147 | ||
diff --git a/net/ipv4/udp_impl.h b/net/ipv4/udp_impl.h index a8cf8c6fb60c..e7d18b140287 100644 --- a/net/ipv4/udp_impl.h +++ b/net/ipv4/udp_impl.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef _UDP4_IMPL_H | 2 | #ifndef _UDP4_IMPL_H |
2 | #define _UDP4_IMPL_H | 3 | #define _UDP4_IMPL_H |
3 | #include <net/udp.h> | 4 | #include <net/udp.h> |
diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c index 1fc684111ce6..e50b7fea57ee 100644 --- a/net/ipv4/xfrm4_input.c +++ b/net/ipv4/xfrm4_input.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * xfrm4_input.c | 3 | * xfrm4_input.c |
3 | * | 4 | * |
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index d7bf0b041885..05017e2c849c 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * xfrm4_policy.c | 3 | * xfrm4_policy.c |
3 | * | 4 | * |
diff --git a/net/ipv4/xfrm4_state.c b/net/ipv4/xfrm4_state.c index d6660a8c0ea5..80c40b4981bb 100644 --- a/net/ipv4/xfrm4_state.c +++ b/net/ipv4/xfrm4_state.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * xfrm4_state.c | 3 | * xfrm4_state.c |
3 | * | 4 | * |
diff --git a/net/ipv6/Makefile b/net/ipv6/Makefile index 10e342363793..e0026fa1261b 100644 --- a/net/ipv6/Makefile +++ b/net/ipv6/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the Linux TCP/IP (INET6) layer. | 3 | # Makefile for the Linux TCP/IP (INET6) layer. |
3 | # | 4 | # |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 4a96ebbf8eda..8a1c846d3df9 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -3335,6 +3335,7 @@ static void addrconf_permanent_addr(struct net_device *dev) | |||
3335 | if ((ifp->flags & IFA_F_PERMANENT) && | 3335 | if ((ifp->flags & IFA_F_PERMANENT) && |
3336 | fixup_permanent_addr(idev, ifp) < 0) { | 3336 | fixup_permanent_addr(idev, ifp) < 0) { |
3337 | write_unlock_bh(&idev->lock); | 3337 | write_unlock_bh(&idev->lock); |
3338 | in6_ifa_hold(ifp); | ||
3338 | ipv6_del_addr(ifp); | 3339 | ipv6_del_addr(ifp); |
3339 | write_lock_bh(&idev->lock); | 3340 | write_lock_bh(&idev->lock); |
3340 | 3341 | ||
diff --git a/net/ipv6/addrlabel.c b/net/ipv6/addrlabel.c index b055bc79f56d..f664871feca6 100644 --- a/net/ipv6/addrlabel.c +++ b/net/ipv6/addrlabel.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * IPv6 Address Label subsystem | 3 | * IPv6 Address Label subsystem |
3 | * for the IPv6 "Default" Source Address Selection | 4 | * for the IPv6 "Default" Source Address Selection |
diff --git a/net/ipv6/ila/ila_lwt.c b/net/ipv6/ila/ila_lwt.c index 0c02a09bc351..696281b4bca2 100644 --- a/net/ipv6/ila/ila_lwt.c +++ b/net/ipv6/ila/ila_lwt.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/errno.h> | 2 | #include <linux/errno.h> |
2 | #include <linux/ip.h> | 3 | #include <linux/ip.h> |
3 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
diff --git a/net/ipv6/ila/ila_xlat.c b/net/ipv6/ila/ila_xlat.c index 5bd419c1abc8..3123b9de91b5 100644 --- a/net/ipv6/ila/ila_xlat.c +++ b/net/ipv6/ila/ila_xlat.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/jhash.h> | 2 | #include <linux/jhash.h> |
2 | #include <linux/netfilter.h> | 3 | #include <linux/netfilter.h> |
3 | #include <linux/rcupdate.h> | 4 | #include <linux/rcupdate.h> |
diff --git a/net/ipv6/ip6_checksum.c b/net/ipv6/ip6_checksum.c index c0cbcb259f5a..ec43d18b5ff9 100644 --- a/net/ipv6/ip6_checksum.c +++ b/net/ipv6/ip6_checksum.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <net/ip.h> | 2 | #include <net/ip.h> |
2 | #include <net/udp.h> | 3 | #include <net/udp.h> |
3 | #include <net/udplite.h> | 4 | #include <net/udplite.h> |
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c index 8081bafe441b..15535ee327c5 100644 --- a/net/ipv6/ip6_flowlabel.c +++ b/net/ipv6/ip6_flowlabel.c | |||
@@ -315,6 +315,7 @@ struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions *opt_space, | |||
315 | } | 315 | } |
316 | opt_space->dst1opt = fopt->dst1opt; | 316 | opt_space->dst1opt = fopt->dst1opt; |
317 | opt_space->opt_flen = fopt->opt_flen; | 317 | opt_space->opt_flen = fopt->opt_flen; |
318 | opt_space->tot_len = fopt->tot_len; | ||
318 | return opt_space; | 319 | return opt_space; |
319 | } | 320 | } |
320 | EXPORT_SYMBOL_GPL(fl6_merge_options); | 321 | EXPORT_SYMBOL_GPL(fl6_merge_options); |
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 1602b491b281..59c121b932ac 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c | |||
@@ -408,13 +408,16 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
408 | case ICMPV6_DEST_UNREACH: | 408 | case ICMPV6_DEST_UNREACH: |
409 | net_dbg_ratelimited("%s: Path to destination invalid or inactive!\n", | 409 | net_dbg_ratelimited("%s: Path to destination invalid or inactive!\n", |
410 | t->parms.name); | 410 | t->parms.name); |
411 | break; | 411 | if (code != ICMPV6_PORT_UNREACH) |
412 | break; | ||
413 | return; | ||
412 | case ICMPV6_TIME_EXCEED: | 414 | case ICMPV6_TIME_EXCEED: |
413 | if (code == ICMPV6_EXC_HOPLIMIT) { | 415 | if (code == ICMPV6_EXC_HOPLIMIT) { |
414 | net_dbg_ratelimited("%s: Too small hop limit or routing loop in tunnel!\n", | 416 | net_dbg_ratelimited("%s: Too small hop limit or routing loop in tunnel!\n", |
415 | t->parms.name); | 417 | t->parms.name); |
418 | break; | ||
416 | } | 419 | } |
417 | break; | 420 | return; |
418 | case ICMPV6_PARAMPROB: | 421 | case ICMPV6_PARAMPROB: |
419 | teli = 0; | 422 | teli = 0; |
420 | if (code == ICMPV6_HDR_FIELD) | 423 | if (code == ICMPV6_HDR_FIELD) |
@@ -430,7 +433,7 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
430 | net_dbg_ratelimited("%s: Recipient unable to parse tunneled packet!\n", | 433 | net_dbg_ratelimited("%s: Recipient unable to parse tunneled packet!\n", |
431 | t->parms.name); | 434 | t->parms.name); |
432 | } | 435 | } |
433 | break; | 436 | return; |
434 | case ICMPV6_PKT_TOOBIG: | 437 | case ICMPV6_PKT_TOOBIG: |
435 | mtu = be32_to_cpu(info) - offset - t->tun_hlen; | 438 | mtu = be32_to_cpu(info) - offset - t->tun_hlen; |
436 | if (t->dev->type == ARPHRD_ETHER) | 439 | if (t->dev->type == ARPHRD_ETHER) |
@@ -438,7 +441,7 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
438 | if (mtu < IPV6_MIN_MTU) | 441 | if (mtu < IPV6_MIN_MTU) |
439 | mtu = IPV6_MIN_MTU; | 442 | mtu = IPV6_MIN_MTU; |
440 | t->dev->mtu = mtu; | 443 | t->dev->mtu = mtu; |
441 | break; | 444 | return; |
442 | } | 445 | } |
443 | 446 | ||
444 | if (time_before(jiffies, t->err_time + IP6TUNNEL_ERR_TIMEO)) | 447 | if (time_before(jiffies, t->err_time + IP6TUNNEL_ERR_TIMEO)) |
@@ -500,8 +503,8 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb, | |||
500 | __u32 *pmtu, __be16 proto) | 503 | __u32 *pmtu, __be16 proto) |
501 | { | 504 | { |
502 | struct ip6_tnl *tunnel = netdev_priv(dev); | 505 | struct ip6_tnl *tunnel = netdev_priv(dev); |
503 | __be16 protocol = (dev->type == ARPHRD_ETHER) ? | 506 | struct dst_entry *dst = skb_dst(skb); |
504 | htons(ETH_P_TEB) : proto; | 507 | __be16 protocol; |
505 | 508 | ||
506 | if (dev->type == ARPHRD_ETHER) | 509 | if (dev->type == ARPHRD_ETHER) |
507 | IPCB(skb)->flags = 0; | 510 | IPCB(skb)->flags = 0; |
@@ -515,9 +518,14 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb, | |||
515 | tunnel->o_seqno++; | 518 | tunnel->o_seqno++; |
516 | 519 | ||
517 | /* Push GRE header. */ | 520 | /* Push GRE header. */ |
521 | protocol = (dev->type == ARPHRD_ETHER) ? htons(ETH_P_TEB) : proto; | ||
518 | gre_build_header(skb, tunnel->tun_hlen, tunnel->parms.o_flags, | 522 | gre_build_header(skb, tunnel->tun_hlen, tunnel->parms.o_flags, |
519 | protocol, tunnel->parms.o_key, htonl(tunnel->o_seqno)); | 523 | protocol, tunnel->parms.o_key, htonl(tunnel->o_seqno)); |
520 | 524 | ||
525 | /* TooBig packet may have updated dst->dev's mtu */ | ||
526 | if (dst && dst_mtu(dst) > dst->dev->mtu) | ||
527 | dst->ops->update_pmtu(dst, NULL, skb, dst->dev->mtu); | ||
528 | |||
521 | return ip6_tnl_xmit(skb, dev, dsfield, fl6, encap_limit, pmtu, | 529 | return ip6_tnl_xmit(skb, dev, dsfield, fl6, encap_limit, pmtu, |
522 | NEXTHDR_GRE); | 530 | NEXTHDR_GRE); |
523 | } | 531 | } |
diff --git a/net/ipv6/ip6_icmp.c b/net/ipv6/ip6_icmp.c index 713676f14a0e..02045494c24c 100644 --- a/net/ipv6/ip6_icmp.c +++ b/net/ipv6/ip6_icmp.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/export.h> | 2 | #include <linux/export.h> |
2 | #include <linux/icmpv6.h> | 3 | #include <linux/icmpv6.h> |
3 | #include <linux/mutex.h> | 4 | #include <linux/mutex.h> |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 43ca864327c7..5110a418cc4d 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -1161,11 +1161,11 @@ static int ip6_setup_cork(struct sock *sk, struct inet_cork_full *cork, | |||
1161 | if (WARN_ON(v6_cork->opt)) | 1161 | if (WARN_ON(v6_cork->opt)) |
1162 | return -EINVAL; | 1162 | return -EINVAL; |
1163 | 1163 | ||
1164 | v6_cork->opt = kzalloc(opt->tot_len, sk->sk_allocation); | 1164 | v6_cork->opt = kzalloc(sizeof(*opt), sk->sk_allocation); |
1165 | if (unlikely(!v6_cork->opt)) | 1165 | if (unlikely(!v6_cork->opt)) |
1166 | return -ENOBUFS; | 1166 | return -ENOBUFS; |
1167 | 1167 | ||
1168 | v6_cork->opt->tot_len = opt->tot_len; | 1168 | v6_cork->opt->tot_len = sizeof(*opt); |
1169 | v6_cork->opt->opt_flen = opt->opt_flen; | 1169 | v6_cork->opt->opt_flen = opt->opt_flen; |
1170 | v6_cork->opt->opt_nflen = opt->opt_nflen; | 1170 | v6_cork->opt->opt_nflen = opt->opt_nflen; |
1171 | 1171 | ||
diff --git a/net/ipv6/netfilter/Makefile b/net/ipv6/netfilter/Makefile index fe180c96040e..c6ee0cdd0ba9 100644 --- a/net/ipv6/netfilter/Makefile +++ b/net/ipv6/netfilter/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the netfilter modules on top of IPv6. | 3 | # Makefile for the netfilter modules on top of IPv6. |
3 | # | 4 | # |
diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c index 6fbf8ae5e52c..f7051ba5b8af 100644 --- a/net/ipv6/sysctl_net_ipv6.c +++ b/net/ipv6/sysctl_net_ipv6.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * sysctl_net_ipv6.c: sysctl interface to net IPV6 subsystem. | 3 | * sysctl_net_ipv6.c: sysctl interface to net IPV6 subsystem. |
3 | * | 4 | * |
diff --git a/net/ipv6/udp_impl.h b/net/ipv6/udp_impl.h index f180b3d85e31..7903e21c178b 100644 --- a/net/ipv6/udp_impl.h +++ b/net/ipv6/udp_impl.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef _UDP6_IMPL_H | 2 | #ifndef _UDP6_IMPL_H |
2 | #define _UDP6_IMPL_H | 3 | #define _UDP6_IMPL_H |
3 | #include <net/udp.h> | 4 | #include <net/udp.h> |
diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c index f95943a13abc..fe04e23af986 100644 --- a/net/ipv6/xfrm6_input.c +++ b/net/ipv6/xfrm6_input.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * xfrm6_input.c: based on net/ipv4/xfrm4_input.c | 3 | * xfrm6_input.c: based on net/ipv4/xfrm4_input.c |
3 | * | 4 | * |
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index 11d1314ab6c5..17e95a0386b3 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * xfrm6_policy.c: based on xfrm4_policy.c | 3 | * xfrm6_policy.c: based on xfrm4_policy.c |
3 | * | 4 | * |
diff --git a/net/ipv6/xfrm6_state.c b/net/ipv6/xfrm6_state.c index 8a1f9c0d2a13..b15075a5c227 100644 --- a/net/ipv6/xfrm6_state.c +++ b/net/ipv6/xfrm6_state.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * xfrm6_state.c: based on xfrm4_state.c | 3 | * xfrm6_state.c: based on xfrm4_state.c |
3 | * | 4 | * |
diff --git a/net/ipx/ipx_proc.c b/net/ipx/ipx_proc.c index 7d75e4c5c75d..38a3d51d9ead 100644 --- a/net/ipx/ipx_proc.c +++ b/net/ipx/ipx_proc.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * IPX proc routines | 3 | * IPX proc routines |
3 | * | 4 | * |
diff --git a/net/ipx/ipx_route.c b/net/ipx/ipx_route.c index b5d91447f3dc..3cf93aa9f284 100644 --- a/net/ipx/ipx_route.c +++ b/net/ipx/ipx_route.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Implements the IPX routing routines. | 3 | * Implements the IPX routing routines. |
3 | * Code moved from af_ipx.c. | 4 | * Code moved from af_ipx.c. |
diff --git a/net/ipx/pe2.c b/net/ipx/pe2.c index 32dcd601ab32..ba7d4214bbff 100644 --- a/net/ipx/pe2.c +++ b/net/ipx/pe2.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/in.h> | 2 | #include <linux/in.h> |
2 | #include <linux/mm.h> | 3 | #include <linux/mm.h> |
3 | #include <linux/module.h> | 4 | #include <linux/module.h> |
diff --git a/net/ipx/sysctl_net_ipx.c b/net/ipx/sysctl_net_ipx.c index 0dafcc561ed6..c3eef457db88 100644 --- a/net/ipx/sysctl_net_ipx.c +++ b/net/ipx/sysctl_net_ipx.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* -*- linux-c -*- | 2 | /* -*- linux-c -*- |
2 | * sysctl_net_ipx.c: sysctl interface to net IPX subsystem. | 3 | * sysctl_net_ipx.c: sysctl interface to net IPX subsystem. |
3 | * | 4 | * |
diff --git a/net/kcm/kcmproc.c b/net/kcm/kcmproc.c index c748e8a6a72c..bd5723315069 100644 --- a/net/kcm/kcmproc.c +++ b/net/kcm/kcmproc.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/in.h> | 2 | #include <linux/in.h> |
2 | #include <linux/inet.h> | 3 | #include <linux/inet.h> |
3 | #include <linux/list.h> | 4 | #include <linux/list.h> |
diff --git a/net/l2tp/Makefile b/net/l2tp/Makefile index 2870f41ea44d..399a7e5db2f4 100644 --- a/net/l2tp/Makefile +++ b/net/l2tp/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the L2TP. | 3 | # Makefile for the L2TP. |
3 | # | 4 | # |
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c index bc6e8bfc5be4..0c2738349442 100644 --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c | |||
@@ -584,6 +584,7 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr, | |||
584 | u32 tunnel_id, peer_tunnel_id; | 584 | u32 tunnel_id, peer_tunnel_id; |
585 | u32 session_id, peer_session_id; | 585 | u32 session_id, peer_session_id; |
586 | bool drop_refcnt = false; | 586 | bool drop_refcnt = false; |
587 | bool drop_tunnel = false; | ||
587 | int ver = 2; | 588 | int ver = 2; |
588 | int fd; | 589 | int fd; |
589 | 590 | ||
@@ -652,7 +653,9 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr, | |||
652 | if (tunnel_id == 0) | 653 | if (tunnel_id == 0) |
653 | goto end; | 654 | goto end; |
654 | 655 | ||
655 | tunnel = l2tp_tunnel_find(sock_net(sk), tunnel_id); | 656 | tunnel = l2tp_tunnel_get(sock_net(sk), tunnel_id); |
657 | if (tunnel) | ||
658 | drop_tunnel = true; | ||
656 | 659 | ||
657 | /* Special case: create tunnel context if session_id and | 660 | /* Special case: create tunnel context if session_id and |
658 | * peer_session_id is 0. Otherwise look up tunnel using supplied | 661 | * peer_session_id is 0. Otherwise look up tunnel using supplied |
@@ -781,6 +784,8 @@ out_no_ppp: | |||
781 | end: | 784 | end: |
782 | if (drop_refcnt) | 785 | if (drop_refcnt) |
783 | l2tp_session_dec_refcount(session); | 786 | l2tp_session_dec_refcount(session); |
787 | if (drop_tunnel) | ||
788 | l2tp_tunnel_dec_refcount(tunnel); | ||
784 | release_sock(sk); | 789 | release_sock(sk); |
785 | 790 | ||
786 | return error; | 791 | return error; |
@@ -988,6 +993,9 @@ static int pppol2tp_session_ioctl(struct l2tp_session *session, | |||
988 | session->name, cmd, arg); | 993 | session->name, cmd, arg); |
989 | 994 | ||
990 | sk = ps->sock; | 995 | sk = ps->sock; |
996 | if (!sk) | ||
997 | return -EBADR; | ||
998 | |||
991 | sock_hold(sk); | 999 | sock_hold(sk); |
992 | 1000 | ||
993 | switch (cmd) { | 1001 | switch (cmd) { |
diff --git a/net/llc/sysctl_net_llc.c b/net/llc/sysctl_net_llc.c index 799bafc2af39..8443a6d841b0 100644 --- a/net/llc/sysctl_net_llc.c +++ b/net/llc/sysctl_net_llc.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * sysctl_net_llc.c: sysctl interface to LLC net subsystem. | 3 | * sysctl_net_llc.c: sysctl interface to LLC net subsystem. |
3 | * | 4 | * |
diff --git a/net/mac80211/Makefile b/net/mac80211/Makefile index 282912245938..80bfe29099f6 100644 --- a/net/mac80211/Makefile +++ b/net/mac80211/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | obj-$(CONFIG_MAC80211) += mac80211.o | 2 | obj-$(CONFIG_MAC80211) += mac80211.o |
2 | 3 | ||
3 | # mac80211 objects | 4 | # mac80211 objects |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index a354f1939e49..fb15d3b97cb2 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -2727,12 +2727,6 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy, | |||
2727 | if (!ieee80211_sdata_running(sdata)) | 2727 | if (!ieee80211_sdata_running(sdata)) |
2728 | return -ENETDOWN; | 2728 | return -ENETDOWN; |
2729 | 2729 | ||
2730 | if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) { | ||
2731 | ret = drv_set_bitrate_mask(local, sdata, mask); | ||
2732 | if (ret) | ||
2733 | return ret; | ||
2734 | } | ||
2735 | |||
2736 | /* | 2730 | /* |
2737 | * If active validate the setting and reject it if it doesn't leave | 2731 | * If active validate the setting and reject it if it doesn't leave |
2738 | * at least one basic rate usable, since we really have to be able | 2732 | * at least one basic rate usable, since we really have to be able |
@@ -2748,6 +2742,12 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy, | |||
2748 | return -EINVAL; | 2742 | return -EINVAL; |
2749 | } | 2743 | } |
2750 | 2744 | ||
2745 | if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) { | ||
2746 | ret = drv_set_bitrate_mask(local, sdata, mask); | ||
2747 | if (ret) | ||
2748 | return ret; | ||
2749 | } | ||
2750 | |||
2751 | for (i = 0; i < NUM_NL80211_BANDS; i++) { | 2751 | for (i = 0; i < NUM_NL80211_BANDS; i++) { |
2752 | struct ieee80211_supported_band *sband = wiphy->bands[i]; | 2752 | struct ieee80211_supported_band *sband = wiphy->bands[i]; |
2753 | int j; | 2753 | int j; |
diff --git a/net/mac80211/debug.h b/net/mac80211/debug.h index 1956b3115dd5..d90a8f9cc3fd 100644 --- a/net/mac80211/debug.h +++ b/net/mac80211/debug.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef __MAC80211_DEBUG_H | 2 | #ifndef __MAC80211_DEBUG_H |
2 | #define __MAC80211_DEBUG_H | 3 | #define __MAC80211_DEBUG_H |
3 | #include <net/cfg80211.h> | 4 | #include <net/cfg80211.h> |
diff --git a/net/mac80211/debugfs.h b/net/mac80211/debugfs.h index 60c35afee29d..d2c424787463 100644 --- a/net/mac80211/debugfs.h +++ b/net/mac80211/debugfs.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef __MAC80211_DEBUGFS_H | 2 | #ifndef __MAC80211_DEBUGFS_H |
2 | #define __MAC80211_DEBUGFS_H | 3 | #define __MAC80211_DEBUGFS_H |
3 | 4 | ||
diff --git a/net/mac80211/debugfs_key.h b/net/mac80211/debugfs_key.h index 32adc77e9c77..1cd7b8bff56c 100644 --- a/net/mac80211/debugfs_key.h +++ b/net/mac80211/debugfs_key.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef __MAC80211_DEBUGFS_KEY_H | 2 | #ifndef __MAC80211_DEBUGFS_KEY_H |
2 | #define __MAC80211_DEBUGFS_KEY_H | 3 | #define __MAC80211_DEBUGFS_KEY_H |
3 | 4 | ||
diff --git a/net/mac80211/debugfs_netdev.h b/net/mac80211/debugfs_netdev.h index 9f5501a9a795..a7e9d8d518f9 100644 --- a/net/mac80211/debugfs_netdev.h +++ b/net/mac80211/debugfs_netdev.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* routines exported for debugfs handling */ | 2 | /* routines exported for debugfs handling */ |
2 | 3 | ||
3 | #ifndef __IEEE80211_DEBUGFS_NETDEV_H | 4 | #ifndef __IEEE80211_DEBUGFS_NETDEV_H |
diff --git a/net/mac80211/debugfs_sta.h b/net/mac80211/debugfs_sta.h index 8b608903259f..d2e7c27ad6d1 100644 --- a/net/mac80211/debugfs_sta.h +++ b/net/mac80211/debugfs_sta.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef __MAC80211_DEBUGFS_STA_H | 2 | #ifndef __MAC80211_DEBUGFS_STA_H |
2 | #define __MAC80211_DEBUGFS_STA_H | 3 | #define __MAC80211_DEBUGFS_STA_H |
3 | 4 | ||
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index 09f77e4a8a79..c7f93fd9ca7a 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Portions of this file | 3 | * Portions of this file |
3 | * Copyright(c) 2016 Intel Deutschland GmbH | 4 | * Copyright(c) 2016 Intel Deutschland GmbH |
diff --git a/net/mac80211/key.c b/net/mac80211/key.c index a98fc2b5e0dc..938049395f90 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> | 4 | * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> |
5 | * Copyright 2007-2008 Johannes Berg <johannes@sipsolutions.net> | 5 | * Copyright 2007-2008 Johannes Berg <johannes@sipsolutions.net> |
6 | * Copyright 2013-2014 Intel Mobile Communications GmbH | 6 | * Copyright 2013-2014 Intel Mobile Communications GmbH |
7 | * Copyright 2015 Intel Deutschland GmbH | 7 | * Copyright 2015-2017 Intel Deutschland GmbH |
8 | * | 8 | * |
9 | * 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 |
10 | * 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 |
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
20 | #include <linux/export.h> | 20 | #include <linux/export.h> |
21 | #include <net/mac80211.h> | 21 | #include <net/mac80211.h> |
22 | #include <crypto/algapi.h> | ||
22 | #include <asm/unaligned.h> | 23 | #include <asm/unaligned.h> |
23 | #include "ieee80211_i.h" | 24 | #include "ieee80211_i.h" |
24 | #include "driver-ops.h" | 25 | #include "driver-ops.h" |
@@ -609,6 +610,39 @@ void ieee80211_key_free_unused(struct ieee80211_key *key) | |||
609 | ieee80211_key_free_common(key); | 610 | ieee80211_key_free_common(key); |
610 | } | 611 | } |
611 | 612 | ||
613 | static bool ieee80211_key_identical(struct ieee80211_sub_if_data *sdata, | ||
614 | struct ieee80211_key *old, | ||
615 | struct ieee80211_key *new) | ||
616 | { | ||
617 | u8 tkip_old[WLAN_KEY_LEN_TKIP], tkip_new[WLAN_KEY_LEN_TKIP]; | ||
618 | u8 *tk_old, *tk_new; | ||
619 | |||
620 | if (!old || new->conf.keylen != old->conf.keylen) | ||
621 | return false; | ||
622 | |||
623 | tk_old = old->conf.key; | ||
624 | tk_new = new->conf.key; | ||
625 | |||
626 | /* | ||
627 | * In station mode, don't compare the TX MIC key, as it's never used | ||
628 | * and offloaded rekeying may not care to send it to the host. This | ||
629 | * is the case in iwlwifi, for example. | ||
630 | */ | ||
631 | if (sdata->vif.type == NL80211_IFTYPE_STATION && | ||
632 | new->conf.cipher == WLAN_CIPHER_SUITE_TKIP && | ||
633 | new->conf.keylen == WLAN_KEY_LEN_TKIP && | ||
634 | !(new->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE)) { | ||
635 | memcpy(tkip_old, tk_old, WLAN_KEY_LEN_TKIP); | ||
636 | memcpy(tkip_new, tk_new, WLAN_KEY_LEN_TKIP); | ||
637 | memset(tkip_old + NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY, 0, 8); | ||
638 | memset(tkip_new + NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY, 0, 8); | ||
639 | tk_old = tkip_old; | ||
640 | tk_new = tkip_new; | ||
641 | } | ||
642 | |||
643 | return !crypto_memneq(tk_old, tk_new, new->conf.keylen); | ||
644 | } | ||
645 | |||
612 | int ieee80211_key_link(struct ieee80211_key *key, | 646 | int ieee80211_key_link(struct ieee80211_key *key, |
613 | struct ieee80211_sub_if_data *sdata, | 647 | struct ieee80211_sub_if_data *sdata, |
614 | struct sta_info *sta) | 648 | struct sta_info *sta) |
@@ -620,9 +654,6 @@ int ieee80211_key_link(struct ieee80211_key *key, | |||
620 | 654 | ||
621 | pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE; | 655 | pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE; |
622 | idx = key->conf.keyidx; | 656 | idx = key->conf.keyidx; |
623 | key->local = sdata->local; | ||
624 | key->sdata = sdata; | ||
625 | key->sta = sta; | ||
626 | 657 | ||
627 | mutex_lock(&sdata->local->key_mtx); | 658 | mutex_lock(&sdata->local->key_mtx); |
628 | 659 | ||
@@ -633,6 +664,20 @@ int ieee80211_key_link(struct ieee80211_key *key, | |||
633 | else | 664 | else |
634 | old_key = key_mtx_dereference(sdata->local, sdata->keys[idx]); | 665 | old_key = key_mtx_dereference(sdata->local, sdata->keys[idx]); |
635 | 666 | ||
667 | /* | ||
668 | * Silently accept key re-installation without really installing the | ||
669 | * new version of the key to avoid nonce reuse or replay issues. | ||
670 | */ | ||
671 | if (ieee80211_key_identical(sdata, old_key, key)) { | ||
672 | ieee80211_key_free_unused(key); | ||
673 | ret = 0; | ||
674 | goto out; | ||
675 | } | ||
676 | |||
677 | key->local = sdata->local; | ||
678 | key->sdata = sdata; | ||
679 | key->sta = sta; | ||
680 | |||
636 | increment_tailroom_need_count(sdata); | 681 | increment_tailroom_need_count(sdata); |
637 | 682 | ||
638 | ieee80211_key_replace(sdata, sta, pairwise, old_key, key); | 683 | ieee80211_key_replace(sdata, sta, pairwise, old_key, key); |
@@ -648,6 +693,7 @@ int ieee80211_key_link(struct ieee80211_key *key, | |||
648 | ret = 0; | 693 | ret = 0; |
649 | } | 694 | } |
650 | 695 | ||
696 | out: | ||
651 | mutex_unlock(&sdata->local->key_mtx); | 697 | mutex_unlock(&sdata->local->key_mtx); |
652 | 698 | ||
653 | return ret; | 699 | return ret; |
diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c index a87d195c4a61..38c45e1dafd8 100644 --- a/net/mac80211/pm.c +++ b/net/mac80211/pm.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <net/mac80211.h> | 2 | #include <net/mac80211.h> |
2 | #include <net/rtnetlink.h> | 3 | #include <net/rtnetlink.h> |
3 | 4 | ||
diff --git a/net/mac80211/trace.c b/net/mac80211/trace.c index edfe0c170a1c..837857261b66 100644 --- a/net/mac80211/trace.c +++ b/net/mac80211/trace.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* bug in tracepoint.h, it should include this */ | 2 | /* bug in tracepoint.h, it should include this */ |
2 | #include <linux/module.h> | 3 | #include <linux/module.h> |
3 | 4 | ||
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h index 3d9ac17af407..591ad02e1fa4 100644 --- a/net/mac80211/trace.h +++ b/net/mac80211/trace.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Portions of this file | 3 | * Portions of this file |
3 | * Copyright(c) 2016 Intel Deutschland GmbH | 4 | * Copyright(c) 2016 Intel Deutschland GmbH |
diff --git a/net/mac80211/trace_msg.h b/net/mac80211/trace_msg.h index 768f7c22a190..366b9e6f043e 100644 --- a/net/mac80211/trace_msg.h +++ b/net/mac80211/trace_msg.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifdef CONFIG_MAC80211_MESSAGE_TRACING | 2 | #ifdef CONFIG_MAC80211_MESSAGE_TRACING |
2 | 3 | ||
3 | #if !defined(__MAC80211_MSG_DRIVER_TRACE) || defined(TRACE_HEADER_MULTI_READ) | 4 | #if !defined(__MAC80211_MSG_DRIVER_TRACE) || defined(TRACE_HEADER_MULTI_READ) |
diff --git a/net/mac802154/cfg.h b/net/mac802154/cfg.h index e2718f981e82..3bb089685500 100644 --- a/net/mac802154/cfg.h +++ b/net/mac802154/cfg.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* mac802154 configuration hooks for cfg802154 | 2 | /* mac802154 configuration hooks for cfg802154 |
2 | */ | 3 | */ |
3 | 4 | ||
diff --git a/net/mac802154/driver-ops.h b/net/mac802154/driver-ops.h index fd9daf2ecec9..d23f0db98015 100644 --- a/net/mac802154/driver-ops.h +++ b/net/mac802154/driver-ops.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef __MAC802154_DRIVER_OPS | 2 | #ifndef __MAC802154_DRIVER_OPS |
2 | #define __MAC802154_DRIVER_OPS | 3 | #define __MAC802154_DRIVER_OPS |
3 | 4 | ||
diff --git a/net/mac802154/trace.c b/net/mac802154/trace.c index 863e5e6b983d..c36e3d541a42 100644 --- a/net/mac802154/trace.c +++ b/net/mac802154/trace.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/module.h> | 2 | #include <linux/module.h> |
2 | 3 | ||
3 | #ifndef __CHECKER__ | 4 | #ifndef __CHECKER__ |
diff --git a/net/mac802154/trace.h b/net/mac802154/trace.h index 6f30e0c93a16..2c8a43d3607f 100644 --- a/net/mac802154/trace.h +++ b/net/mac802154/trace.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* Based on net/mac80211/trace.h */ | 2 | /* Based on net/mac80211/trace.h */ |
2 | 3 | ||
3 | #undef TRACE_SYSTEM | 4 | #undef TRACE_SYSTEM |
diff --git a/net/mpls/internal.h b/net/mpls/internal.h index cf65aec2e551..768a302879b4 100644 --- a/net/mpls/internal.h +++ b/net/mpls/internal.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef MPLS_INTERNAL_H | 2 | #ifndef MPLS_INTERNAL_H |
2 | #define MPLS_INTERNAL_H | 3 | #define MPLS_INTERNAL_H |
3 | #include <net/mpls.h> | 4 | #include <net/mpls.h> |
diff --git a/net/ncsi/internal.h b/net/ncsi/internal.h index af3d636534ef..d30f7bd741d0 100644 --- a/net/ncsi/internal.h +++ b/net/ncsi/internal.h | |||
@@ -286,6 +286,7 @@ struct ncsi_dev_priv { | |||
286 | struct work_struct work; /* For channel management */ | 286 | struct work_struct work; /* For channel management */ |
287 | struct packet_type ptype; /* NCSI packet Rx handler */ | 287 | struct packet_type ptype; /* NCSI packet Rx handler */ |
288 | struct list_head node; /* Form NCSI device list */ | 288 | struct list_head node; /* Form NCSI device list */ |
289 | #define NCSI_MAX_VLAN_VIDS 15 | ||
289 | struct list_head vlan_vids; /* List of active VLAN IDs */ | 290 | struct list_head vlan_vids; /* List of active VLAN IDs */ |
290 | }; | 291 | }; |
291 | 292 | ||
diff --git a/net/ncsi/ncsi-aen.c b/net/ncsi/ncsi-aen.c index 6898e7229285..f135938bf781 100644 --- a/net/ncsi/ncsi-aen.c +++ b/net/ncsi/ncsi-aen.c | |||
@@ -187,7 +187,7 @@ static struct ncsi_aen_handler { | |||
187 | } ncsi_aen_handlers[] = { | 187 | } ncsi_aen_handlers[] = { |
188 | { NCSI_PKT_AEN_LSC, 12, ncsi_aen_handler_lsc }, | 188 | { NCSI_PKT_AEN_LSC, 12, ncsi_aen_handler_lsc }, |
189 | { NCSI_PKT_AEN_CR, 4, ncsi_aen_handler_cr }, | 189 | { NCSI_PKT_AEN_CR, 4, ncsi_aen_handler_cr }, |
190 | { NCSI_PKT_AEN_HNCDSC, 4, ncsi_aen_handler_hncdsc } | 190 | { NCSI_PKT_AEN_HNCDSC, 8, ncsi_aen_handler_hncdsc } |
191 | }; | 191 | }; |
192 | 192 | ||
193 | int ncsi_aen_handler(struct ncsi_dev_priv *ndp, struct sk_buff *skb) | 193 | int ncsi_aen_handler(struct ncsi_dev_priv *ndp, struct sk_buff *skb) |
diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c index 3fd3c39e6278..28c42b22b748 100644 --- a/net/ncsi/ncsi-manage.c +++ b/net/ncsi/ncsi-manage.c | |||
@@ -189,6 +189,7 @@ static void ncsi_channel_monitor(unsigned long data) | |||
189 | struct ncsi_channel *nc = (struct ncsi_channel *)data; | 189 | struct ncsi_channel *nc = (struct ncsi_channel *)data; |
190 | struct ncsi_package *np = nc->package; | 190 | struct ncsi_package *np = nc->package; |
191 | struct ncsi_dev_priv *ndp = np->ndp; | 191 | struct ncsi_dev_priv *ndp = np->ndp; |
192 | struct ncsi_channel_mode *ncm; | ||
192 | struct ncsi_cmd_arg nca; | 193 | struct ncsi_cmd_arg nca; |
193 | bool enabled, chained; | 194 | bool enabled, chained; |
194 | unsigned int monitor_state; | 195 | unsigned int monitor_state; |
@@ -202,11 +203,15 @@ static void ncsi_channel_monitor(unsigned long data) | |||
202 | monitor_state = nc->monitor.state; | 203 | monitor_state = nc->monitor.state; |
203 | spin_unlock_irqrestore(&nc->lock, flags); | 204 | spin_unlock_irqrestore(&nc->lock, flags); |
204 | 205 | ||
205 | if (!enabled || chained) | 206 | if (!enabled || chained) { |
207 | ncsi_stop_channel_monitor(nc); | ||
206 | return; | 208 | return; |
209 | } | ||
207 | if (state != NCSI_CHANNEL_INACTIVE && | 210 | if (state != NCSI_CHANNEL_INACTIVE && |
208 | state != NCSI_CHANNEL_ACTIVE) | 211 | state != NCSI_CHANNEL_ACTIVE) { |
212 | ncsi_stop_channel_monitor(nc); | ||
209 | return; | 213 | return; |
214 | } | ||
210 | 215 | ||
211 | switch (monitor_state) { | 216 | switch (monitor_state) { |
212 | case NCSI_CHANNEL_MONITOR_START: | 217 | case NCSI_CHANNEL_MONITOR_START: |
@@ -217,28 +222,28 @@ static void ncsi_channel_monitor(unsigned long data) | |||
217 | nca.type = NCSI_PKT_CMD_GLS; | 222 | nca.type = NCSI_PKT_CMD_GLS; |
218 | nca.req_flags = 0; | 223 | nca.req_flags = 0; |
219 | ret = ncsi_xmit_cmd(&nca); | 224 | ret = ncsi_xmit_cmd(&nca); |
220 | if (ret) { | 225 | if (ret) |
221 | netdev_err(ndp->ndev.dev, "Error %d sending GLS\n", | 226 | netdev_err(ndp->ndev.dev, "Error %d sending GLS\n", |
222 | ret); | 227 | ret); |
223 | return; | ||
224 | } | ||
225 | |||
226 | break; | 228 | break; |
227 | case NCSI_CHANNEL_MONITOR_WAIT ... NCSI_CHANNEL_MONITOR_WAIT_MAX: | 229 | case NCSI_CHANNEL_MONITOR_WAIT ... NCSI_CHANNEL_MONITOR_WAIT_MAX: |
228 | break; | 230 | break; |
229 | default: | 231 | default: |
230 | if (!(ndp->flags & NCSI_DEV_HWA) && | 232 | if (!(ndp->flags & NCSI_DEV_HWA)) { |
231 | state == NCSI_CHANNEL_ACTIVE) { | ||
232 | ncsi_report_link(ndp, true); | 233 | ncsi_report_link(ndp, true); |
233 | ndp->flags |= NCSI_DEV_RESHUFFLE; | 234 | ndp->flags |= NCSI_DEV_RESHUFFLE; |
234 | } | 235 | } |
235 | 236 | ||
237 | ncsi_stop_channel_monitor(nc); | ||
238 | |||
239 | ncm = &nc->modes[NCSI_MODE_LINK]; | ||
236 | spin_lock_irqsave(&nc->lock, flags); | 240 | spin_lock_irqsave(&nc->lock, flags); |
237 | nc->state = NCSI_CHANNEL_INVISIBLE; | 241 | nc->state = NCSI_CHANNEL_INVISIBLE; |
242 | ncm->data[2] &= ~0x1; | ||
238 | spin_unlock_irqrestore(&nc->lock, flags); | 243 | spin_unlock_irqrestore(&nc->lock, flags); |
239 | 244 | ||
240 | spin_lock_irqsave(&ndp->lock, flags); | 245 | spin_lock_irqsave(&ndp->lock, flags); |
241 | nc->state = NCSI_CHANNEL_INACTIVE; | 246 | nc->state = NCSI_CHANNEL_ACTIVE; |
242 | list_add_tail_rcu(&nc->link, &ndp->channel_queue); | 247 | list_add_tail_rcu(&nc->link, &ndp->channel_queue); |
243 | spin_unlock_irqrestore(&ndp->lock, flags); | 248 | spin_unlock_irqrestore(&ndp->lock, flags); |
244 | ncsi_process_next_channel(ndp); | 249 | ncsi_process_next_channel(ndp); |
@@ -732,6 +737,10 @@ static int set_one_vid(struct ncsi_dev_priv *ndp, struct ncsi_channel *nc, | |||
732 | if (index < 0) { | 737 | if (index < 0) { |
733 | netdev_err(ndp->ndev.dev, | 738 | netdev_err(ndp->ndev.dev, |
734 | "Failed to add new VLAN tag, error %d\n", index); | 739 | "Failed to add new VLAN tag, error %d\n", index); |
740 | if (index == -ENOSPC) | ||
741 | netdev_err(ndp->ndev.dev, | ||
742 | "Channel %u already has all VLAN filters set\n", | ||
743 | nc->id); | ||
735 | return -1; | 744 | return -1; |
736 | } | 745 | } |
737 | 746 | ||
@@ -998,12 +1007,15 @@ static bool ncsi_check_hwa(struct ncsi_dev_priv *ndp) | |||
998 | struct ncsi_package *np; | 1007 | struct ncsi_package *np; |
999 | struct ncsi_channel *nc; | 1008 | struct ncsi_channel *nc; |
1000 | unsigned int cap; | 1009 | unsigned int cap; |
1010 | bool has_channel = false; | ||
1001 | 1011 | ||
1002 | /* The hardware arbitration is disabled if any one channel | 1012 | /* The hardware arbitration is disabled if any one channel |
1003 | * doesn't support explicitly. | 1013 | * doesn't support explicitly. |
1004 | */ | 1014 | */ |
1005 | NCSI_FOR_EACH_PACKAGE(ndp, np) { | 1015 | NCSI_FOR_EACH_PACKAGE(ndp, np) { |
1006 | NCSI_FOR_EACH_CHANNEL(np, nc) { | 1016 | NCSI_FOR_EACH_CHANNEL(np, nc) { |
1017 | has_channel = true; | ||
1018 | |||
1007 | cap = nc->caps[NCSI_CAP_GENERIC].cap; | 1019 | cap = nc->caps[NCSI_CAP_GENERIC].cap; |
1008 | if (!(cap & NCSI_CAP_GENERIC_HWA) || | 1020 | if (!(cap & NCSI_CAP_GENERIC_HWA) || |
1009 | (cap & NCSI_CAP_GENERIC_HWA_MASK) != | 1021 | (cap & NCSI_CAP_GENERIC_HWA_MASK) != |
@@ -1014,8 +1026,13 @@ static bool ncsi_check_hwa(struct ncsi_dev_priv *ndp) | |||
1014 | } | 1026 | } |
1015 | } | 1027 | } |
1016 | 1028 | ||
1017 | ndp->flags |= NCSI_DEV_HWA; | 1029 | if (has_channel) { |
1018 | return true; | 1030 | ndp->flags |= NCSI_DEV_HWA; |
1031 | return true; | ||
1032 | } | ||
1033 | |||
1034 | ndp->flags &= ~NCSI_DEV_HWA; | ||
1035 | return false; | ||
1019 | } | 1036 | } |
1020 | 1037 | ||
1021 | static int ncsi_enable_hwa(struct ncsi_dev_priv *ndp) | 1038 | static int ncsi_enable_hwa(struct ncsi_dev_priv *ndp) |
@@ -1403,7 +1420,6 @@ static int ncsi_kick_channels(struct ncsi_dev_priv *ndp) | |||
1403 | 1420 | ||
1404 | int ncsi_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid) | 1421 | int ncsi_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid) |
1405 | { | 1422 | { |
1406 | struct ncsi_channel_filter *ncf; | ||
1407 | struct ncsi_dev_priv *ndp; | 1423 | struct ncsi_dev_priv *ndp; |
1408 | unsigned int n_vids = 0; | 1424 | unsigned int n_vids = 0; |
1409 | struct vlan_vid *vlan; | 1425 | struct vlan_vid *vlan; |
@@ -1420,7 +1436,6 @@ int ncsi_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid) | |||
1420 | } | 1436 | } |
1421 | 1437 | ||
1422 | ndp = TO_NCSI_DEV_PRIV(nd); | 1438 | ndp = TO_NCSI_DEV_PRIV(nd); |
1423 | ncf = ndp->hot_channel->filters[NCSI_FILTER_VLAN]; | ||
1424 | 1439 | ||
1425 | /* Add the VLAN id to our internal list */ | 1440 | /* Add the VLAN id to our internal list */ |
1426 | list_for_each_entry_rcu(vlan, &ndp->vlan_vids, list) { | 1441 | list_for_each_entry_rcu(vlan, &ndp->vlan_vids, list) { |
@@ -1431,12 +1446,11 @@ int ncsi_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid) | |||
1431 | return 0; | 1446 | return 0; |
1432 | } | 1447 | } |
1433 | } | 1448 | } |
1434 | 1449 | if (n_vids >= NCSI_MAX_VLAN_VIDS) { | |
1435 | if (n_vids >= ncf->total) { | 1450 | netdev_warn(dev, |
1436 | netdev_info(dev, | 1451 | "tried to add vlan id %u but NCSI max already registered (%u)\n", |
1437 | "NCSI Channel supports up to %u VLAN tags but %u are already set\n", | 1452 | vid, NCSI_MAX_VLAN_VIDS); |
1438 | ncf->total, n_vids); | 1453 | return -ENOSPC; |
1439 | return -EINVAL; | ||
1440 | } | 1454 | } |
1441 | 1455 | ||
1442 | vlan = kzalloc(sizeof(*vlan), GFP_KERNEL); | 1456 | vlan = kzalloc(sizeof(*vlan), GFP_KERNEL); |
diff --git a/net/ncsi/ncsi-rsp.c b/net/ncsi/ncsi-rsp.c index 265b9a892d41..927dad4759d1 100644 --- a/net/ncsi/ncsi-rsp.c +++ b/net/ncsi/ncsi-rsp.c | |||
@@ -959,7 +959,7 @@ static struct ncsi_rsp_handler { | |||
959 | { NCSI_PKT_RSP_EGMF, 4, ncsi_rsp_handler_egmf }, | 959 | { NCSI_PKT_RSP_EGMF, 4, ncsi_rsp_handler_egmf }, |
960 | { NCSI_PKT_RSP_DGMF, 4, ncsi_rsp_handler_dgmf }, | 960 | { NCSI_PKT_RSP_DGMF, 4, ncsi_rsp_handler_dgmf }, |
961 | { NCSI_PKT_RSP_SNFC, 4, ncsi_rsp_handler_snfc }, | 961 | { NCSI_PKT_RSP_SNFC, 4, ncsi_rsp_handler_snfc }, |
962 | { NCSI_PKT_RSP_GVI, 36, ncsi_rsp_handler_gvi }, | 962 | { NCSI_PKT_RSP_GVI, 40, ncsi_rsp_handler_gvi }, |
963 | { NCSI_PKT_RSP_GC, 32, ncsi_rsp_handler_gc }, | 963 | { NCSI_PKT_RSP_GC, 32, ncsi_rsp_handler_gc }, |
964 | { NCSI_PKT_RSP_GP, -1, ncsi_rsp_handler_gp }, | 964 | { NCSI_PKT_RSP_GP, -1, ncsi_rsp_handler_gp }, |
965 | { NCSI_PKT_RSP_GCPS, 172, ncsi_rsp_handler_gcps }, | 965 | { NCSI_PKT_RSP_GCPS, 172, ncsi_rsp_handler_gcps }, |
diff --git a/net/netfilter/Makefile b/net/netfilter/Makefile index d3891c93edd6..f78ed2470831 100644 --- a/net/netfilter/Makefile +++ b/net/netfilter/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | netfilter-objs := core.o nf_log.o nf_queue.o nf_sockopt.o | 2 | netfilter-objs := core.o nf_log.o nf_queue.o nf_sockopt.o |
2 | 3 | ||
3 | nf_conntrack-y := nf_conntrack_core.o nf_conntrack_standalone.o nf_conntrack_expect.o nf_conntrack_helper.o nf_conntrack_proto.o nf_conntrack_l3proto_generic.o nf_conntrack_proto_generic.o nf_conntrack_proto_tcp.o nf_conntrack_proto_udp.o nf_conntrack_extend.o nf_conntrack_acct.o nf_conntrack_seqadj.o | 4 | nf_conntrack-y := nf_conntrack_core.o nf_conntrack_standalone.o nf_conntrack_expect.o nf_conntrack_helper.o nf_conntrack_proto.o nf_conntrack_l3proto_generic.o nf_conntrack_proto_generic.o nf_conntrack_proto_tcp.o nf_conntrack_proto_udp.o nf_conntrack_extend.o nf_conntrack_acct.o nf_conntrack_seqadj.o |
diff --git a/net/netfilter/ipset/Makefile b/net/netfilter/ipset/Makefile index 28ec148df02d..a445a6bf4f11 100644 --- a/net/netfilter/ipset/Makefile +++ b/net/netfilter/ipset/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the ipset modules | 3 | # Makefile for the ipset modules |
3 | # | 4 | # |
diff --git a/net/netfilter/ipvs/Makefile b/net/netfilter/ipvs/Makefile index 67f3f4389602..c552993fa4b9 100644 --- a/net/netfilter/ipvs/Makefile +++ b/net/netfilter/ipvs/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the IPVS modules on top of IPv4. | 3 | # Makefile for the IPVS modules on top of IPv4. |
3 | # | 4 | # |
diff --git a/net/netfilter/ipvs/ip_vs_proto_sctp.c b/net/netfilter/ipvs/ip_vs_proto_sctp.c index 57c8ee66491e..eff7569824e5 100644 --- a/net/netfilter/ipvs/ip_vs_proto_sctp.c +++ b/net/netfilter/ipvs/ip_vs_proto_sctp.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/kernel.h> | 2 | #include <linux/kernel.h> |
2 | #include <linux/ip.h> | 3 | #include <linux/ip.h> |
3 | #include <linux/sctp.h> | 4 | #include <linux/sctp.h> |
diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c index 0e5b64a75da0..13f740875507 100644 --- a/net/netfilter/ipvs/ip_vs_sync.c +++ b/net/netfilter/ipvs/ip_vs_sync.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * IPVS An implementation of the IP virtual server support for the | 3 | * IPVS An implementation of the IP virtual server support for the |
3 | * LINUX operating system. IPVS is now implemented as a module | 4 | * LINUX operating system. IPVS is now implemented as a module |
diff --git a/net/netfilter/nf_internals.h b/net/netfilter/nf_internals.h index 49f87ec093a3..44284cd2528d 100644 --- a/net/netfilter/nf_internals.h +++ b/net/netfilter/nf_internals.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef _NF_INTERNALS_H | 2 | #ifndef _NF_INTERNALS_H |
2 | #define _NF_INTERNALS_H | 3 | #define _NF_INTERNALS_H |
3 | 4 | ||
diff --git a/net/netfilter/nf_sockopt.c b/net/netfilter/nf_sockopt.c index d2a9e6b5d01f..46cb3786e0ec 100644 --- a/net/netfilter/nf_sockopt.c +++ b/net/netfilter/nf_sockopt.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/kernel.h> | 2 | #include <linux/kernel.h> |
2 | #include <linux/init.h> | 3 | #include <linux/init.h> |
3 | #include <linux/module.h> | 4 | #include <linux/module.h> |
diff --git a/net/netfilter/nft_set_hash.c b/net/netfilter/nft_set_hash.c index 0fa01d772c5e..9c0d5a7ce5f9 100644 --- a/net/netfilter/nft_set_hash.c +++ b/net/netfilter/nft_set_hash.c | |||
@@ -643,7 +643,6 @@ nft_hash_select_ops(const struct nft_ctx *ctx, const struct nft_set_desc *desc, | |||
643 | { | 643 | { |
644 | if (desc->size) { | 644 | if (desc->size) { |
645 | switch (desc->klen) { | 645 | switch (desc->klen) { |
646 | case 2: | ||
647 | case 4: | 646 | case 4: |
648 | return &nft_hash_fast_ops; | 647 | return &nft_hash_fast_ops; |
649 | default: | 648 | default: |
diff --git a/net/netfilter/xt_repldata.h b/net/netfilter/xt_repldata.h index 8fd324116e6f..68ccbe50bb1e 100644 --- a/net/netfilter/xt_repldata.h +++ b/net/netfilter/xt_repldata.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Today's hack: quantum tunneling in structs | 3 | * Today's hack: quantum tunneling in structs |
3 | * | 4 | * |
diff --git a/net/netlabel/Makefile b/net/netlabel/Makefile index d341ede0dca5..5a46381a64e7 100644 --- a/net/netlabel/Makefile +++ b/net/netlabel/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the NetLabel subsystem. | 3 | # Makefile for the NetLabel subsystem. |
3 | # | 4 | # |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index f34750691c5c..b93148e8e9fb 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -2307,6 +2307,7 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err, | |||
2307 | size_t tlvlen = 0; | 2307 | size_t tlvlen = 0; |
2308 | struct netlink_sock *nlk = nlk_sk(NETLINK_CB(in_skb).sk); | 2308 | struct netlink_sock *nlk = nlk_sk(NETLINK_CB(in_skb).sk); |
2309 | unsigned int flags = 0; | 2309 | unsigned int flags = 0; |
2310 | bool nlk_has_extack = nlk->flags & NETLINK_F_EXT_ACK; | ||
2310 | 2311 | ||
2311 | /* Error messages get the original request appened, unless the user | 2312 | /* Error messages get the original request appened, unless the user |
2312 | * requests to cap the error message, and get extra error data if | 2313 | * requests to cap the error message, and get extra error data if |
@@ -2317,7 +2318,7 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err, | |||
2317 | payload += nlmsg_len(nlh); | 2318 | payload += nlmsg_len(nlh); |
2318 | else | 2319 | else |
2319 | flags |= NLM_F_CAPPED; | 2320 | flags |= NLM_F_CAPPED; |
2320 | if (nlk->flags & NETLINK_F_EXT_ACK && extack) { | 2321 | if (nlk_has_extack && extack) { |
2321 | if (extack->_msg) | 2322 | if (extack->_msg) |
2322 | tlvlen += nla_total_size(strlen(extack->_msg) + 1); | 2323 | tlvlen += nla_total_size(strlen(extack->_msg) + 1); |
2323 | if (extack->bad_attr) | 2324 | if (extack->bad_attr) |
@@ -2326,8 +2327,7 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err, | |||
2326 | } else { | 2327 | } else { |
2327 | flags |= NLM_F_CAPPED; | 2328 | flags |= NLM_F_CAPPED; |
2328 | 2329 | ||
2329 | if (nlk->flags & NETLINK_F_EXT_ACK && | 2330 | if (nlk_has_extack && extack && extack->cookie_len) |
2330 | extack && extack->cookie_len) | ||
2331 | tlvlen += nla_total_size(extack->cookie_len); | 2331 | tlvlen += nla_total_size(extack->cookie_len); |
2332 | } | 2332 | } |
2333 | 2333 | ||
@@ -2355,7 +2355,7 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err, | |||
2355 | errmsg->error = err; | 2355 | errmsg->error = err; |
2356 | memcpy(&errmsg->msg, nlh, payload > sizeof(*errmsg) ? nlh->nlmsg_len : sizeof(*nlh)); | 2356 | memcpy(&errmsg->msg, nlh, payload > sizeof(*errmsg) ? nlh->nlmsg_len : sizeof(*nlh)); |
2357 | 2357 | ||
2358 | if (nlk->flags & NETLINK_F_EXT_ACK && extack) { | 2358 | if (nlk_has_extack && extack) { |
2359 | if (err) { | 2359 | if (err) { |
2360 | if (extack->_msg) | 2360 | if (extack->_msg) |
2361 | WARN_ON(nla_put_string(skb, NLMSGERR_ATTR_MSG, | 2361 | WARN_ON(nla_put_string(skb, NLMSGERR_ATTR_MSG, |
diff --git a/net/netlink/af_netlink.h b/net/netlink/af_netlink.h index 3490f2430532..028188597eaa 100644 --- a/net/netlink/af_netlink.h +++ b/net/netlink/af_netlink.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef _AF_NETLINK_H | 2 | #ifndef _AF_NETLINK_H |
2 | #define _AF_NETLINK_H | 3 | #define _AF_NETLINK_H |
3 | 4 | ||
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 10f8b4cff40a..d444daf1ac04 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * NETLINK Generic Netlink Family | 3 | * NETLINK Generic Netlink Family |
3 | * | 4 | * |
diff --git a/net/nfc/Makefile b/net/nfc/Makefile index 2555ff8e7219..2ffc69b473fc 100644 --- a/net/nfc/Makefile +++ b/net/nfc/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the Linux NFC subsystem. | 3 | # Makefile for the Linux NFC subsystem. |
3 | # | 4 | # |
diff --git a/net/nfc/nci/Makefile b/net/nfc/nci/Makefile index 0ca31d9bf741..c3362c499281 100644 --- a/net/nfc/nci/Makefile +++ b/net/nfc/nci/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the Linux NFC NCI layer. | 3 | # Makefile for the Linux NFC NCI layer. |
3 | # | 4 | # |
diff --git a/net/openvswitch/Makefile b/net/openvswitch/Makefile index 60f809085b92..299f4476cf44 100644 --- a/net/openvswitch/Makefile +++ b/net/openvswitch/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for Open vSwitch. | 3 | # Makefile for Open vSwitch. |
3 | # | 4 | # |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index bec01a3daf5b..2986941164b1 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -1769,7 +1769,7 @@ static int fanout_add(struct sock *sk, u16 id, u16 type_flags) | |||
1769 | 1769 | ||
1770 | out: | 1770 | out: |
1771 | if (err && rollover) { | 1771 | if (err && rollover) { |
1772 | kfree(rollover); | 1772 | kfree_rcu(rollover, rcu); |
1773 | po->rollover = NULL; | 1773 | po->rollover = NULL; |
1774 | } | 1774 | } |
1775 | mutex_unlock(&fanout_mutex); | 1775 | mutex_unlock(&fanout_mutex); |
@@ -1796,8 +1796,10 @@ static struct packet_fanout *fanout_release(struct sock *sk) | |||
1796 | else | 1796 | else |
1797 | f = NULL; | 1797 | f = NULL; |
1798 | 1798 | ||
1799 | if (po->rollover) | 1799 | if (po->rollover) { |
1800 | kfree_rcu(po->rollover, rcu); | 1800 | kfree_rcu(po->rollover, rcu); |
1801 | po->rollover = NULL; | ||
1802 | } | ||
1801 | } | 1803 | } |
1802 | mutex_unlock(&fanout_mutex); | 1804 | mutex_unlock(&fanout_mutex); |
1803 | 1805 | ||
@@ -3851,6 +3853,7 @@ static int packet_getsockopt(struct socket *sock, int level, int optname, | |||
3851 | void *data = &val; | 3853 | void *data = &val; |
3852 | union tpacket_stats_u st; | 3854 | union tpacket_stats_u st; |
3853 | struct tpacket_rollover_stats rstats; | 3855 | struct tpacket_rollover_stats rstats; |
3856 | struct packet_rollover *rollover; | ||
3854 | 3857 | ||
3855 | if (level != SOL_PACKET) | 3858 | if (level != SOL_PACKET) |
3856 | return -ENOPROTOOPT; | 3859 | return -ENOPROTOOPT; |
@@ -3929,13 +3932,18 @@ static int packet_getsockopt(struct socket *sock, int level, int optname, | |||
3929 | 0); | 3932 | 0); |
3930 | break; | 3933 | break; |
3931 | case PACKET_ROLLOVER_STATS: | 3934 | case PACKET_ROLLOVER_STATS: |
3932 | if (!po->rollover) | 3935 | rcu_read_lock(); |
3936 | rollover = rcu_dereference(po->rollover); | ||
3937 | if (rollover) { | ||
3938 | rstats.tp_all = atomic_long_read(&rollover->num); | ||
3939 | rstats.tp_huge = atomic_long_read(&rollover->num_huge); | ||
3940 | rstats.tp_failed = atomic_long_read(&rollover->num_failed); | ||
3941 | data = &rstats; | ||
3942 | lv = sizeof(rstats); | ||
3943 | } | ||
3944 | rcu_read_unlock(); | ||
3945 | if (!rollover) | ||
3933 | return -EINVAL; | 3946 | return -EINVAL; |
3934 | rstats.tp_all = atomic_long_read(&po->rollover->num); | ||
3935 | rstats.tp_huge = atomic_long_read(&po->rollover->num_huge); | ||
3936 | rstats.tp_failed = atomic_long_read(&po->rollover->num_failed); | ||
3937 | data = &rstats; | ||
3938 | lv = sizeof(rstats); | ||
3939 | break; | 3947 | break; |
3940 | case PACKET_TX_HAS_OFF: | 3948 | case PACKET_TX_HAS_OFF: |
3941 | val = po->tp_tx_has_off; | 3949 | val = po->tp_tx_has_off; |
diff --git a/net/packet/internal.h b/net/packet/internal.h index 94d1d405a116..562fbc155006 100644 --- a/net/packet/internal.h +++ b/net/packet/internal.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef __PACKET_INTERNAL_H__ | 2 | #ifndef __PACKET_INTERNAL_H__ |
2 | #define __PACKET_INTERNAL_H__ | 3 | #define __PACKET_INTERNAL_H__ |
3 | 4 | ||
diff --git a/net/phonet/Makefile b/net/phonet/Makefile index e10b1b182ce3..444f875932b9 100644 --- a/net/phonet/Makefile +++ b/net/phonet/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | obj-$(CONFIG_PHONET) += phonet.o pn_pep.o | 2 | obj-$(CONFIG_PHONET) += phonet.o pn_pep.o |
2 | 3 | ||
3 | phonet-y := \ | 4 | phonet-y := \ |
diff --git a/net/psample/psample.c b/net/psample/psample.c index 3a6ad0f438dc..64f95624f219 100644 --- a/net/psample/psample.c +++ b/net/psample/psample.c | |||
@@ -296,6 +296,6 @@ static void __exit psample_module_exit(void) | |||
296 | module_init(psample_module_init); | 296 | module_init(psample_module_init); |
297 | module_exit(psample_module_exit); | 297 | module_exit(psample_module_exit); |
298 | 298 | ||
299 | MODULE_AUTHOR("Yotam Gigi <yotamg@mellanox.com>"); | 299 | MODULE_AUTHOR("Yotam Gigi <yotam.gi@gmail.com>"); |
300 | MODULE_DESCRIPTION("netlink channel for packet sampling"); | 300 | MODULE_DESCRIPTION("netlink channel for packet sampling"); |
301 | MODULE_LICENSE("GPL v2"); | 301 | MODULE_LICENSE("GPL v2"); |
diff --git a/net/qrtr/qrtr.h b/net/qrtr/qrtr.h index 2b848718f8fe..b81e6953c04b 100644 --- a/net/qrtr/qrtr.h +++ b/net/qrtr/qrtr.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef __QRTR_H_ | 2 | #ifndef __QRTR_H_ |
2 | #define __QRTR_H_ | 3 | #define __QRTR_H_ |
3 | 4 | ||
diff --git a/net/rds/Makefile b/net/rds/Makefile index 56c7d27eefee..b5d568bd479c 100644 --- a/net/rds/Makefile +++ b/net/rds/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | obj-$(CONFIG_RDS) += rds.o | 2 | obj-$(CONFIG_RDS) += rds.o |
2 | rds-y := af_rds.o bind.o cong.o connection.o info.o message.o \ | 3 | rds-y := af_rds.o bind.o cong.o connection.o info.o message.o \ |
3 | recv.o send.o stats.o sysctl.o threads.o transport.o \ | 4 | recv.o send.o stats.o sysctl.o threads.o transport.o \ |
diff --git a/net/rds/ib.h b/net/rds/ib.h index bf4822407567..86a8578d95b8 100644 --- a/net/rds/ib.h +++ b/net/rds/ib.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef _RDS_IB_H | 2 | #ifndef _RDS_IB_H |
2 | #define _RDS_IB_H | 3 | #define _RDS_IB_H |
3 | 4 | ||
diff --git a/net/rds/ib_send.c b/net/rds/ib_send.c index 6ab39dbcca01..8557a1cae041 100644 --- a/net/rds/ib_send.c +++ b/net/rds/ib_send.c | |||
@@ -661,13 +661,15 @@ int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm, | |||
661 | } | 661 | } |
662 | } | 662 | } |
663 | 663 | ||
664 | rds_ib_set_wr_signal_state(ic, send, 0); | 664 | rds_ib_set_wr_signal_state(ic, send, false); |
665 | 665 | ||
666 | /* | 666 | /* |
667 | * Always signal the last one if we're stopping due to flow control. | 667 | * Always signal the last one if we're stopping due to flow control. |
668 | */ | 668 | */ |
669 | if (ic->i_flowctl && flow_controlled && i == (work_alloc-1)) | 669 | if (ic->i_flowctl && flow_controlled && i == (work_alloc - 1)) { |
670 | send->s_wr.send_flags |= IB_SEND_SIGNALED | IB_SEND_SOLICITED; | 670 | rds_ib_set_wr_signal_state(ic, send, true); |
671 | send->s_wr.send_flags |= IB_SEND_SOLICITED; | ||
672 | } | ||
671 | 673 | ||
672 | if (send->s_wr.send_flags & IB_SEND_SIGNALED) | 674 | if (send->s_wr.send_flags & IB_SEND_SIGNALED) |
673 | nr_sig++; | 675 | nr_sig++; |
@@ -705,11 +707,8 @@ int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm, | |||
705 | if (scat == &rm->data.op_sg[rm->data.op_count]) { | 707 | if (scat == &rm->data.op_sg[rm->data.op_count]) { |
706 | prev->s_op = ic->i_data_op; | 708 | prev->s_op = ic->i_data_op; |
707 | prev->s_wr.send_flags |= IB_SEND_SOLICITED; | 709 | prev->s_wr.send_flags |= IB_SEND_SOLICITED; |
708 | if (!(prev->s_wr.send_flags & IB_SEND_SIGNALED)) { | 710 | if (!(prev->s_wr.send_flags & IB_SEND_SIGNALED)) |
709 | ic->i_unsignaled_wrs = rds_ib_sysctl_max_unsig_wrs; | 711 | nr_sig += rds_ib_set_wr_signal_state(ic, prev, true); |
710 | prev->s_wr.send_flags |= IB_SEND_SIGNALED; | ||
711 | nr_sig++; | ||
712 | } | ||
713 | ic->i_data_op = NULL; | 712 | ic->i_data_op = NULL; |
714 | } | 713 | } |
715 | 714 | ||
@@ -792,6 +791,7 @@ int rds_ib_xmit_atomic(struct rds_connection *conn, struct rm_atomic_op *op) | |||
792 | send->s_atomic_wr.compare_add_mask = op->op_m_fadd.nocarry_mask; | 791 | send->s_atomic_wr.compare_add_mask = op->op_m_fadd.nocarry_mask; |
793 | send->s_atomic_wr.swap_mask = 0; | 792 | send->s_atomic_wr.swap_mask = 0; |
794 | } | 793 | } |
794 | send->s_wr.send_flags = 0; | ||
795 | nr_sig = rds_ib_set_wr_signal_state(ic, send, op->op_notify); | 795 | nr_sig = rds_ib_set_wr_signal_state(ic, send, op->op_notify); |
796 | send->s_atomic_wr.wr.num_sge = 1; | 796 | send->s_atomic_wr.wr.num_sge = 1; |
797 | send->s_atomic_wr.wr.next = NULL; | 797 | send->s_atomic_wr.wr.next = NULL; |
diff --git a/net/rds/info.h b/net/rds/info.h index b6c052ca7d22..a069b51c4679 100644 --- a/net/rds/info.h +++ b/net/rds/info.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef _RDS_INFO_H | 2 | #ifndef _RDS_INFO_H |
2 | #define _RDS_INFO_H | 3 | #define _RDS_INFO_H |
3 | 4 | ||
diff --git a/net/rds/loop.h b/net/rds/loop.h index f32b0939a04d..469fa4b2da4f 100644 --- a/net/rds/loop.h +++ b/net/rds/loop.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef _RDS_LOOP_H | 2 | #ifndef _RDS_LOOP_H |
2 | #define _RDS_LOOP_H | 3 | #define _RDS_LOOP_H |
3 | 4 | ||
diff --git a/net/rds/rdma_transport.h b/net/rds/rdma_transport.h index ff2010e9d20c..d309c4430124 100644 --- a/net/rds/rdma_transport.h +++ b/net/rds/rdma_transport.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef _RDMA_TRANSPORT_H | 2 | #ifndef _RDMA_TRANSPORT_H |
2 | #define _RDMA_TRANSPORT_H | 3 | #define _RDMA_TRANSPORT_H |
3 | 4 | ||
diff --git a/net/rds/rds.h b/net/rds/rds.h index 2e0315b159cb..c349c71babff 100644 --- a/net/rds/rds.h +++ b/net/rds/rds.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef _RDS_RDS_H | 2 | #ifndef _RDS_RDS_H |
2 | #define _RDS_RDS_H | 3 | #define _RDS_RDS_H |
3 | 4 | ||
diff --git a/net/rds/rds_single_path.h b/net/rds/rds_single_path.h index e1241af7c1ad..9521f6e99bef 100644 --- a/net/rds/rds_single_path.h +++ b/net/rds/rds_single_path.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef _RDS_RDS_SINGLE_H | 2 | #ifndef _RDS_RDS_SINGLE_H |
2 | #define _RDS_RDS_SINGLE_H | 3 | #define _RDS_RDS_SINGLE_H |
3 | 4 | ||
diff --git a/net/rds/tcp.h b/net/rds/tcp.h index f8800b7ce79c..1aafbf7c3011 100644 --- a/net/rds/tcp.h +++ b/net/rds/tcp.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef _RDS_TCP_H | 2 | #ifndef _RDS_TCP_H |
2 | #define _RDS_TCP_H | 3 | #define _RDS_TCP_H |
3 | 4 | ||
diff --git a/net/rxrpc/Makefile b/net/rxrpc/Makefile index 9c68d2f8ba39..6ffb7e9887ce 100644 --- a/net/rxrpc/Makefile +++ b/net/rxrpc/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for Linux kernel RxRPC | 3 | # Makefile for Linux kernel RxRPC |
3 | # | 4 | # |
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c index fb17552fd292..4b0a8288c98a 100644 --- a/net/rxrpc/af_rxrpc.c +++ b/net/rxrpc/af_rxrpc.c | |||
@@ -308,10 +308,11 @@ struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *sock, | |||
308 | call = rxrpc_new_client_call(rx, &cp, srx, user_call_ID, tx_total_len, | 308 | call = rxrpc_new_client_call(rx, &cp, srx, user_call_ID, tx_total_len, |
309 | gfp); | 309 | gfp); |
310 | /* The socket has been unlocked. */ | 310 | /* The socket has been unlocked. */ |
311 | if (!IS_ERR(call)) | 311 | if (!IS_ERR(call)) { |
312 | call->notify_rx = notify_rx; | 312 | call->notify_rx = notify_rx; |
313 | mutex_unlock(&call->user_mutex); | ||
314 | } | ||
313 | 315 | ||
314 | mutex_unlock(&call->user_mutex); | ||
315 | _leave(" = %p", call); | 316 | _leave(" = %p", call); |
316 | return call; | 317 | return call; |
317 | } | 318 | } |
diff --git a/net/sched/Makefile b/net/sched/Makefile index 7b915d226de7..9e43a4721ef8 100644 --- a/net/sched/Makefile +++ b/net/sched/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the Linux Traffic Control Unit. | 3 | # Makefile for the Linux Traffic Control Unit. |
3 | # | 4 | # |
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index da6fa82c98a8..ca2ff0b3123f 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c | |||
@@ -78,6 +78,7 @@ static void tcf_idr_remove(struct tcf_idrinfo *idrinfo, struct tc_action *p) | |||
78 | spin_lock_bh(&idrinfo->lock); | 78 | spin_lock_bh(&idrinfo->lock); |
79 | idr_remove_ext(&idrinfo->action_idr, p->tcfa_index); | 79 | idr_remove_ext(&idrinfo->action_idr, p->tcfa_index); |
80 | spin_unlock_bh(&idrinfo->lock); | 80 | spin_unlock_bh(&idrinfo->lock); |
81 | put_net(idrinfo->net); | ||
81 | gen_kill_estimator(&p->tcfa_rate_est); | 82 | gen_kill_estimator(&p->tcfa_rate_est); |
82 | free_tcf(p); | 83 | free_tcf(p); |
83 | } | 84 | } |
@@ -86,6 +87,8 @@ int __tcf_idr_release(struct tc_action *p, bool bind, bool strict) | |||
86 | { | 87 | { |
87 | int ret = 0; | 88 | int ret = 0; |
88 | 89 | ||
90 | ASSERT_RTNL(); | ||
91 | |||
89 | if (p) { | 92 | if (p) { |
90 | if (bind) | 93 | if (bind) |
91 | p->tcfa_bindcnt--; | 94 | p->tcfa_bindcnt--; |
@@ -334,6 +337,7 @@ err3: | |||
334 | p->idrinfo = idrinfo; | 337 | p->idrinfo = idrinfo; |
335 | p->ops = ops; | 338 | p->ops = ops; |
336 | INIT_LIST_HEAD(&p->list); | 339 | INIT_LIST_HEAD(&p->list); |
340 | get_net(idrinfo->net); | ||
337 | *a = p; | 341 | *a = p; |
338 | return 0; | 342 | return 0; |
339 | } | 343 | } |
diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c index c0c707eb2c96..9bce8cc84cbb 100644 --- a/net/sched/act_bpf.c +++ b/net/sched/act_bpf.c | |||
@@ -398,7 +398,7 @@ static __net_init int bpf_init_net(struct net *net) | |||
398 | { | 398 | { |
399 | struct tc_action_net *tn = net_generic(net, bpf_net_id); | 399 | struct tc_action_net *tn = net_generic(net, bpf_net_id); |
400 | 400 | ||
401 | return tc_action_net_init(tn, &act_bpf_ops); | 401 | return tc_action_net_init(tn, &act_bpf_ops, net); |
402 | } | 402 | } |
403 | 403 | ||
404 | static void __net_exit bpf_exit_net(struct net *net) | 404 | static void __net_exit bpf_exit_net(struct net *net) |
diff --git a/net/sched/act_connmark.c b/net/sched/act_connmark.c index 10b7a8855a6c..34e52d01a5dd 100644 --- a/net/sched/act_connmark.c +++ b/net/sched/act_connmark.c | |||
@@ -206,7 +206,7 @@ static __net_init int connmark_init_net(struct net *net) | |||
206 | { | 206 | { |
207 | struct tc_action_net *tn = net_generic(net, connmark_net_id); | 207 | struct tc_action_net *tn = net_generic(net, connmark_net_id); |
208 | 208 | ||
209 | return tc_action_net_init(tn, &act_connmark_ops); | 209 | return tc_action_net_init(tn, &act_connmark_ops, net); |
210 | } | 210 | } |
211 | 211 | ||
212 | static void __net_exit connmark_exit_net(struct net *net) | 212 | static void __net_exit connmark_exit_net(struct net *net) |
diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c index 1c40caadcff9..35171df2ebef 100644 --- a/net/sched/act_csum.c +++ b/net/sched/act_csum.c | |||
@@ -626,7 +626,7 @@ static __net_init int csum_init_net(struct net *net) | |||
626 | { | 626 | { |
627 | struct tc_action_net *tn = net_generic(net, csum_net_id); | 627 | struct tc_action_net *tn = net_generic(net, csum_net_id); |
628 | 628 | ||
629 | return tc_action_net_init(tn, &act_csum_ops); | 629 | return tc_action_net_init(tn, &act_csum_ops, net); |
630 | } | 630 | } |
631 | 631 | ||
632 | static void __net_exit csum_exit_net(struct net *net) | 632 | static void __net_exit csum_exit_net(struct net *net) |
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c index e29a48ef7fc3..ef7f7f39d26d 100644 --- a/net/sched/act_gact.c +++ b/net/sched/act_gact.c | |||
@@ -232,7 +232,7 @@ static __net_init int gact_init_net(struct net *net) | |||
232 | { | 232 | { |
233 | struct tc_action_net *tn = net_generic(net, gact_net_id); | 233 | struct tc_action_net *tn = net_generic(net, gact_net_id); |
234 | 234 | ||
235 | return tc_action_net_init(tn, &act_gact_ops); | 235 | return tc_action_net_init(tn, &act_gact_ops, net); |
236 | } | 236 | } |
237 | 237 | ||
238 | static void __net_exit gact_exit_net(struct net *net) | 238 | static void __net_exit gact_exit_net(struct net *net) |
diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c index 8ccd35825b6b..f65e4b5058e0 100644 --- a/net/sched/act_ife.c +++ b/net/sched/act_ife.c | |||
@@ -818,7 +818,7 @@ static __net_init int ife_init_net(struct net *net) | |||
818 | { | 818 | { |
819 | struct tc_action_net *tn = net_generic(net, ife_net_id); | 819 | struct tc_action_net *tn = net_generic(net, ife_net_id); |
820 | 820 | ||
821 | return tc_action_net_init(tn, &act_ife_ops); | 821 | return tc_action_net_init(tn, &act_ife_ops, net); |
822 | } | 822 | } |
823 | 823 | ||
824 | static void __net_exit ife_exit_net(struct net *net) | 824 | static void __net_exit ife_exit_net(struct net *net) |
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c index d9e399a7e3d5..dbdf3b2470d5 100644 --- a/net/sched/act_ipt.c +++ b/net/sched/act_ipt.c | |||
@@ -334,7 +334,7 @@ static __net_init int ipt_init_net(struct net *net) | |||
334 | { | 334 | { |
335 | struct tc_action_net *tn = net_generic(net, ipt_net_id); | 335 | struct tc_action_net *tn = net_generic(net, ipt_net_id); |
336 | 336 | ||
337 | return tc_action_net_init(tn, &act_ipt_ops); | 337 | return tc_action_net_init(tn, &act_ipt_ops, net); |
338 | } | 338 | } |
339 | 339 | ||
340 | static void __net_exit ipt_exit_net(struct net *net) | 340 | static void __net_exit ipt_exit_net(struct net *net) |
@@ -384,7 +384,7 @@ static __net_init int xt_init_net(struct net *net) | |||
384 | { | 384 | { |
385 | struct tc_action_net *tn = net_generic(net, xt_net_id); | 385 | struct tc_action_net *tn = net_generic(net, xt_net_id); |
386 | 386 | ||
387 | return tc_action_net_init(tn, &act_xt_ops); | 387 | return tc_action_net_init(tn, &act_xt_ops, net); |
388 | } | 388 | } |
389 | 389 | ||
390 | static void __net_exit xt_exit_net(struct net *net) | 390 | static void __net_exit xt_exit_net(struct net *net) |
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index 416627c66f08..84759cfd5a33 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c | |||
@@ -343,7 +343,7 @@ static __net_init int mirred_init_net(struct net *net) | |||
343 | { | 343 | { |
344 | struct tc_action_net *tn = net_generic(net, mirred_net_id); | 344 | struct tc_action_net *tn = net_generic(net, mirred_net_id); |
345 | 345 | ||
346 | return tc_action_net_init(tn, &act_mirred_ops); | 346 | return tc_action_net_init(tn, &act_mirred_ops, net); |
347 | } | 347 | } |
348 | 348 | ||
349 | static void __net_exit mirred_exit_net(struct net *net) | 349 | static void __net_exit mirred_exit_net(struct net *net) |
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c index c365d01b99c8..7eeaaf9217b6 100644 --- a/net/sched/act_nat.c +++ b/net/sched/act_nat.c | |||
@@ -307,7 +307,7 @@ static __net_init int nat_init_net(struct net *net) | |||
307 | { | 307 | { |
308 | struct tc_action_net *tn = net_generic(net, nat_net_id); | 308 | struct tc_action_net *tn = net_generic(net, nat_net_id); |
309 | 309 | ||
310 | return tc_action_net_init(tn, &act_nat_ops); | 310 | return tc_action_net_init(tn, &act_nat_ops, net); |
311 | } | 311 | } |
312 | 312 | ||
313 | static void __net_exit nat_exit_net(struct net *net) | 313 | static void __net_exit nat_exit_net(struct net *net) |
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index 491fe5deb09e..b3d82c334a5f 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c | |||
@@ -450,7 +450,7 @@ static __net_init int pedit_init_net(struct net *net) | |||
450 | { | 450 | { |
451 | struct tc_action_net *tn = net_generic(net, pedit_net_id); | 451 | struct tc_action_net *tn = net_generic(net, pedit_net_id); |
452 | 452 | ||
453 | return tc_action_net_init(tn, &act_pedit_ops); | 453 | return tc_action_net_init(tn, &act_pedit_ops, net); |
454 | } | 454 | } |
455 | 455 | ||
456 | static void __net_exit pedit_exit_net(struct net *net) | 456 | static void __net_exit pedit_exit_net(struct net *net) |
diff --git a/net/sched/act_police.c b/net/sched/act_police.c index 3bb2ebf9e9ae..9ec42b26e4b9 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c | |||
@@ -331,7 +331,7 @@ static __net_init int police_init_net(struct net *net) | |||
331 | { | 331 | { |
332 | struct tc_action_net *tn = net_generic(net, police_net_id); | 332 | struct tc_action_net *tn = net_generic(net, police_net_id); |
333 | 333 | ||
334 | return tc_action_net_init(tn, &act_police_ops); | 334 | return tc_action_net_init(tn, &act_police_ops, net); |
335 | } | 335 | } |
336 | 336 | ||
337 | static void __net_exit police_exit_net(struct net *net) | 337 | static void __net_exit police_exit_net(struct net *net) |
diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c index ec986ae52808..e69a1e3a39bf 100644 --- a/net/sched/act_sample.c +++ b/net/sched/act_sample.c | |||
@@ -240,7 +240,7 @@ static __net_init int sample_init_net(struct net *net) | |||
240 | { | 240 | { |
241 | struct tc_action_net *tn = net_generic(net, sample_net_id); | 241 | struct tc_action_net *tn = net_generic(net, sample_net_id); |
242 | 242 | ||
243 | return tc_action_net_init(tn, &act_sample_ops); | 243 | return tc_action_net_init(tn, &act_sample_ops, net); |
244 | } | 244 | } |
245 | 245 | ||
246 | static void __net_exit sample_exit_net(struct net *net) | 246 | static void __net_exit sample_exit_net(struct net *net) |
@@ -264,12 +264,13 @@ static int __init sample_init_module(void) | |||
264 | 264 | ||
265 | static void __exit sample_cleanup_module(void) | 265 | static void __exit sample_cleanup_module(void) |
266 | { | 266 | { |
267 | rcu_barrier(); | ||
267 | tcf_unregister_action(&act_sample_ops, &sample_net_ops); | 268 | tcf_unregister_action(&act_sample_ops, &sample_net_ops); |
268 | } | 269 | } |
269 | 270 | ||
270 | module_init(sample_init_module); | 271 | module_init(sample_init_module); |
271 | module_exit(sample_cleanup_module); | 272 | module_exit(sample_cleanup_module); |
272 | 273 | ||
273 | MODULE_AUTHOR("Yotam Gigi <yotamg@mellanox.com>"); | 274 | MODULE_AUTHOR("Yotam Gigi <yotam.gi@gmail.com>"); |
274 | MODULE_DESCRIPTION("Packet sampling action"); | 275 | MODULE_DESCRIPTION("Packet sampling action"); |
275 | MODULE_LICENSE("GPL v2"); | 276 | MODULE_LICENSE("GPL v2"); |
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c index e7b57e5071a3..a8d0ea95f894 100644 --- a/net/sched/act_simple.c +++ b/net/sched/act_simple.c | |||
@@ -201,7 +201,7 @@ static __net_init int simp_init_net(struct net *net) | |||
201 | { | 201 | { |
202 | struct tc_action_net *tn = net_generic(net, simp_net_id); | 202 | struct tc_action_net *tn = net_generic(net, simp_net_id); |
203 | 203 | ||
204 | return tc_action_net_init(tn, &act_simp_ops); | 204 | return tc_action_net_init(tn, &act_simp_ops, net); |
205 | } | 205 | } |
206 | 206 | ||
207 | static void __net_exit simp_exit_net(struct net *net) | 207 | static void __net_exit simp_exit_net(struct net *net) |
diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c index 59949d61f20d..fbac62472e09 100644 --- a/net/sched/act_skbedit.c +++ b/net/sched/act_skbedit.c | |||
@@ -238,7 +238,7 @@ static __net_init int skbedit_init_net(struct net *net) | |||
238 | { | 238 | { |
239 | struct tc_action_net *tn = net_generic(net, skbedit_net_id); | 239 | struct tc_action_net *tn = net_generic(net, skbedit_net_id); |
240 | 240 | ||
241 | return tc_action_net_init(tn, &act_skbedit_ops); | 241 | return tc_action_net_init(tn, &act_skbedit_ops, net); |
242 | } | 242 | } |
243 | 243 | ||
244 | static void __net_exit skbedit_exit_net(struct net *net) | 244 | static void __net_exit skbedit_exit_net(struct net *net) |
diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c index b642ad3d39dd..8e12d8897d2f 100644 --- a/net/sched/act_skbmod.c +++ b/net/sched/act_skbmod.c | |||
@@ -263,7 +263,7 @@ static __net_init int skbmod_init_net(struct net *net) | |||
263 | { | 263 | { |
264 | struct tc_action_net *tn = net_generic(net, skbmod_net_id); | 264 | struct tc_action_net *tn = net_generic(net, skbmod_net_id); |
265 | 265 | ||
266 | return tc_action_net_init(tn, &act_skbmod_ops); | 266 | return tc_action_net_init(tn, &act_skbmod_ops, net); |
267 | } | 267 | } |
268 | 268 | ||
269 | static void __net_exit skbmod_exit_net(struct net *net) | 269 | static void __net_exit skbmod_exit_net(struct net *net) |
diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c index 30c96274c638..c33faa373cf2 100644 --- a/net/sched/act_tunnel_key.c +++ b/net/sched/act_tunnel_key.c | |||
@@ -322,7 +322,7 @@ static __net_init int tunnel_key_init_net(struct net *net) | |||
322 | { | 322 | { |
323 | struct tc_action_net *tn = net_generic(net, tunnel_key_net_id); | 323 | struct tc_action_net *tn = net_generic(net, tunnel_key_net_id); |
324 | 324 | ||
325 | return tc_action_net_init(tn, &act_tunnel_key_ops); | 325 | return tc_action_net_init(tn, &act_tunnel_key_ops, net); |
326 | } | 326 | } |
327 | 327 | ||
328 | static void __net_exit tunnel_key_exit_net(struct net *net) | 328 | static void __net_exit tunnel_key_exit_net(struct net *net) |
diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c index 16eb067a8d8f..115fc33cc6d8 100644 --- a/net/sched/act_vlan.c +++ b/net/sched/act_vlan.c | |||
@@ -269,7 +269,7 @@ static __net_init int vlan_init_net(struct net *net) | |||
269 | { | 269 | { |
270 | struct tc_action_net *tn = net_generic(net, vlan_net_id); | 270 | struct tc_action_net *tn = net_generic(net, vlan_net_id); |
271 | 271 | ||
272 | return tc_action_net_init(tn, &act_vlan_ops); | 272 | return tc_action_net_init(tn, &act_vlan_ops, net); |
273 | } | 273 | } |
274 | 274 | ||
275 | static void __net_exit vlan_exit_net(struct net *net) | 275 | static void __net_exit vlan_exit_net(struct net *net) |
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 0b2219adf520..b2d310745487 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -77,6 +77,8 @@ out: | |||
77 | } | 77 | } |
78 | EXPORT_SYMBOL(register_tcf_proto_ops); | 78 | EXPORT_SYMBOL(register_tcf_proto_ops); |
79 | 79 | ||
80 | static struct workqueue_struct *tc_filter_wq; | ||
81 | |||
80 | int unregister_tcf_proto_ops(struct tcf_proto_ops *ops) | 82 | int unregister_tcf_proto_ops(struct tcf_proto_ops *ops) |
81 | { | 83 | { |
82 | struct tcf_proto_ops *t; | 84 | struct tcf_proto_ops *t; |
@@ -86,6 +88,7 @@ int unregister_tcf_proto_ops(struct tcf_proto_ops *ops) | |||
86 | * tcf_proto_ops's destroy() handler. | 88 | * tcf_proto_ops's destroy() handler. |
87 | */ | 89 | */ |
88 | rcu_barrier(); | 90 | rcu_barrier(); |
91 | flush_workqueue(tc_filter_wq); | ||
89 | 92 | ||
90 | write_lock(&cls_mod_lock); | 93 | write_lock(&cls_mod_lock); |
91 | list_for_each_entry(t, &tcf_proto_base, head) { | 94 | list_for_each_entry(t, &tcf_proto_base, head) { |
@@ -100,6 +103,12 @@ int unregister_tcf_proto_ops(struct tcf_proto_ops *ops) | |||
100 | } | 103 | } |
101 | EXPORT_SYMBOL(unregister_tcf_proto_ops); | 104 | EXPORT_SYMBOL(unregister_tcf_proto_ops); |
102 | 105 | ||
106 | bool tcf_queue_work(struct work_struct *work) | ||
107 | { | ||
108 | return queue_work(tc_filter_wq, work); | ||
109 | } | ||
110 | EXPORT_SYMBOL(tcf_queue_work); | ||
111 | |||
103 | /* Select new prio value from the range, managed by kernel. */ | 112 | /* Select new prio value from the range, managed by kernel. */ |
104 | 113 | ||
105 | static inline u32 tcf_auto_prio(struct tcf_proto *tp) | 114 | static inline u32 tcf_auto_prio(struct tcf_proto *tp) |
@@ -266,6 +275,23 @@ err_chain_create: | |||
266 | } | 275 | } |
267 | EXPORT_SYMBOL(tcf_block_get); | 276 | EXPORT_SYMBOL(tcf_block_get); |
268 | 277 | ||
278 | static void tcf_block_put_final(struct work_struct *work) | ||
279 | { | ||
280 | struct tcf_block *block = container_of(work, struct tcf_block, work); | ||
281 | struct tcf_chain *chain, *tmp; | ||
282 | |||
283 | rtnl_lock(); | ||
284 | /* Only chain 0 should be still here. */ | ||
285 | list_for_each_entry_safe(chain, tmp, &block->chain_list, list) | ||
286 | tcf_chain_put(chain); | ||
287 | rtnl_unlock(); | ||
288 | kfree(block); | ||
289 | } | ||
290 | |||
291 | /* XXX: Standalone actions are not allowed to jump to any chain, and bound | ||
292 | * actions should be all removed after flushing. However, filters are now | ||
293 | * destroyed in tc filter workqueue with RTNL lock, they can not race here. | ||
294 | */ | ||
269 | void tcf_block_put(struct tcf_block *block) | 295 | void tcf_block_put(struct tcf_block *block) |
270 | { | 296 | { |
271 | struct tcf_chain *chain, *tmp; | 297 | struct tcf_chain *chain, *tmp; |
@@ -273,32 +299,15 @@ void tcf_block_put(struct tcf_block *block) | |||
273 | if (!block) | 299 | if (!block) |
274 | return; | 300 | return; |
275 | 301 | ||
276 | /* XXX: Standalone actions are not allowed to jump to any chain, and | 302 | list_for_each_entry_safe(chain, tmp, &block->chain_list, list) |
277 | * bound actions should be all removed after flushing. However, | ||
278 | * filters are destroyed in RCU callbacks, we have to hold the chains | ||
279 | * first, otherwise we would always race with RCU callbacks on this list | ||
280 | * without proper locking. | ||
281 | */ | ||
282 | |||
283 | /* Wait for existing RCU callbacks to cool down. */ | ||
284 | rcu_barrier(); | ||
285 | |||
286 | /* Hold a refcnt for all chains, except 0, in case they are gone. */ | ||
287 | list_for_each_entry(chain, &block->chain_list, list) | ||
288 | if (chain->index) | ||
289 | tcf_chain_hold(chain); | ||
290 | |||
291 | /* No race on the list, because no chain could be destroyed. */ | ||
292 | list_for_each_entry(chain, &block->chain_list, list) | ||
293 | tcf_chain_flush(chain); | 303 | tcf_chain_flush(chain); |
294 | 304 | ||
295 | /* Wait for RCU callbacks to release the reference count. */ | 305 | INIT_WORK(&block->work, tcf_block_put_final); |
306 | /* Wait for RCU callbacks to release the reference count and make | ||
307 | * sure their works have been queued before this. | ||
308 | */ | ||
296 | rcu_barrier(); | 309 | rcu_barrier(); |
297 | 310 | tcf_queue_work(&block->work); | |
298 | /* At this point, all the chains should have refcnt == 1. */ | ||
299 | list_for_each_entry_safe(chain, tmp, &block->chain_list, list) | ||
300 | tcf_chain_put(chain); | ||
301 | kfree(block); | ||
302 | } | 311 | } |
303 | EXPORT_SYMBOL(tcf_block_put); | 312 | EXPORT_SYMBOL(tcf_block_put); |
304 | 313 | ||
@@ -879,6 +888,7 @@ void tcf_exts_destroy(struct tcf_exts *exts) | |||
879 | #ifdef CONFIG_NET_CLS_ACT | 888 | #ifdef CONFIG_NET_CLS_ACT |
880 | LIST_HEAD(actions); | 889 | LIST_HEAD(actions); |
881 | 890 | ||
891 | ASSERT_RTNL(); | ||
882 | tcf_exts_to_list(exts, &actions); | 892 | tcf_exts_to_list(exts, &actions); |
883 | tcf_action_destroy(&actions, TCA_ACT_UNBIND); | 893 | tcf_action_destroy(&actions, TCA_ACT_UNBIND); |
884 | kfree(exts->actions); | 894 | kfree(exts->actions); |
@@ -1030,6 +1040,10 @@ EXPORT_SYMBOL(tcf_exts_get_dev); | |||
1030 | 1040 | ||
1031 | static int __init tc_filter_init(void) | 1041 | static int __init tc_filter_init(void) |
1032 | { | 1042 | { |
1043 | tc_filter_wq = alloc_ordered_workqueue("tc_filter_workqueue", 0); | ||
1044 | if (!tc_filter_wq) | ||
1045 | return -ENOMEM; | ||
1046 | |||
1033 | rtnl_register(PF_UNSPEC, RTM_NEWTFILTER, tc_ctl_tfilter, NULL, 0); | 1047 | rtnl_register(PF_UNSPEC, RTM_NEWTFILTER, tc_ctl_tfilter, NULL, 0); |
1034 | rtnl_register(PF_UNSPEC, RTM_DELTFILTER, tc_ctl_tfilter, NULL, 0); | 1048 | rtnl_register(PF_UNSPEC, RTM_DELTFILTER, tc_ctl_tfilter, NULL, 0); |
1035 | rtnl_register(PF_UNSPEC, RTM_GETTFILTER, tc_ctl_tfilter, | 1049 | rtnl_register(PF_UNSPEC, RTM_GETTFILTER, tc_ctl_tfilter, |
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c index d89ebafd2239..f177649a2419 100644 --- a/net/sched/cls_basic.c +++ b/net/sched/cls_basic.c | |||
@@ -34,7 +34,10 @@ struct basic_filter { | |||
34 | struct tcf_result res; | 34 | struct tcf_result res; |
35 | struct tcf_proto *tp; | 35 | struct tcf_proto *tp; |
36 | struct list_head link; | 36 | struct list_head link; |
37 | struct rcu_head rcu; | 37 | union { |
38 | struct work_struct work; | ||
39 | struct rcu_head rcu; | ||
40 | }; | ||
38 | }; | 41 | }; |
39 | 42 | ||
40 | static int basic_classify(struct sk_buff *skb, const struct tcf_proto *tp, | 43 | static int basic_classify(struct sk_buff *skb, const struct tcf_proto *tp, |
@@ -82,15 +85,26 @@ static int basic_init(struct tcf_proto *tp) | |||
82 | return 0; | 85 | return 0; |
83 | } | 86 | } |
84 | 87 | ||
85 | static void basic_delete_filter(struct rcu_head *head) | 88 | static void basic_delete_filter_work(struct work_struct *work) |
86 | { | 89 | { |
87 | struct basic_filter *f = container_of(head, struct basic_filter, rcu); | 90 | struct basic_filter *f = container_of(work, struct basic_filter, work); |
88 | 91 | ||
92 | rtnl_lock(); | ||
89 | tcf_exts_destroy(&f->exts); | 93 | tcf_exts_destroy(&f->exts); |
90 | tcf_em_tree_destroy(&f->ematches); | 94 | tcf_em_tree_destroy(&f->ematches); |
95 | rtnl_unlock(); | ||
96 | |||
91 | kfree(f); | 97 | kfree(f); |
92 | } | 98 | } |
93 | 99 | ||
100 | static void basic_delete_filter(struct rcu_head *head) | ||
101 | { | ||
102 | struct basic_filter *f = container_of(head, struct basic_filter, rcu); | ||
103 | |||
104 | INIT_WORK(&f->work, basic_delete_filter_work); | ||
105 | tcf_queue_work(&f->work); | ||
106 | } | ||
107 | |||
94 | static void basic_destroy(struct tcf_proto *tp) | 108 | static void basic_destroy(struct tcf_proto *tp) |
95 | { | 109 | { |
96 | struct basic_head *head = rtnl_dereference(tp->root); | 110 | struct basic_head *head = rtnl_dereference(tp->root); |
diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c index 520c5027646a..037a3ae86829 100644 --- a/net/sched/cls_bpf.c +++ b/net/sched/cls_bpf.c | |||
@@ -49,7 +49,10 @@ struct cls_bpf_prog { | |||
49 | struct sock_filter *bpf_ops; | 49 | struct sock_filter *bpf_ops; |
50 | const char *bpf_name; | 50 | const char *bpf_name; |
51 | struct tcf_proto *tp; | 51 | struct tcf_proto *tp; |
52 | struct rcu_head rcu; | 52 | union { |
53 | struct work_struct work; | ||
54 | struct rcu_head rcu; | ||
55 | }; | ||
53 | }; | 56 | }; |
54 | 57 | ||
55 | static const struct nla_policy bpf_policy[TCA_BPF_MAX + 1] = { | 58 | static const struct nla_policy bpf_policy[TCA_BPF_MAX + 1] = { |
@@ -257,9 +260,21 @@ static void __cls_bpf_delete_prog(struct cls_bpf_prog *prog) | |||
257 | kfree(prog); | 260 | kfree(prog); |
258 | } | 261 | } |
259 | 262 | ||
263 | static void cls_bpf_delete_prog_work(struct work_struct *work) | ||
264 | { | ||
265 | struct cls_bpf_prog *prog = container_of(work, struct cls_bpf_prog, work); | ||
266 | |||
267 | rtnl_lock(); | ||
268 | __cls_bpf_delete_prog(prog); | ||
269 | rtnl_unlock(); | ||
270 | } | ||
271 | |||
260 | static void cls_bpf_delete_prog_rcu(struct rcu_head *rcu) | 272 | static void cls_bpf_delete_prog_rcu(struct rcu_head *rcu) |
261 | { | 273 | { |
262 | __cls_bpf_delete_prog(container_of(rcu, struct cls_bpf_prog, rcu)); | 274 | struct cls_bpf_prog *prog = container_of(rcu, struct cls_bpf_prog, rcu); |
275 | |||
276 | INIT_WORK(&prog->work, cls_bpf_delete_prog_work); | ||
277 | tcf_queue_work(&prog->work); | ||
263 | } | 278 | } |
264 | 279 | ||
265 | static void __cls_bpf_delete(struct tcf_proto *tp, struct cls_bpf_prog *prog) | 280 | static void __cls_bpf_delete(struct tcf_proto *tp, struct cls_bpf_prog *prog) |
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c index d48452f87975..a97e069bee89 100644 --- a/net/sched/cls_cgroup.c +++ b/net/sched/cls_cgroup.c | |||
@@ -23,7 +23,10 @@ struct cls_cgroup_head { | |||
23 | struct tcf_exts exts; | 23 | struct tcf_exts exts; |
24 | struct tcf_ematch_tree ematches; | 24 | struct tcf_ematch_tree ematches; |
25 | struct tcf_proto *tp; | 25 | struct tcf_proto *tp; |
26 | struct rcu_head rcu; | 26 | union { |
27 | struct work_struct work; | ||
28 | struct rcu_head rcu; | ||
29 | }; | ||
27 | }; | 30 | }; |
28 | 31 | ||
29 | static int cls_cgroup_classify(struct sk_buff *skb, const struct tcf_proto *tp, | 32 | static int cls_cgroup_classify(struct sk_buff *skb, const struct tcf_proto *tp, |
@@ -57,15 +60,26 @@ static const struct nla_policy cgroup_policy[TCA_CGROUP_MAX + 1] = { | |||
57 | [TCA_CGROUP_EMATCHES] = { .type = NLA_NESTED }, | 60 | [TCA_CGROUP_EMATCHES] = { .type = NLA_NESTED }, |
58 | }; | 61 | }; |
59 | 62 | ||
63 | static void cls_cgroup_destroy_work(struct work_struct *work) | ||
64 | { | ||
65 | struct cls_cgroup_head *head = container_of(work, | ||
66 | struct cls_cgroup_head, | ||
67 | work); | ||
68 | rtnl_lock(); | ||
69 | tcf_exts_destroy(&head->exts); | ||
70 | tcf_em_tree_destroy(&head->ematches); | ||
71 | kfree(head); | ||
72 | rtnl_unlock(); | ||
73 | } | ||
74 | |||
60 | static void cls_cgroup_destroy_rcu(struct rcu_head *root) | 75 | static void cls_cgroup_destroy_rcu(struct rcu_head *root) |
61 | { | 76 | { |
62 | struct cls_cgroup_head *head = container_of(root, | 77 | struct cls_cgroup_head *head = container_of(root, |
63 | struct cls_cgroup_head, | 78 | struct cls_cgroup_head, |
64 | rcu); | 79 | rcu); |
65 | 80 | ||
66 | tcf_exts_destroy(&head->exts); | 81 | INIT_WORK(&head->work, cls_cgroup_destroy_work); |
67 | tcf_em_tree_destroy(&head->ematches); | 82 | tcf_queue_work(&head->work); |
68 | kfree(head); | ||
69 | } | 83 | } |
70 | 84 | ||
71 | static int cls_cgroup_change(struct net *net, struct sk_buff *in_skb, | 85 | static int cls_cgroup_change(struct net *net, struct sk_buff *in_skb, |
diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c index 2a3a60ec5b86..67f3a2af6aab 100644 --- a/net/sched/cls_flow.c +++ b/net/sched/cls_flow.c | |||
@@ -57,7 +57,10 @@ struct flow_filter { | |||
57 | u32 divisor; | 57 | u32 divisor; |
58 | u32 baseclass; | 58 | u32 baseclass; |
59 | u32 hashrnd; | 59 | u32 hashrnd; |
60 | struct rcu_head rcu; | 60 | union { |
61 | struct work_struct work; | ||
62 | struct rcu_head rcu; | ||
63 | }; | ||
61 | }; | 64 | }; |
62 | 65 | ||
63 | static inline u32 addr_fold(void *addr) | 66 | static inline u32 addr_fold(void *addr) |
@@ -369,14 +372,24 @@ static const struct nla_policy flow_policy[TCA_FLOW_MAX + 1] = { | |||
369 | [TCA_FLOW_PERTURB] = { .type = NLA_U32 }, | 372 | [TCA_FLOW_PERTURB] = { .type = NLA_U32 }, |
370 | }; | 373 | }; |
371 | 374 | ||
372 | static void flow_destroy_filter(struct rcu_head *head) | 375 | static void flow_destroy_filter_work(struct work_struct *work) |
373 | { | 376 | { |
374 | struct flow_filter *f = container_of(head, struct flow_filter, rcu); | 377 | struct flow_filter *f = container_of(work, struct flow_filter, work); |
375 | 378 | ||
379 | rtnl_lock(); | ||
376 | del_timer_sync(&f->perturb_timer); | 380 | del_timer_sync(&f->perturb_timer); |
377 | tcf_exts_destroy(&f->exts); | 381 | tcf_exts_destroy(&f->exts); |
378 | tcf_em_tree_destroy(&f->ematches); | 382 | tcf_em_tree_destroy(&f->ematches); |
379 | kfree(f); | 383 | kfree(f); |
384 | rtnl_unlock(); | ||
385 | } | ||
386 | |||
387 | static void flow_destroy_filter(struct rcu_head *head) | ||
388 | { | ||
389 | struct flow_filter *f = container_of(head, struct flow_filter, rcu); | ||
390 | |||
391 | INIT_WORK(&f->work, flow_destroy_filter_work); | ||
392 | tcf_queue_work(&f->work); | ||
380 | } | 393 | } |
381 | 394 | ||
382 | static int flow_change(struct net *net, struct sk_buff *in_skb, | 395 | static int flow_change(struct net *net, struct sk_buff *in_skb, |
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index d230cb4c8094..5b5722c8b32c 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c | |||
@@ -87,7 +87,10 @@ struct cls_fl_filter { | |||
87 | struct list_head list; | 87 | struct list_head list; |
88 | u32 handle; | 88 | u32 handle; |
89 | u32 flags; | 89 | u32 flags; |
90 | struct rcu_head rcu; | 90 | union { |
91 | struct work_struct work; | ||
92 | struct rcu_head rcu; | ||
93 | }; | ||
91 | struct net_device *hw_dev; | 94 | struct net_device *hw_dev; |
92 | }; | 95 | }; |
93 | 96 | ||
@@ -215,12 +218,22 @@ static int fl_init(struct tcf_proto *tp) | |||
215 | return 0; | 218 | return 0; |
216 | } | 219 | } |
217 | 220 | ||
218 | static void fl_destroy_filter(struct rcu_head *head) | 221 | static void fl_destroy_filter_work(struct work_struct *work) |
219 | { | 222 | { |
220 | struct cls_fl_filter *f = container_of(head, struct cls_fl_filter, rcu); | 223 | struct cls_fl_filter *f = container_of(work, struct cls_fl_filter, work); |
221 | 224 | ||
225 | rtnl_lock(); | ||
222 | tcf_exts_destroy(&f->exts); | 226 | tcf_exts_destroy(&f->exts); |
223 | kfree(f); | 227 | kfree(f); |
228 | rtnl_unlock(); | ||
229 | } | ||
230 | |||
231 | static void fl_destroy_filter(struct rcu_head *head) | ||
232 | { | ||
233 | struct cls_fl_filter *f = container_of(head, struct cls_fl_filter, rcu); | ||
234 | |||
235 | INIT_WORK(&f->work, fl_destroy_filter_work); | ||
236 | tcf_queue_work(&f->work); | ||
224 | } | 237 | } |
225 | 238 | ||
226 | static void fl_hw_destroy_filter(struct tcf_proto *tp, struct cls_fl_filter *f) | 239 | static void fl_hw_destroy_filter(struct tcf_proto *tp, struct cls_fl_filter *f) |
@@ -234,6 +247,7 @@ static void fl_hw_destroy_filter(struct tcf_proto *tp, struct cls_fl_filter *f) | |||
234 | tc_cls_common_offload_init(&cls_flower.common, tp); | 247 | tc_cls_common_offload_init(&cls_flower.common, tp); |
235 | cls_flower.command = TC_CLSFLOWER_DESTROY; | 248 | cls_flower.command = TC_CLSFLOWER_DESTROY; |
236 | cls_flower.cookie = (unsigned long) f; | 249 | cls_flower.cookie = (unsigned long) f; |
250 | cls_flower.egress_dev = f->hw_dev != tp->q->dev_queue->dev; | ||
237 | 251 | ||
238 | dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSFLOWER, &cls_flower); | 252 | dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSFLOWER, &cls_flower); |
239 | } | 253 | } |
@@ -289,6 +303,7 @@ static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f) | |||
289 | cls_flower.command = TC_CLSFLOWER_STATS; | 303 | cls_flower.command = TC_CLSFLOWER_STATS; |
290 | cls_flower.cookie = (unsigned long) f; | 304 | cls_flower.cookie = (unsigned long) f; |
291 | cls_flower.exts = &f->exts; | 305 | cls_flower.exts = &f->exts; |
306 | cls_flower.egress_dev = f->hw_dev != tp->q->dev_queue->dev; | ||
292 | 307 | ||
293 | dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSFLOWER, | 308 | dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_CLSFLOWER, |
294 | &cls_flower); | 309 | &cls_flower); |
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c index 941245ad07fd..99183b8621ec 100644 --- a/net/sched/cls_fw.c +++ b/net/sched/cls_fw.c | |||
@@ -46,7 +46,10 @@ struct fw_filter { | |||
46 | #endif /* CONFIG_NET_CLS_IND */ | 46 | #endif /* CONFIG_NET_CLS_IND */ |
47 | struct tcf_exts exts; | 47 | struct tcf_exts exts; |
48 | struct tcf_proto *tp; | 48 | struct tcf_proto *tp; |
49 | struct rcu_head rcu; | 49 | union { |
50 | struct work_struct work; | ||
51 | struct rcu_head rcu; | ||
52 | }; | ||
50 | }; | 53 | }; |
51 | 54 | ||
52 | static u32 fw_hash(u32 handle) | 55 | static u32 fw_hash(u32 handle) |
@@ -119,12 +122,22 @@ static int fw_init(struct tcf_proto *tp) | |||
119 | return 0; | 122 | return 0; |
120 | } | 123 | } |
121 | 124 | ||
122 | static void fw_delete_filter(struct rcu_head *head) | 125 | static void fw_delete_filter_work(struct work_struct *work) |
123 | { | 126 | { |
124 | struct fw_filter *f = container_of(head, struct fw_filter, rcu); | 127 | struct fw_filter *f = container_of(work, struct fw_filter, work); |
125 | 128 | ||
129 | rtnl_lock(); | ||
126 | tcf_exts_destroy(&f->exts); | 130 | tcf_exts_destroy(&f->exts); |
127 | kfree(f); | 131 | kfree(f); |
132 | rtnl_unlock(); | ||
133 | } | ||
134 | |||
135 | static void fw_delete_filter(struct rcu_head *head) | ||
136 | { | ||
137 | struct fw_filter *f = container_of(head, struct fw_filter, rcu); | ||
138 | |||
139 | INIT_WORK(&f->work, fw_delete_filter_work); | ||
140 | tcf_queue_work(&f->work); | ||
128 | } | 141 | } |
129 | 142 | ||
130 | static void fw_destroy(struct tcf_proto *tp) | 143 | static void fw_destroy(struct tcf_proto *tp) |
diff --git a/net/sched/cls_matchall.c b/net/sched/cls_matchall.c index eeac606c95ab..c33f711b9019 100644 --- a/net/sched/cls_matchall.c +++ b/net/sched/cls_matchall.c | |||
@@ -21,7 +21,10 @@ struct cls_mall_head { | |||
21 | struct tcf_result res; | 21 | struct tcf_result res; |
22 | u32 handle; | 22 | u32 handle; |
23 | u32 flags; | 23 | u32 flags; |
24 | struct rcu_head rcu; | 24 | union { |
25 | struct work_struct work; | ||
26 | struct rcu_head rcu; | ||
27 | }; | ||
25 | }; | 28 | }; |
26 | 29 | ||
27 | static int mall_classify(struct sk_buff *skb, const struct tcf_proto *tp, | 30 | static int mall_classify(struct sk_buff *skb, const struct tcf_proto *tp, |
@@ -41,13 +44,23 @@ static int mall_init(struct tcf_proto *tp) | |||
41 | return 0; | 44 | return 0; |
42 | } | 45 | } |
43 | 46 | ||
47 | static void mall_destroy_work(struct work_struct *work) | ||
48 | { | ||
49 | struct cls_mall_head *head = container_of(work, struct cls_mall_head, | ||
50 | work); | ||
51 | rtnl_lock(); | ||
52 | tcf_exts_destroy(&head->exts); | ||
53 | kfree(head); | ||
54 | rtnl_unlock(); | ||
55 | } | ||
56 | |||
44 | static void mall_destroy_rcu(struct rcu_head *rcu) | 57 | static void mall_destroy_rcu(struct rcu_head *rcu) |
45 | { | 58 | { |
46 | struct cls_mall_head *head = container_of(rcu, struct cls_mall_head, | 59 | struct cls_mall_head *head = container_of(rcu, struct cls_mall_head, |
47 | rcu); | 60 | rcu); |
48 | 61 | ||
49 | tcf_exts_destroy(&head->exts); | 62 | INIT_WORK(&head->work, mall_destroy_work); |
50 | kfree(head); | 63 | tcf_queue_work(&head->work); |
51 | } | 64 | } |
52 | 65 | ||
53 | static int mall_replace_hw_filter(struct tcf_proto *tp, | 66 | static int mall_replace_hw_filter(struct tcf_proto *tp, |
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c index 9ddde65915d2..4b14ccd8b8f2 100644 --- a/net/sched/cls_route.c +++ b/net/sched/cls_route.c | |||
@@ -57,7 +57,10 @@ struct route4_filter { | |||
57 | u32 handle; | 57 | u32 handle; |
58 | struct route4_bucket *bkt; | 58 | struct route4_bucket *bkt; |
59 | struct tcf_proto *tp; | 59 | struct tcf_proto *tp; |
60 | struct rcu_head rcu; | 60 | union { |
61 | struct work_struct work; | ||
62 | struct rcu_head rcu; | ||
63 | }; | ||
61 | }; | 64 | }; |
62 | 65 | ||
63 | #define ROUTE4_FAILURE ((struct route4_filter *)(-1L)) | 66 | #define ROUTE4_FAILURE ((struct route4_filter *)(-1L)) |
@@ -254,12 +257,22 @@ static int route4_init(struct tcf_proto *tp) | |||
254 | return 0; | 257 | return 0; |
255 | } | 258 | } |
256 | 259 | ||
257 | static void route4_delete_filter(struct rcu_head *head) | 260 | static void route4_delete_filter_work(struct work_struct *work) |
258 | { | 261 | { |
259 | struct route4_filter *f = container_of(head, struct route4_filter, rcu); | 262 | struct route4_filter *f = container_of(work, struct route4_filter, work); |
260 | 263 | ||
264 | rtnl_lock(); | ||
261 | tcf_exts_destroy(&f->exts); | 265 | tcf_exts_destroy(&f->exts); |
262 | kfree(f); | 266 | kfree(f); |
267 | rtnl_unlock(); | ||
268 | } | ||
269 | |||
270 | static void route4_delete_filter(struct rcu_head *head) | ||
271 | { | ||
272 | struct route4_filter *f = container_of(head, struct route4_filter, rcu); | ||
273 | |||
274 | INIT_WORK(&f->work, route4_delete_filter_work); | ||
275 | tcf_queue_work(&f->work); | ||
263 | } | 276 | } |
264 | 277 | ||
265 | static void route4_destroy(struct tcf_proto *tp) | 278 | static void route4_destroy(struct tcf_proto *tp) |
diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h index b1f6ed48bc72..bdbc541787f8 100644 --- a/net/sched/cls_rsvp.h +++ b/net/sched/cls_rsvp.h | |||
@@ -97,7 +97,10 @@ struct rsvp_filter { | |||
97 | 97 | ||
98 | u32 handle; | 98 | u32 handle; |
99 | struct rsvp_session *sess; | 99 | struct rsvp_session *sess; |
100 | struct rcu_head rcu; | 100 | union { |
101 | struct work_struct work; | ||
102 | struct rcu_head rcu; | ||
103 | }; | ||
101 | }; | 104 | }; |
102 | 105 | ||
103 | static inline unsigned int hash_dst(__be32 *dst, u8 protocol, u8 tunnelid) | 106 | static inline unsigned int hash_dst(__be32 *dst, u8 protocol, u8 tunnelid) |
@@ -282,12 +285,22 @@ static int rsvp_init(struct tcf_proto *tp) | |||
282 | return -ENOBUFS; | 285 | return -ENOBUFS; |
283 | } | 286 | } |
284 | 287 | ||
285 | static void rsvp_delete_filter_rcu(struct rcu_head *head) | 288 | static void rsvp_delete_filter_work(struct work_struct *work) |
286 | { | 289 | { |
287 | struct rsvp_filter *f = container_of(head, struct rsvp_filter, rcu); | 290 | struct rsvp_filter *f = container_of(work, struct rsvp_filter, work); |
288 | 291 | ||
292 | rtnl_lock(); | ||
289 | tcf_exts_destroy(&f->exts); | 293 | tcf_exts_destroy(&f->exts); |
290 | kfree(f); | 294 | kfree(f); |
295 | rtnl_unlock(); | ||
296 | } | ||
297 | |||
298 | static void rsvp_delete_filter_rcu(struct rcu_head *head) | ||
299 | { | ||
300 | struct rsvp_filter *f = container_of(head, struct rsvp_filter, rcu); | ||
301 | |||
302 | INIT_WORK(&f->work, rsvp_delete_filter_work); | ||
303 | tcf_queue_work(&f->work); | ||
291 | } | 304 | } |
292 | 305 | ||
293 | static void rsvp_delete_filter(struct tcf_proto *tp, struct rsvp_filter *f) | 306 | static void rsvp_delete_filter(struct tcf_proto *tp, struct rsvp_filter *f) |
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c index 14a7e08b2fa9..beaa95e09c25 100644 --- a/net/sched/cls_tcindex.c +++ b/net/sched/cls_tcindex.c | |||
@@ -27,14 +27,20 @@ | |||
27 | struct tcindex_filter_result { | 27 | struct tcindex_filter_result { |
28 | struct tcf_exts exts; | 28 | struct tcf_exts exts; |
29 | struct tcf_result res; | 29 | struct tcf_result res; |
30 | struct rcu_head rcu; | 30 | union { |
31 | struct work_struct work; | ||
32 | struct rcu_head rcu; | ||
33 | }; | ||
31 | }; | 34 | }; |
32 | 35 | ||
33 | struct tcindex_filter { | 36 | struct tcindex_filter { |
34 | u16 key; | 37 | u16 key; |
35 | struct tcindex_filter_result result; | 38 | struct tcindex_filter_result result; |
36 | struct tcindex_filter __rcu *next; | 39 | struct tcindex_filter __rcu *next; |
37 | struct rcu_head rcu; | 40 | union { |
41 | struct work_struct work; | ||
42 | struct rcu_head rcu; | ||
43 | }; | ||
38 | }; | 44 | }; |
39 | 45 | ||
40 | 46 | ||
@@ -133,12 +139,34 @@ static int tcindex_init(struct tcf_proto *tp) | |||
133 | return 0; | 139 | return 0; |
134 | } | 140 | } |
135 | 141 | ||
142 | static void tcindex_destroy_rexts_work(struct work_struct *work) | ||
143 | { | ||
144 | struct tcindex_filter_result *r; | ||
145 | |||
146 | r = container_of(work, struct tcindex_filter_result, work); | ||
147 | rtnl_lock(); | ||
148 | tcf_exts_destroy(&r->exts); | ||
149 | rtnl_unlock(); | ||
150 | } | ||
151 | |||
136 | static void tcindex_destroy_rexts(struct rcu_head *head) | 152 | static void tcindex_destroy_rexts(struct rcu_head *head) |
137 | { | 153 | { |
138 | struct tcindex_filter_result *r; | 154 | struct tcindex_filter_result *r; |
139 | 155 | ||
140 | r = container_of(head, struct tcindex_filter_result, rcu); | 156 | r = container_of(head, struct tcindex_filter_result, rcu); |
141 | tcf_exts_destroy(&r->exts); | 157 | INIT_WORK(&r->work, tcindex_destroy_rexts_work); |
158 | tcf_queue_work(&r->work); | ||
159 | } | ||
160 | |||
161 | static void tcindex_destroy_fexts_work(struct work_struct *work) | ||
162 | { | ||
163 | struct tcindex_filter *f = container_of(work, struct tcindex_filter, | ||
164 | work); | ||
165 | |||
166 | rtnl_lock(); | ||
167 | tcf_exts_destroy(&f->result.exts); | ||
168 | kfree(f); | ||
169 | rtnl_unlock(); | ||
142 | } | 170 | } |
143 | 171 | ||
144 | static void tcindex_destroy_fexts(struct rcu_head *head) | 172 | static void tcindex_destroy_fexts(struct rcu_head *head) |
@@ -146,8 +174,8 @@ static void tcindex_destroy_fexts(struct rcu_head *head) | |||
146 | struct tcindex_filter *f = container_of(head, struct tcindex_filter, | 174 | struct tcindex_filter *f = container_of(head, struct tcindex_filter, |
147 | rcu); | 175 | rcu); |
148 | 176 | ||
149 | tcf_exts_destroy(&f->result.exts); | 177 | INIT_WORK(&f->work, tcindex_destroy_fexts_work); |
150 | kfree(f); | 178 | tcf_queue_work(&f->work); |
151 | } | 179 | } |
152 | 180 | ||
153 | static int tcindex_delete(struct tcf_proto *tp, void *arg, bool *last) | 181 | static int tcindex_delete(struct tcf_proto *tp, void *arg, bool *last) |
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index 10b8d851fc6b..dadd1b344497 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c | |||
@@ -68,7 +68,10 @@ struct tc_u_knode { | |||
68 | u32 __percpu *pcpu_success; | 68 | u32 __percpu *pcpu_success; |
69 | #endif | 69 | #endif |
70 | struct tcf_proto *tp; | 70 | struct tcf_proto *tp; |
71 | struct rcu_head rcu; | 71 | union { |
72 | struct work_struct work; | ||
73 | struct rcu_head rcu; | ||
74 | }; | ||
72 | /* The 'sel' field MUST be the last field in structure to allow for | 75 | /* The 'sel' field MUST be the last field in structure to allow for |
73 | * tc_u32_keys allocated at end of structure. | 76 | * tc_u32_keys allocated at end of structure. |
74 | */ | 77 | */ |
@@ -418,11 +421,21 @@ static int u32_destroy_key(struct tcf_proto *tp, struct tc_u_knode *n, | |||
418 | * this the u32_delete_key_rcu variant does not free the percpu | 421 | * this the u32_delete_key_rcu variant does not free the percpu |
419 | * statistics. | 422 | * statistics. |
420 | */ | 423 | */ |
424 | static void u32_delete_key_work(struct work_struct *work) | ||
425 | { | ||
426 | struct tc_u_knode *key = container_of(work, struct tc_u_knode, work); | ||
427 | |||
428 | rtnl_lock(); | ||
429 | u32_destroy_key(key->tp, key, false); | ||
430 | rtnl_unlock(); | ||
431 | } | ||
432 | |||
421 | static void u32_delete_key_rcu(struct rcu_head *rcu) | 433 | static void u32_delete_key_rcu(struct rcu_head *rcu) |
422 | { | 434 | { |
423 | struct tc_u_knode *key = container_of(rcu, struct tc_u_knode, rcu); | 435 | struct tc_u_knode *key = container_of(rcu, struct tc_u_knode, rcu); |
424 | 436 | ||
425 | u32_destroy_key(key->tp, key, false); | 437 | INIT_WORK(&key->work, u32_delete_key_work); |
438 | tcf_queue_work(&key->work); | ||
426 | } | 439 | } |
427 | 440 | ||
428 | /* u32_delete_key_freepf_rcu is the rcu callback variant | 441 | /* u32_delete_key_freepf_rcu is the rcu callback variant |
@@ -432,11 +445,21 @@ static void u32_delete_key_rcu(struct rcu_head *rcu) | |||
432 | * for the variant that should be used with keys return from | 445 | * for the variant that should be used with keys return from |
433 | * u32_init_knode() | 446 | * u32_init_knode() |
434 | */ | 447 | */ |
448 | static void u32_delete_key_freepf_work(struct work_struct *work) | ||
449 | { | ||
450 | struct tc_u_knode *key = container_of(work, struct tc_u_knode, work); | ||
451 | |||
452 | rtnl_lock(); | ||
453 | u32_destroy_key(key->tp, key, true); | ||
454 | rtnl_unlock(); | ||
455 | } | ||
456 | |||
435 | static void u32_delete_key_freepf_rcu(struct rcu_head *rcu) | 457 | static void u32_delete_key_freepf_rcu(struct rcu_head *rcu) |
436 | { | 458 | { |
437 | struct tc_u_knode *key = container_of(rcu, struct tc_u_knode, rcu); | 459 | struct tc_u_knode *key = container_of(rcu, struct tc_u_knode, rcu); |
438 | 460 | ||
439 | u32_destroy_key(key->tp, key, true); | 461 | INIT_WORK(&key->work, u32_delete_key_freepf_work); |
462 | tcf_queue_work(&key->work); | ||
440 | } | 463 | } |
441 | 464 | ||
442 | static int u32_delete_key(struct tcf_proto *tp, struct tc_u_knode *key) | 465 | static int u32_delete_key(struct tcf_proto *tp, struct tc_u_knode *key) |
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index c6deb74e3d2f..22bc6fc48311 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -301,6 +301,8 @@ struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle) | |||
301 | { | 301 | { |
302 | struct Qdisc *q; | 302 | struct Qdisc *q; |
303 | 303 | ||
304 | if (!handle) | ||
305 | return NULL; | ||
304 | q = qdisc_match_from_root(dev->qdisc, handle); | 306 | q = qdisc_match_from_root(dev->qdisc, handle); |
305 | if (q) | 307 | if (q) |
306 | goto out; | 308 | goto out; |
diff --git a/net/sctp/Makefile b/net/sctp/Makefile index 70f1b570bab9..8c434af3e68f 100644 --- a/net/sctp/Makefile +++ b/net/sctp/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for SCTP support code. | 3 | # Makefile for SCTP support code. |
3 | # | 4 | # |
diff --git a/net/sctp/input.c b/net/sctp/input.c index 92a07141fd07..621b5ca3fd1c 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c | |||
@@ -421,7 +421,7 @@ void sctp_icmp_redirect(struct sock *sk, struct sctp_transport *t, | |||
421 | { | 421 | { |
422 | struct dst_entry *dst; | 422 | struct dst_entry *dst; |
423 | 423 | ||
424 | if (!t) | 424 | if (sock_owned_by_user(sk) || !t) |
425 | return; | 425 | return; |
426 | dst = sctp_transport_dst_check(t); | 426 | dst = sctp_transport_dst_check(t); |
427 | if (dst) | 427 | if (dst) |
@@ -794,7 +794,7 @@ hit: | |||
794 | struct sctp_hash_cmp_arg { | 794 | struct sctp_hash_cmp_arg { |
795 | const union sctp_addr *paddr; | 795 | const union sctp_addr *paddr; |
796 | const struct net *net; | 796 | const struct net *net; |
797 | u16 lport; | 797 | __be16 lport; |
798 | }; | 798 | }; |
799 | 799 | ||
800 | static inline int sctp_hash_cmp(struct rhashtable_compare_arg *arg, | 800 | static inline int sctp_hash_cmp(struct rhashtable_compare_arg *arg, |
@@ -820,37 +820,37 @@ out: | |||
820 | return err; | 820 | return err; |
821 | } | 821 | } |
822 | 822 | ||
823 | static inline u32 sctp_hash_obj(const void *data, u32 len, u32 seed) | 823 | static inline __u32 sctp_hash_obj(const void *data, u32 len, u32 seed) |
824 | { | 824 | { |
825 | const struct sctp_transport *t = data; | 825 | const struct sctp_transport *t = data; |
826 | const union sctp_addr *paddr = &t->ipaddr; | 826 | const union sctp_addr *paddr = &t->ipaddr; |
827 | const struct net *net = sock_net(t->asoc->base.sk); | 827 | const struct net *net = sock_net(t->asoc->base.sk); |
828 | u16 lport = htons(t->asoc->base.bind_addr.port); | 828 | __be16 lport = htons(t->asoc->base.bind_addr.port); |
829 | u32 addr; | 829 | __u32 addr; |
830 | 830 | ||
831 | if (paddr->sa.sa_family == AF_INET6) | 831 | if (paddr->sa.sa_family == AF_INET6) |
832 | addr = jhash(&paddr->v6.sin6_addr, 16, seed); | 832 | addr = jhash(&paddr->v6.sin6_addr, 16, seed); |
833 | else | 833 | else |
834 | addr = paddr->v4.sin_addr.s_addr; | 834 | addr = (__force __u32)paddr->v4.sin_addr.s_addr; |
835 | 835 | ||
836 | return jhash_3words(addr, ((__u32)paddr->v4.sin_port) << 16 | | 836 | return jhash_3words(addr, ((__force __u32)paddr->v4.sin_port) << 16 | |
837 | (__force __u32)lport, net_hash_mix(net), seed); | 837 | (__force __u32)lport, net_hash_mix(net), seed); |
838 | } | 838 | } |
839 | 839 | ||
840 | static inline u32 sctp_hash_key(const void *data, u32 len, u32 seed) | 840 | static inline __u32 sctp_hash_key(const void *data, u32 len, u32 seed) |
841 | { | 841 | { |
842 | const struct sctp_hash_cmp_arg *x = data; | 842 | const struct sctp_hash_cmp_arg *x = data; |
843 | const union sctp_addr *paddr = x->paddr; | 843 | const union sctp_addr *paddr = x->paddr; |
844 | const struct net *net = x->net; | 844 | const struct net *net = x->net; |
845 | u16 lport = x->lport; | 845 | __be16 lport = x->lport; |
846 | u32 addr; | 846 | __u32 addr; |
847 | 847 | ||
848 | if (paddr->sa.sa_family == AF_INET6) | 848 | if (paddr->sa.sa_family == AF_INET6) |
849 | addr = jhash(&paddr->v6.sin6_addr, 16, seed); | 849 | addr = jhash(&paddr->v6.sin6_addr, 16, seed); |
850 | else | 850 | else |
851 | addr = paddr->v4.sin_addr.s_addr; | 851 | addr = (__force __u32)paddr->v4.sin_addr.s_addr; |
852 | 852 | ||
853 | return jhash_3words(addr, ((__u32)paddr->v4.sin_port) << 16 | | 853 | return jhash_3words(addr, ((__force __u32)paddr->v4.sin_port) << 16 | |
854 | (__force __u32)lport, net_hash_mix(net), seed); | 854 | (__force __u32)lport, net_hash_mix(net), seed); |
855 | } | 855 | } |
856 | 856 | ||
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index 51c488769590..a6dfa86c0201 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c | |||
@@ -738,7 +738,7 @@ static int sctp_v6_skb_iif(const struct sk_buff *skb) | |||
738 | /* Was this packet marked by Explicit Congestion Notification? */ | 738 | /* Was this packet marked by Explicit Congestion Notification? */ |
739 | static int sctp_v6_is_ce(const struct sk_buff *skb) | 739 | static int sctp_v6_is_ce(const struct sk_buff *skb) |
740 | { | 740 | { |
741 | return *((__u32 *)(ipv6_hdr(skb))) & htonl(1 << 20); | 741 | return *((__u32 *)(ipv6_hdr(skb))) & (__force __u32)htonl(1 << 20); |
742 | } | 742 | } |
743 | 743 | ||
744 | /* Dump the v6 addr to the seq file. */ | 744 | /* Dump the v6 addr to the seq file. */ |
@@ -882,8 +882,10 @@ static int sctp_inet6_bind_verify(struct sctp_sock *opt, union sctp_addr *addr) | |||
882 | net = sock_net(&opt->inet.sk); | 882 | net = sock_net(&opt->inet.sk); |
883 | rcu_read_lock(); | 883 | rcu_read_lock(); |
884 | dev = dev_get_by_index_rcu(net, addr->v6.sin6_scope_id); | 884 | dev = dev_get_by_index_rcu(net, addr->v6.sin6_scope_id); |
885 | if (!dev || | 885 | if (!dev || !(opt->inet.freebind || |
886 | !ipv6_chk_addr(net, &addr->v6.sin6_addr, dev, 0)) { | 886 | net->ipv6.sysctl.ip_nonlocal_bind || |
887 | ipv6_chk_addr(net, &addr->v6.sin6_addr, | ||
888 | dev, 0))) { | ||
887 | rcu_read_unlock(); | 889 | rcu_read_unlock(); |
888 | return 0; | 890 | return 0; |
889 | } | 891 | } |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index ca8f196b6c6c..514465b03829 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -2854,7 +2854,7 @@ struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *asoc, | |||
2854 | addr_param_len = af->to_addr_param(addr, &addr_param); | 2854 | addr_param_len = af->to_addr_param(addr, &addr_param); |
2855 | param.param_hdr.type = flags; | 2855 | param.param_hdr.type = flags; |
2856 | param.param_hdr.length = htons(paramlen + addr_param_len); | 2856 | param.param_hdr.length = htons(paramlen + addr_param_len); |
2857 | param.crr_id = i; | 2857 | param.crr_id = htonl(i); |
2858 | 2858 | ||
2859 | sctp_addto_chunk(retval, paramlen, ¶m); | 2859 | sctp_addto_chunk(retval, paramlen, ¶m); |
2860 | sctp_addto_chunk(retval, addr_param_len, &addr_param); | 2860 | sctp_addto_chunk(retval, addr_param_len, &addr_param); |
@@ -2867,7 +2867,7 @@ struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *asoc, | |||
2867 | addr_param_len = af->to_addr_param(addr, &addr_param); | 2867 | addr_param_len = af->to_addr_param(addr, &addr_param); |
2868 | param.param_hdr.type = SCTP_PARAM_DEL_IP; | 2868 | param.param_hdr.type = SCTP_PARAM_DEL_IP; |
2869 | param.param_hdr.length = htons(paramlen + addr_param_len); | 2869 | param.param_hdr.length = htons(paramlen + addr_param_len); |
2870 | param.crr_id = i; | 2870 | param.crr_id = htonl(i); |
2871 | 2871 | ||
2872 | sctp_addto_chunk(retval, paramlen, ¶m); | 2872 | sctp_addto_chunk(retval, paramlen, ¶m); |
2873 | sctp_addto_chunk(retval, addr_param_len, &addr_param); | 2873 | sctp_addto_chunk(retval, addr_param_len, &addr_param); |
@@ -3591,7 +3591,7 @@ static struct sctp_chunk *sctp_make_reconf(const struct sctp_association *asoc, | |||
3591 | */ | 3591 | */ |
3592 | struct sctp_chunk *sctp_make_strreset_req( | 3592 | struct sctp_chunk *sctp_make_strreset_req( |
3593 | const struct sctp_association *asoc, | 3593 | const struct sctp_association *asoc, |
3594 | __u16 stream_num, __u16 *stream_list, | 3594 | __u16 stream_num, __be16 *stream_list, |
3595 | bool out, bool in) | 3595 | bool out, bool in) |
3596 | { | 3596 | { |
3597 | struct sctp_strreset_outreq outreq; | 3597 | struct sctp_strreset_outreq outreq; |
@@ -3788,7 +3788,8 @@ bool sctp_verify_reconf(const struct sctp_association *asoc, | |||
3788 | { | 3788 | { |
3789 | struct sctp_reconf_chunk *hdr; | 3789 | struct sctp_reconf_chunk *hdr; |
3790 | union sctp_params param; | 3790 | union sctp_params param; |
3791 | __u16 last = 0, cnt = 0; | 3791 | __be16 last = 0; |
3792 | __u16 cnt = 0; | ||
3792 | 3793 | ||
3793 | hdr = (struct sctp_reconf_chunk *)chunk->chunk_hdr; | 3794 | hdr = (struct sctp_reconf_chunk *)chunk->chunk_hdr; |
3794 | sctp_walk_params(param, hdr, params) { | 3795 | sctp_walk_params(param, hdr, params) { |
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index e6a2974e020e..e2d9a4b49c9c 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c | |||
@@ -1607,12 +1607,12 @@ static int sctp_cmd_interpreter(enum sctp_event event_type, | |||
1607 | break; | 1607 | break; |
1608 | 1608 | ||
1609 | case SCTP_CMD_INIT_FAILED: | 1609 | case SCTP_CMD_INIT_FAILED: |
1610 | sctp_cmd_init_failed(commands, asoc, cmd->obj.err); | 1610 | sctp_cmd_init_failed(commands, asoc, cmd->obj.u32); |
1611 | break; | 1611 | break; |
1612 | 1612 | ||
1613 | case SCTP_CMD_ASSOC_FAILED: | 1613 | case SCTP_CMD_ASSOC_FAILED: |
1614 | sctp_cmd_assoc_failed(commands, asoc, event_type, | 1614 | sctp_cmd_assoc_failed(commands, asoc, event_type, |
1615 | subtype, chunk, cmd->obj.err); | 1615 | subtype, chunk, cmd->obj.u32); |
1616 | break; | 1616 | break; |
1617 | 1617 | ||
1618 | case SCTP_CMD_INIT_COUNTER_INC: | 1618 | case SCTP_CMD_INIT_COUNTER_INC: |
@@ -1680,8 +1680,8 @@ static int sctp_cmd_interpreter(enum sctp_event event_type, | |||
1680 | case SCTP_CMD_PROCESS_CTSN: | 1680 | case SCTP_CMD_PROCESS_CTSN: |
1681 | /* Dummy up a SACK for processing. */ | 1681 | /* Dummy up a SACK for processing. */ |
1682 | sackh.cum_tsn_ack = cmd->obj.be32; | 1682 | sackh.cum_tsn_ack = cmd->obj.be32; |
1683 | sackh.a_rwnd = asoc->peer.rwnd + | 1683 | sackh.a_rwnd = htonl(asoc->peer.rwnd + |
1684 | asoc->outqueue.outstanding_bytes; | 1684 | asoc->outqueue.outstanding_bytes); |
1685 | sackh.num_gap_ack_blocks = 0; | 1685 | sackh.num_gap_ack_blocks = 0; |
1686 | sackh.num_dup_tsns = 0; | 1686 | sackh.num_dup_tsns = 0; |
1687 | chunk->subh.sack_hdr = &sackh; | 1687 | chunk->subh.sack_hdr = &sackh; |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index d4730ada7f32..6f45d1713452 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -170,6 +170,36 @@ static inline void sctp_set_owner_w(struct sctp_chunk *chunk) | |||
170 | sk_mem_charge(sk, chunk->skb->truesize); | 170 | sk_mem_charge(sk, chunk->skb->truesize); |
171 | } | 171 | } |
172 | 172 | ||
173 | static void sctp_clear_owner_w(struct sctp_chunk *chunk) | ||
174 | { | ||
175 | skb_orphan(chunk->skb); | ||
176 | } | ||
177 | |||
178 | static void sctp_for_each_tx_datachunk(struct sctp_association *asoc, | ||
179 | void (*cb)(struct sctp_chunk *)) | ||
180 | |||
181 | { | ||
182 | struct sctp_outq *q = &asoc->outqueue; | ||
183 | struct sctp_transport *t; | ||
184 | struct sctp_chunk *chunk; | ||
185 | |||
186 | list_for_each_entry(t, &asoc->peer.transport_addr_list, transports) | ||
187 | list_for_each_entry(chunk, &t->transmitted, transmitted_list) | ||
188 | cb(chunk); | ||
189 | |||
190 | list_for_each_entry(chunk, &q->retransmit, list) | ||
191 | cb(chunk); | ||
192 | |||
193 | list_for_each_entry(chunk, &q->sacked, list) | ||
194 | cb(chunk); | ||
195 | |||
196 | list_for_each_entry(chunk, &q->abandoned, list) | ||
197 | cb(chunk); | ||
198 | |||
199 | list_for_each_entry(chunk, &q->out_chunk_list, list) | ||
200 | cb(chunk); | ||
201 | } | ||
202 | |||
173 | /* Verify that this is a valid address. */ | 203 | /* Verify that this is a valid address. */ |
174 | static inline int sctp_verify_addr(struct sock *sk, union sctp_addr *addr, | 204 | static inline int sctp_verify_addr(struct sock *sk, union sctp_addr *addr, |
175 | int len) | 205 | int len) |
@@ -4906,6 +4936,10 @@ int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp) | |||
4906 | struct socket *sock; | 4936 | struct socket *sock; |
4907 | int err = 0; | 4937 | int err = 0; |
4908 | 4938 | ||
4939 | /* Do not peel off from one netns to another one. */ | ||
4940 | if (!net_eq(current->nsproxy->net_ns, sock_net(sk))) | ||
4941 | return -EINVAL; | ||
4942 | |||
4909 | if (!asoc) | 4943 | if (!asoc) |
4910 | return -EINVAL; | 4944 | return -EINVAL; |
4911 | 4945 | ||
@@ -8208,7 +8242,9 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, | |||
8208 | * paths won't try to lock it and then oldsk. | 8242 | * paths won't try to lock it and then oldsk. |
8209 | */ | 8243 | */ |
8210 | lock_sock_nested(newsk, SINGLE_DEPTH_NESTING); | 8244 | lock_sock_nested(newsk, SINGLE_DEPTH_NESTING); |
8245 | sctp_for_each_tx_datachunk(assoc, sctp_clear_owner_w); | ||
8211 | sctp_assoc_migrate(assoc, newsk); | 8246 | sctp_assoc_migrate(assoc, newsk); |
8247 | sctp_for_each_tx_datachunk(assoc, sctp_set_owner_w); | ||
8212 | 8248 | ||
8213 | /* If the association on the newsk is already closed before accept() | 8249 | /* If the association on the newsk is already closed before accept() |
8214 | * is called, set RCV_SHUTDOWN flag. | 8250 | * is called, set RCV_SHUTDOWN flag. |
diff --git a/net/sctp/stream.c b/net/sctp/stream.c index 63ea15503714..fa8371ff05c4 100644 --- a/net/sctp/stream.c +++ b/net/sctp/stream.c | |||
@@ -118,6 +118,7 @@ int sctp_send_reset_streams(struct sctp_association *asoc, | |||
118 | __u16 i, str_nums, *str_list; | 118 | __u16 i, str_nums, *str_list; |
119 | struct sctp_chunk *chunk; | 119 | struct sctp_chunk *chunk; |
120 | int retval = -EINVAL; | 120 | int retval = -EINVAL; |
121 | __be16 *nstr_list; | ||
121 | bool out, in; | 122 | bool out, in; |
122 | 123 | ||
123 | if (!asoc->peer.reconf_capable || | 124 | if (!asoc->peer.reconf_capable || |
@@ -148,13 +149,18 @@ int sctp_send_reset_streams(struct sctp_association *asoc, | |||
148 | if (str_list[i] >= stream->incnt) | 149 | if (str_list[i] >= stream->incnt) |
149 | goto out; | 150 | goto out; |
150 | 151 | ||
152 | nstr_list = kcalloc(str_nums, sizeof(__be16), GFP_KERNEL); | ||
153 | if (!nstr_list) { | ||
154 | retval = -ENOMEM; | ||
155 | goto out; | ||
156 | } | ||
157 | |||
151 | for (i = 0; i < str_nums; i++) | 158 | for (i = 0; i < str_nums; i++) |
152 | str_list[i] = htons(str_list[i]); | 159 | nstr_list[i] = htons(str_list[i]); |
153 | 160 | ||
154 | chunk = sctp_make_strreset_req(asoc, str_nums, str_list, out, in); | 161 | chunk = sctp_make_strreset_req(asoc, str_nums, nstr_list, out, in); |
155 | 162 | ||
156 | for (i = 0; i < str_nums; i++) | 163 | kfree(nstr_list); |
157 | str_list[i] = ntohs(str_list[i]); | ||
158 | 164 | ||
159 | if (!chunk) { | 165 | if (!chunk) { |
160 | retval = -ENOMEM; | 166 | retval = -ENOMEM; |
@@ -305,7 +311,7 @@ out: | |||
305 | } | 311 | } |
306 | 312 | ||
307 | static struct sctp_paramhdr *sctp_chunk_lookup_strreset_param( | 313 | static struct sctp_paramhdr *sctp_chunk_lookup_strreset_param( |
308 | struct sctp_association *asoc, __u32 resp_seq, | 314 | struct sctp_association *asoc, __be32 resp_seq, |
309 | __be16 type) | 315 | __be16 type) |
310 | { | 316 | { |
311 | struct sctp_chunk *chunk = asoc->strreset_chunk; | 317 | struct sctp_chunk *chunk = asoc->strreset_chunk; |
@@ -345,8 +351,9 @@ struct sctp_chunk *sctp_process_strreset_outreq( | |||
345 | { | 351 | { |
346 | struct sctp_strreset_outreq *outreq = param.v; | 352 | struct sctp_strreset_outreq *outreq = param.v; |
347 | struct sctp_stream *stream = &asoc->stream; | 353 | struct sctp_stream *stream = &asoc->stream; |
348 | __u16 i, nums, flags = 0, *str_p = NULL; | ||
349 | __u32 result = SCTP_STRRESET_DENIED; | 354 | __u32 result = SCTP_STRRESET_DENIED; |
355 | __u16 i, nums, flags = 0; | ||
356 | __be16 *str_p = NULL; | ||
350 | __u32 request_seq; | 357 | __u32 request_seq; |
351 | 358 | ||
352 | request_seq = ntohl(outreq->request_seq); | 359 | request_seq = ntohl(outreq->request_seq); |
@@ -439,8 +446,9 @@ struct sctp_chunk *sctp_process_strreset_inreq( | |||
439 | struct sctp_stream *stream = &asoc->stream; | 446 | struct sctp_stream *stream = &asoc->stream; |
440 | __u32 result = SCTP_STRRESET_DENIED; | 447 | __u32 result = SCTP_STRRESET_DENIED; |
441 | struct sctp_chunk *chunk = NULL; | 448 | struct sctp_chunk *chunk = NULL; |
442 | __u16 i, nums, *str_p; | ||
443 | __u32 request_seq; | 449 | __u32 request_seq; |
450 | __u16 i, nums; | ||
451 | __be16 *str_p; | ||
444 | 452 | ||
445 | request_seq = ntohl(inreq->request_seq); | 453 | request_seq = ntohl(inreq->request_seq); |
446 | if (TSN_lt(asoc->strreset_inseq, request_seq) || | 454 | if (TSN_lt(asoc->strreset_inseq, request_seq) || |
@@ -769,7 +777,7 @@ struct sctp_chunk *sctp_process_strreset_resp( | |||
769 | 777 | ||
770 | if (req->type == SCTP_PARAM_RESET_OUT_REQUEST) { | 778 | if (req->type == SCTP_PARAM_RESET_OUT_REQUEST) { |
771 | struct sctp_strreset_outreq *outreq; | 779 | struct sctp_strreset_outreq *outreq; |
772 | __u16 *str_p; | 780 | __be16 *str_p; |
773 | 781 | ||
774 | outreq = (struct sctp_strreset_outreq *)req; | 782 | outreq = (struct sctp_strreset_outreq *)req; |
775 | str_p = outreq->list_of_streams; | 783 | str_p = outreq->list_of_streams; |
@@ -794,7 +802,7 @@ struct sctp_chunk *sctp_process_strreset_resp( | |||
794 | nums, str_p, GFP_ATOMIC); | 802 | nums, str_p, GFP_ATOMIC); |
795 | } else if (req->type == SCTP_PARAM_RESET_IN_REQUEST) { | 803 | } else if (req->type == SCTP_PARAM_RESET_IN_REQUEST) { |
796 | struct sctp_strreset_inreq *inreq; | 804 | struct sctp_strreset_inreq *inreq; |
797 | __u16 *str_p; | 805 | __be16 *str_p; |
798 | 806 | ||
799 | /* if the result is performed, it's impossible for inreq */ | 807 | /* if the result is performed, it's impossible for inreq */ |
800 | if (result == SCTP_STRRESET_PERFORMED) | 808 | if (result == SCTP_STRRESET_PERFORMED) |
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c index 67abc0194f30..5447228bf1a0 100644 --- a/net/sctp/ulpevent.c +++ b/net/sctp/ulpevent.c | |||
@@ -847,7 +847,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_sender_dry_event( | |||
847 | 847 | ||
848 | struct sctp_ulpevent *sctp_ulpevent_make_stream_reset_event( | 848 | struct sctp_ulpevent *sctp_ulpevent_make_stream_reset_event( |
849 | const struct sctp_association *asoc, __u16 flags, __u16 stream_num, | 849 | const struct sctp_association *asoc, __u16 flags, __u16 stream_num, |
850 | __u16 *stream_list, gfp_t gfp) | 850 | __be16 *stream_list, gfp_t gfp) |
851 | { | 851 | { |
852 | struct sctp_stream_reset_event *sreset; | 852 | struct sctp_stream_reset_event *sreset; |
853 | struct sctp_ulpevent *event; | 853 | struct sctp_ulpevent *event; |
diff --git a/net/smc/smc.h b/net/smc/smc.h index 0ccd6fa387ad..0bee9d16cf29 100644 --- a/net/smc/smc.h +++ b/net/smc/smc.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Shared Memory Communications over RDMA (SMC-R) and RoCE | 3 | * Shared Memory Communications over RDMA (SMC-R) and RoCE |
3 | * | 4 | * |
diff --git a/net/smc/smc_cdc.c b/net/smc/smc_cdc.c index a7294edbc221..535e72cfc64b 100644 --- a/net/smc/smc_cdc.c +++ b/net/smc/smc_cdc.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Shared Memory Communications over RDMA (SMC-R) and RoCE | 3 | * Shared Memory Communications over RDMA (SMC-R) and RoCE |
3 | * | 4 | * |
diff --git a/net/smc/smc_cdc.h b/net/smc/smc_cdc.h index 8e1d76f26007..bea61dadaf36 100644 --- a/net/smc/smc_cdc.h +++ b/net/smc/smc_cdc.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Shared Memory Communications over RDMA (SMC-R) and RoCE | 3 | * Shared Memory Communications over RDMA (SMC-R) and RoCE |
3 | * | 4 | * |
diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c index b7dd2743fb5c..1800e16b2a02 100644 --- a/net/smc/smc_clc.c +++ b/net/smc/smc_clc.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Shared Memory Communications over RDMA (SMC-R) and RoCE | 3 | * Shared Memory Communications over RDMA (SMC-R) and RoCE |
3 | * | 4 | * |
diff --git a/net/smc/smc_clc.h b/net/smc/smc_clc.h index 1c55414041d4..12a9af1539a2 100644 --- a/net/smc/smc_clc.h +++ b/net/smc/smc_clc.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Shared Memory Communications over RDMA (SMC-R) and RoCE | 3 | * Shared Memory Communications over RDMA (SMC-R) and RoCE |
3 | * | 4 | * |
diff --git a/net/smc/smc_close.c b/net/smc/smc_close.c index f0d16fb825f7..2427a1f3d0d1 100644 --- a/net/smc/smc_close.c +++ b/net/smc/smc_close.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Shared Memory Communications over RDMA (SMC-R) and RoCE | 3 | * Shared Memory Communications over RDMA (SMC-R) and RoCE |
3 | * | 4 | * |
diff --git a/net/smc/smc_close.h b/net/smc/smc_close.h index 4a3d99a8d7cb..ed82506b1b0a 100644 --- a/net/smc/smc_close.h +++ b/net/smc/smc_close.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Shared Memory Communications over RDMA (SMC-R) and RoCE | 3 | * Shared Memory Communications over RDMA (SMC-R) and RoCE |
3 | * | 4 | * |
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c index 20b66e79c5d6..413e3868fbf3 100644 --- a/net/smc/smc_core.c +++ b/net/smc/smc_core.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Shared Memory Communications over RDMA (SMC-R) and RoCE | 3 | * Shared Memory Communications over RDMA (SMC-R) and RoCE |
3 | * | 4 | * |
diff --git a/net/smc/smc_core.h b/net/smc/smc_core.h index 19c44bf4e391..fe691bf9af91 100644 --- a/net/smc/smc_core.h +++ b/net/smc/smc_core.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Shared Memory Communications over RDMA (SMC-R) and RoCE | 3 | * Shared Memory Communications over RDMA (SMC-R) and RoCE |
3 | * | 4 | * |
diff --git a/net/smc/smc_ib.c b/net/smc/smc_ib.c index 0b5852299158..9033b8a36fe1 100644 --- a/net/smc/smc_ib.c +++ b/net/smc/smc_ib.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Shared Memory Communications over RDMA (SMC-R) and RoCE | 3 | * Shared Memory Communications over RDMA (SMC-R) and RoCE |
3 | * | 4 | * |
diff --git a/net/smc/smc_ib.h b/net/smc/smc_ib.h index 9b927a33d5e6..e90630dadf8e 100644 --- a/net/smc/smc_ib.h +++ b/net/smc/smc_ib.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Shared Memory Communications over RDMA (SMC-R) and RoCE | 3 | * Shared Memory Communications over RDMA (SMC-R) and RoCE |
3 | * | 4 | * |
diff --git a/net/smc/smc_llc.c b/net/smc/smc_llc.c index c2f9165d13ef..92fe4cc8c82c 100644 --- a/net/smc/smc_llc.c +++ b/net/smc/smc_llc.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Shared Memory Communications over RDMA (SMC-R) and RoCE | 3 | * Shared Memory Communications over RDMA (SMC-R) and RoCE |
3 | * | 4 | * |
diff --git a/net/smc/smc_llc.h b/net/smc/smc_llc.h index b472f853953a..51b27ce90dbd 100644 --- a/net/smc/smc_llc.h +++ b/net/smc/smc_llc.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Shared Memory Communications over RDMA (SMC-R) and RoCE | 3 | * Shared Memory Communications over RDMA (SMC-R) and RoCE |
3 | * | 4 | * |
diff --git a/net/smc/smc_pnet.c b/net/smc/smc_pnet.c index 31f8453c25c5..74568cdbca70 100644 --- a/net/smc/smc_pnet.c +++ b/net/smc/smc_pnet.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Shared Memory Communications over RDMA (SMC-R) and RoCE | 3 | * Shared Memory Communications over RDMA (SMC-R) and RoCE |
3 | * | 4 | * |
diff --git a/net/smc/smc_pnet.h b/net/smc/smc_pnet.h index c4f1bccd4358..5a29519db976 100644 --- a/net/smc/smc_pnet.h +++ b/net/smc/smc_pnet.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Shared Memory Communications over RDMA (SMC-R) and RoCE | 3 | * Shared Memory Communications over RDMA (SMC-R) and RoCE |
3 | * | 4 | * |
diff --git a/net/smc/smc_rx.c b/net/smc/smc_rx.c index 3e631ae4b6b6..cbf58637ee14 100644 --- a/net/smc/smc_rx.c +++ b/net/smc/smc_rx.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Shared Memory Communications over RDMA (SMC-R) and RoCE | 3 | * Shared Memory Communications over RDMA (SMC-R) and RoCE |
3 | * | 4 | * |
diff --git a/net/smc/smc_rx.h b/net/smc/smc_rx.h index b5b80e1f8b0f..3a32b59bf06c 100644 --- a/net/smc/smc_rx.h +++ b/net/smc/smc_rx.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Shared Memory Communications over RDMA (SMC-R) and RoCE | 3 | * Shared Memory Communications over RDMA (SMC-R) and RoCE |
3 | * | 4 | * |
diff --git a/net/smc/smc_tx.c b/net/smc/smc_tx.c index 3866573288dd..710ab3fbf607 100644 --- a/net/smc/smc_tx.c +++ b/net/smc/smc_tx.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Shared Memory Communications over RDMA (SMC-R) and RoCE | 3 | * Shared Memory Communications over RDMA (SMC-R) and RoCE |
3 | * | 4 | * |
diff --git a/net/smc/smc_tx.h b/net/smc/smc_tx.h index 1d6a0dcdcfe6..78255964fa4d 100644 --- a/net/smc/smc_tx.h +++ b/net/smc/smc_tx.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Shared Memory Communications over RDMA (SMC-R) and RoCE | 3 | * Shared Memory Communications over RDMA (SMC-R) and RoCE |
3 | * | 4 | * |
diff --git a/net/smc/smc_wr.c b/net/smc/smc_wr.c index 525d91e0d57e..de4537f66832 100644 --- a/net/smc/smc_wr.c +++ b/net/smc/smc_wr.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Shared Memory Communications over RDMA (SMC-R) and RoCE | 3 | * Shared Memory Communications over RDMA (SMC-R) and RoCE |
3 | * | 4 | * |
diff --git a/net/smc/smc_wr.h b/net/smc/smc_wr.h index 45eb53833052..2acf12b06063 100644 --- a/net/smc/smc_wr.h +++ b/net/smc/smc_wr.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Shared Memory Communications over RDMA (SMC-R) and RoCE | 3 | * Shared Memory Communications over RDMA (SMC-R) and RoCE |
3 | * | 4 | * |
diff --git a/net/strparser/strparser.c b/net/strparser/strparser.c index d4ea46a5f233..c5fda15ba319 100644 --- a/net/strparser/strparser.c +++ b/net/strparser/strparser.c | |||
@@ -49,7 +49,7 @@ static void strp_abort_strp(struct strparser *strp, int err) | |||
49 | { | 49 | { |
50 | /* Unrecoverable error in receive */ | 50 | /* Unrecoverable error in receive */ |
51 | 51 | ||
52 | del_timer(&strp->msg_timer); | 52 | cancel_delayed_work(&strp->msg_timer_work); |
53 | 53 | ||
54 | if (strp->stopped) | 54 | if (strp->stopped) |
55 | return; | 55 | return; |
@@ -68,7 +68,7 @@ static void strp_abort_strp(struct strparser *strp, int err) | |||
68 | static void strp_start_timer(struct strparser *strp, long timeo) | 68 | static void strp_start_timer(struct strparser *strp, long timeo) |
69 | { | 69 | { |
70 | if (timeo) | 70 | if (timeo) |
71 | mod_timer(&strp->msg_timer, timeo); | 71 | mod_delayed_work(strp_wq, &strp->msg_timer_work, timeo); |
72 | } | 72 | } |
73 | 73 | ||
74 | /* Lower lock held */ | 74 | /* Lower lock held */ |
@@ -319,7 +319,7 @@ static int __strp_recv(read_descriptor_t *desc, struct sk_buff *orig_skb, | |||
319 | eaten += (cand_len - extra); | 319 | eaten += (cand_len - extra); |
320 | 320 | ||
321 | /* Hurray, we have a new message! */ | 321 | /* Hurray, we have a new message! */ |
322 | del_timer(&strp->msg_timer); | 322 | cancel_delayed_work(&strp->msg_timer_work); |
323 | strp->skb_head = NULL; | 323 | strp->skb_head = NULL; |
324 | STRP_STATS_INCR(strp->stats.msgs); | 324 | STRP_STATS_INCR(strp->stats.msgs); |
325 | 325 | ||
@@ -450,9 +450,10 @@ static void strp_work(struct work_struct *w) | |||
450 | do_strp_work(container_of(w, struct strparser, work)); | 450 | do_strp_work(container_of(w, struct strparser, work)); |
451 | } | 451 | } |
452 | 452 | ||
453 | static void strp_msg_timeout(unsigned long arg) | 453 | static void strp_msg_timeout(struct work_struct *w) |
454 | { | 454 | { |
455 | struct strparser *strp = (struct strparser *)arg; | 455 | struct strparser *strp = container_of(w, struct strparser, |
456 | msg_timer_work.work); | ||
456 | 457 | ||
457 | /* Message assembly timed out */ | 458 | /* Message assembly timed out */ |
458 | STRP_STATS_INCR(strp->stats.msg_timeouts); | 459 | STRP_STATS_INCR(strp->stats.msg_timeouts); |
@@ -505,9 +506,7 @@ int strp_init(struct strparser *strp, struct sock *sk, | |||
505 | strp->cb.read_sock_done = cb->read_sock_done ? : default_read_sock_done; | 506 | strp->cb.read_sock_done = cb->read_sock_done ? : default_read_sock_done; |
506 | strp->cb.abort_parser = cb->abort_parser ? : strp_abort_strp; | 507 | strp->cb.abort_parser = cb->abort_parser ? : strp_abort_strp; |
507 | 508 | ||
508 | setup_timer(&strp->msg_timer, strp_msg_timeout, | 509 | INIT_DELAYED_WORK(&strp->msg_timer_work, strp_msg_timeout); |
509 | (unsigned long)strp); | ||
510 | |||
511 | INIT_WORK(&strp->work, strp_work); | 510 | INIT_WORK(&strp->work, strp_work); |
512 | 511 | ||
513 | return 0; | 512 | return 0; |
@@ -532,7 +531,7 @@ void strp_done(struct strparser *strp) | |||
532 | { | 531 | { |
533 | WARN_ON(!strp->stopped); | 532 | WARN_ON(!strp->stopped); |
534 | 533 | ||
535 | del_timer_sync(&strp->msg_timer); | 534 | cancel_delayed_work_sync(&strp->msg_timer_work); |
536 | cancel_work_sync(&strp->work); | 535 | cancel_work_sync(&strp->work); |
537 | 536 | ||
538 | if (strp->skb_head) { | 537 | if (strp->skb_head) { |
diff --git a/net/sunrpc/Makefile b/net/sunrpc/Makefile index ea7ffa12e0f9..090658c3da12 100644 --- a/net/sunrpc/Makefile +++ b/net/sunrpc/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for Linux kernel SUN RPC | 3 | # Makefile for Linux kernel SUN RPC |
3 | # | 4 | # |
diff --git a/net/sunrpc/auth_gss/Makefile b/net/sunrpc/auth_gss/Makefile index 14e9e53e63d5..c374268b008f 100644 --- a/net/sunrpc/auth_gss/Makefile +++ b/net/sunrpc/auth_gss/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for Linux kernel rpcsec_gss implementation | 3 | # Makefile for Linux kernel rpcsec_gss implementation |
3 | # | 4 | # |
diff --git a/net/sunrpc/auth_null.c b/net/sunrpc/auth_null.c index 5f3d527dff65..75d72e109a04 100644 --- a/net/sunrpc/auth_null.c +++ b/net/sunrpc/auth_null.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * linux/net/sunrpc/auth_null.c | 3 | * linux/net/sunrpc/auth_null.c |
3 | * | 4 | * |
diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c index 82337e1ec9cd..dafd6b870ba3 100644 --- a/net/sunrpc/auth_unix.c +++ b/net/sunrpc/auth_unix.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * linux/net/sunrpc/auth_unix.c | 3 | * linux/net/sunrpc/auth_unix.c |
3 | * | 4 | * |
diff --git a/net/sunrpc/debugfs.c b/net/sunrpc/debugfs.c index c8fd0b6c1618..e980d2a493de 100644 --- a/net/sunrpc/debugfs.c +++ b/net/sunrpc/debugfs.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /** | 2 | /** |
2 | * debugfs interface for sunrpc | 3 | * debugfs interface for sunrpc |
3 | * | 4 | * |
diff --git a/net/sunrpc/netns.h b/net/sunrpc/netns.h index 394ce523174c..7ec10b92bea1 100644 --- a/net/sunrpc/netns.h +++ b/net/sunrpc/netns.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef __SUNRPC_NETNS_H__ | 2 | #ifndef __SUNRPC_NETNS_H__ |
2 | #define __SUNRPC_NETNS_H__ | 3 | #define __SUNRPC_NETNS_H__ |
3 | 4 | ||
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index e741ec2b4d8e..898485e3ece4 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -1333,7 +1333,7 @@ void xprt_release(struct rpc_task *task) | |||
1333 | rpc_count_iostats(task, task->tk_client->cl_metrics); | 1333 | rpc_count_iostats(task, task->tk_client->cl_metrics); |
1334 | spin_lock(&xprt->recv_lock); | 1334 | spin_lock(&xprt->recv_lock); |
1335 | if (!list_empty(&req->rq_list)) { | 1335 | if (!list_empty(&req->rq_list)) { |
1336 | list_del(&req->rq_list); | 1336 | list_del_init(&req->rq_list); |
1337 | xprt_wait_on_pinned_rqst(req); | 1337 | xprt_wait_on_pinned_rqst(req); |
1338 | } | 1338 | } |
1339 | spin_unlock(&xprt->recv_lock); | 1339 | spin_unlock(&xprt->recv_lock); |
@@ -1445,6 +1445,23 @@ out: | |||
1445 | return xprt; | 1445 | return xprt; |
1446 | } | 1446 | } |
1447 | 1447 | ||
1448 | static void xprt_destroy_cb(struct work_struct *work) | ||
1449 | { | ||
1450 | struct rpc_xprt *xprt = | ||
1451 | container_of(work, struct rpc_xprt, task_cleanup); | ||
1452 | |||
1453 | rpc_xprt_debugfs_unregister(xprt); | ||
1454 | rpc_destroy_wait_queue(&xprt->binding); | ||
1455 | rpc_destroy_wait_queue(&xprt->pending); | ||
1456 | rpc_destroy_wait_queue(&xprt->sending); | ||
1457 | rpc_destroy_wait_queue(&xprt->backlog); | ||
1458 | kfree(xprt->servername); | ||
1459 | /* | ||
1460 | * Tear down transport state and free the rpc_xprt | ||
1461 | */ | ||
1462 | xprt->ops->destroy(xprt); | ||
1463 | } | ||
1464 | |||
1448 | /** | 1465 | /** |
1449 | * xprt_destroy - destroy an RPC transport, killing off all requests. | 1466 | * xprt_destroy - destroy an RPC transport, killing off all requests. |
1450 | * @xprt: transport to destroy | 1467 | * @xprt: transport to destroy |
@@ -1454,22 +1471,19 @@ static void xprt_destroy(struct rpc_xprt *xprt) | |||
1454 | { | 1471 | { |
1455 | dprintk("RPC: destroying transport %p\n", xprt); | 1472 | dprintk("RPC: destroying transport %p\n", xprt); |
1456 | 1473 | ||
1457 | /* Exclude transport connect/disconnect handlers */ | 1474 | /* |
1475 | * Exclude transport connect/disconnect handlers and autoclose | ||
1476 | */ | ||
1458 | wait_on_bit_lock(&xprt->state, XPRT_LOCKED, TASK_UNINTERRUPTIBLE); | 1477 | wait_on_bit_lock(&xprt->state, XPRT_LOCKED, TASK_UNINTERRUPTIBLE); |
1459 | 1478 | ||
1460 | del_timer_sync(&xprt->timer); | 1479 | del_timer_sync(&xprt->timer); |
1461 | 1480 | ||
1462 | rpc_xprt_debugfs_unregister(xprt); | ||
1463 | rpc_destroy_wait_queue(&xprt->binding); | ||
1464 | rpc_destroy_wait_queue(&xprt->pending); | ||
1465 | rpc_destroy_wait_queue(&xprt->sending); | ||
1466 | rpc_destroy_wait_queue(&xprt->backlog); | ||
1467 | cancel_work_sync(&xprt->task_cleanup); | ||
1468 | kfree(xprt->servername); | ||
1469 | /* | 1481 | /* |
1470 | * Tear down transport state and free the rpc_xprt | 1482 | * Destroy sockets etc from the system workqueue so they can |
1483 | * safely flush receive work running on rpciod. | ||
1471 | */ | 1484 | */ |
1472 | xprt->ops->destroy(xprt); | 1485 | INIT_WORK(&xprt->task_cleanup, xprt_destroy_cb); |
1486 | schedule_work(&xprt->task_cleanup); | ||
1473 | } | 1487 | } |
1474 | 1488 | ||
1475 | static void xprt_destroy_kref(struct kref *kref) | 1489 | static void xprt_destroy_kref(struct kref *kref) |
diff --git a/net/sunrpc/xprtmultipath.c b/net/sunrpc/xprtmultipath.c index ae92a9e9ba52..e2d64c7138c3 100644 --- a/net/sunrpc/xprtmultipath.c +++ b/net/sunrpc/xprtmultipath.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Multipath support for RPC | 3 | * Multipath support for RPC |
3 | * | 4 | * |
diff --git a/net/sunrpc/xprtrdma/Makefile b/net/sunrpc/xprtrdma/Makefile index b8213ddce2f2..8bf19e142b6b 100644 --- a/net/sunrpc/xprtrdma/Makefile +++ b/net/sunrpc/xprtrdma/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | obj-$(CONFIG_SUNRPC_XPRT_RDMA) += rpcrdma.o | 2 | obj-$(CONFIG_SUNRPC_XPRT_RDMA) += rpcrdma.o |
2 | 3 | ||
3 | rpcrdma-y := transport.o rpc_rdma.o verbs.o \ | 4 | rpcrdma-y := transport.o rpc_rdma.o verbs.o \ |
diff --git a/net/sunrpc/xprtrdma/backchannel.c b/net/sunrpc/xprtrdma/backchannel.c index d31d0ac5ada9..823a781ec89c 100644 --- a/net/sunrpc/xprtrdma/backchannel.c +++ b/net/sunrpc/xprtrdma/backchannel.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2015 Oracle. All rights reserved. | 3 | * Copyright (c) 2015 Oracle. All rights reserved. |
3 | * | 4 | * |
diff --git a/net/sunrpc/xprtrdma/fmr_ops.c b/net/sunrpc/xprtrdma/fmr_ops.c index 6c7151341194..fa759dd2b0f3 100644 --- a/net/sunrpc/xprtrdma/fmr_ops.c +++ b/net/sunrpc/xprtrdma/fmr_ops.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2015 Oracle. All rights reserved. | 3 | * Copyright (c) 2015 Oracle. All rights reserved. |
3 | * Copyright (c) 2003-2007 Network Appliance, Inc. All rights reserved. | 4 | * Copyright (c) 2003-2007 Network Appliance, Inc. All rights reserved. |
diff --git a/net/sunrpc/xprtrdma/frwr_ops.c b/net/sunrpc/xprtrdma/frwr_ops.c index df062e086bdb..35d7517ef0e6 100644 --- a/net/sunrpc/xprtrdma/frwr_ops.c +++ b/net/sunrpc/xprtrdma/frwr_ops.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2015 Oracle. All rights reserved. | 3 | * Copyright (c) 2015 Oracle. All rights reserved. |
3 | * Copyright (c) 2003-2007 Network Appliance, Inc. All rights reserved. | 4 | * Copyright (c) 2003-2007 Network Appliance, Inc. All rights reserved. |
diff --git a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c index ec37ad83b068..992594b7cc6b 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c +++ b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2015 Oracle. All rights reserved. | 3 | * Copyright (c) 2015 Oracle. All rights reserved. |
3 | * | 4 | * |
diff --git a/net/sunrpc/xprtrdma/svc_rdma_rw.c b/net/sunrpc/xprtrdma/svc_rdma_rw.c index 7dcda4597057..9bd04549a1ad 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_rw.c +++ b/net/sunrpc/xprtrdma/svc_rdma_rw.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2016 Oracle. All rights reserved. | 3 | * Copyright (c) 2016 Oracle. All rights reserved. |
3 | * | 4 | * |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index c1841f234a71..4dad5da388d6 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * linux/net/sunrpc/xprtsock.c | 3 | * linux/net/sunrpc/xprtsock.c |
3 | * | 4 | * |
diff --git a/net/tipc/Makefile b/net/tipc/Makefile index 31b9f9c52974..2bfaa9d4b403 100644 --- a/net/tipc/Makefile +++ b/net/tipc/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the Linux TIPC layer | 3 | # Makefile for the Linux TIPC layer |
3 | # | 4 | # |
diff --git a/net/unix/Makefile b/net/unix/Makefile index b663c607b1c6..ffd0a275c3a7 100644 --- a/net/unix/Makefile +++ b/net/unix/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the Linux unix domain socket layer. | 3 | # Makefile for the Linux unix domain socket layer. |
3 | # | 4 | # |
diff --git a/net/unix/diag.c b/net/unix/diag.c index 4d9679701a6d..384c84e83462 100644 --- a/net/unix/diag.c +++ b/net/unix/diag.c | |||
@@ -257,6 +257,8 @@ static int unix_diag_get_exact(struct sk_buff *in_skb, | |||
257 | err = -ENOENT; | 257 | err = -ENOENT; |
258 | if (sk == NULL) | 258 | if (sk == NULL) |
259 | goto out_nosk; | 259 | goto out_nosk; |
260 | if (!net_eq(sock_net(sk), net)) | ||
261 | goto out; | ||
260 | 262 | ||
261 | err = sock_diag_check_cookie(sk, req->udiag_cookie); | 263 | err = sock_diag_check_cookie(sk, req->udiag_cookie); |
262 | if (err) | 264 | if (err) |
diff --git a/net/vmw_vsock/Makefile b/net/vmw_vsock/Makefile index e63d574234a9..30a263320e4f 100644 --- a/net/vmw_vsock/Makefile +++ b/net/vmw_vsock/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | obj-$(CONFIG_VSOCKETS) += vsock.o | 2 | obj-$(CONFIG_VSOCKETS) += vsock.o |
2 | obj-$(CONFIG_VMWARE_VMCI_VSOCKETS) += vmw_vsock_vmci_transport.o | 3 | obj-$(CONFIG_VMWARE_VMCI_VSOCKETS) += vmw_vsock_vmci_transport.o |
3 | obj-$(CONFIG_VIRTIO_VSOCKETS) += vmw_vsock_virtio_transport.o | 4 | obj-$(CONFIG_VIRTIO_VSOCKETS) += vmw_vsock_virtio_transport.o |
diff --git a/net/vmw_vsock/hyperv_transport.c b/net/vmw_vsock/hyperv_transport.c index 14ed5a344cdf..e21991fe883a 100644 --- a/net/vmw_vsock/hyperv_transport.c +++ b/net/vmw_vsock/hyperv_transport.c | |||
@@ -310,11 +310,15 @@ static void hvs_close_connection(struct vmbus_channel *chan) | |||
310 | struct sock *sk = get_per_channel_state(chan); | 310 | struct sock *sk = get_per_channel_state(chan); |
311 | struct vsock_sock *vsk = vsock_sk(sk); | 311 | struct vsock_sock *vsk = vsock_sk(sk); |
312 | 312 | ||
313 | lock_sock(sk); | ||
314 | |||
313 | sk->sk_state = SS_UNCONNECTED; | 315 | sk->sk_state = SS_UNCONNECTED; |
314 | sock_set_flag(sk, SOCK_DONE); | 316 | sock_set_flag(sk, SOCK_DONE); |
315 | vsk->peer_shutdown |= SEND_SHUTDOWN | RCV_SHUTDOWN; | 317 | vsk->peer_shutdown |= SEND_SHUTDOWN | RCV_SHUTDOWN; |
316 | 318 | ||
317 | sk->sk_state_change(sk); | 319 | sk->sk_state_change(sk); |
320 | |||
321 | release_sock(sk); | ||
318 | } | 322 | } |
319 | 323 | ||
320 | static void hvs_open_connection(struct vmbus_channel *chan) | 324 | static void hvs_open_connection(struct vmbus_channel *chan) |
@@ -344,6 +348,8 @@ static void hvs_open_connection(struct vmbus_channel *chan) | |||
344 | if (!sk) | 348 | if (!sk) |
345 | return; | 349 | return; |
346 | 350 | ||
351 | lock_sock(sk); | ||
352 | |||
347 | if ((conn_from_host && sk->sk_state != VSOCK_SS_LISTEN) || | 353 | if ((conn_from_host && sk->sk_state != VSOCK_SS_LISTEN) || |
348 | (!conn_from_host && sk->sk_state != SS_CONNECTING)) | 354 | (!conn_from_host && sk->sk_state != SS_CONNECTING)) |
349 | goto out; | 355 | goto out; |
@@ -395,9 +401,7 @@ static void hvs_open_connection(struct vmbus_channel *chan) | |||
395 | 401 | ||
396 | vsock_insert_connected(vnew); | 402 | vsock_insert_connected(vnew); |
397 | 403 | ||
398 | lock_sock(sk); | ||
399 | vsock_enqueue_accept(sk, new); | 404 | vsock_enqueue_accept(sk, new); |
400 | release_sock(sk); | ||
401 | } else { | 405 | } else { |
402 | sk->sk_state = SS_CONNECTED; | 406 | sk->sk_state = SS_CONNECTED; |
403 | sk->sk_socket->state = SS_CONNECTED; | 407 | sk->sk_socket->state = SS_CONNECTED; |
@@ -410,6 +414,8 @@ static void hvs_open_connection(struct vmbus_channel *chan) | |||
410 | out: | 414 | out: |
411 | /* Release refcnt obtained when we called vsock_find_bound_socket() */ | 415 | /* Release refcnt obtained when we called vsock_find_bound_socket() */ |
412 | sock_put(sk); | 416 | sock_put(sk); |
417 | |||
418 | release_sock(sk); | ||
413 | } | 419 | } |
414 | 420 | ||
415 | static u32 hvs_get_local_cid(void) | 421 | static u32 hvs_get_local_cid(void) |
@@ -476,13 +482,21 @@ out: | |||
476 | 482 | ||
477 | static void hvs_release(struct vsock_sock *vsk) | 483 | static void hvs_release(struct vsock_sock *vsk) |
478 | { | 484 | { |
485 | struct sock *sk = sk_vsock(vsk); | ||
479 | struct hvsock *hvs = vsk->trans; | 486 | struct hvsock *hvs = vsk->trans; |
480 | struct vmbus_channel *chan = hvs->chan; | 487 | struct vmbus_channel *chan; |
481 | 488 | ||
489 | lock_sock(sk); | ||
490 | |||
491 | sk->sk_state = SS_DISCONNECTING; | ||
492 | vsock_remove_sock(vsk); | ||
493 | |||
494 | release_sock(sk); | ||
495 | |||
496 | chan = hvs->chan; | ||
482 | if (chan) | 497 | if (chan) |
483 | hvs_shutdown(vsk, RCV_SHUTDOWN | SEND_SHUTDOWN); | 498 | hvs_shutdown(vsk, RCV_SHUTDOWN | SEND_SHUTDOWN); |
484 | 499 | ||
485 | vsock_remove_sock(vsk); | ||
486 | } | 500 | } |
487 | 501 | ||
488 | static void hvs_destruct(struct vsock_sock *vsk) | 502 | static void hvs_destruct(struct vsock_sock *vsk) |
diff --git a/net/wimax/Makefile b/net/wimax/Makefile index 8f1510d0cc2b..eb2db0d3b880 100644 --- a/net/wimax/Makefile +++ b/net/wimax/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | 2 | ||
2 | obj-$(CONFIG_WIMAX) += wimax.o | 3 | obj-$(CONFIG_WIMAX) += wimax.o |
3 | 4 | ||
diff --git a/net/wireless/Makefile b/net/wireless/Makefile index d06e5015751a..b7c0300e0b08 100644 --- a/net/wireless/Makefile +++ b/net/wireless/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | obj-$(CONFIG_CFG80211) += cfg80211.o | 2 | obj-$(CONFIG_CFG80211) += cfg80211.o |
2 | obj-$(CONFIG_LIB80211) += lib80211.o | 3 | obj-$(CONFIG_LIB80211) += lib80211.o |
3 | obj-$(CONFIG_LIB80211_CRYPT_WEP) += lib80211_crypt_wep.o | 4 | obj-$(CONFIG_LIB80211_CRYPT_WEP) += lib80211_crypt_wep.o |
diff --git a/net/wireless/ap.c b/net/wireless/ap.c index 25666d3009be..63682176c96c 100644 --- a/net/wireless/ap.c +++ b/net/wireless/ap.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/ieee80211.h> | 2 | #include <linux/ieee80211.h> |
2 | #include <linux/export.h> | 3 | #include <linux/export.h> |
3 | #include <net/cfg80211.h> | 4 | #include <net/cfg80211.h> |
diff --git a/net/wireless/chan.c b/net/wireless/chan.c index b8aa5a7d5c77..fad1b5baf8ff 100644 --- a/net/wireless/chan.c +++ b/net/wireless/chan.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * This file contains helper code to handle channel | 3 | * This file contains helper code to handle channel |
3 | * settings and keeping track of what is possible at | 4 | * settings and keeping track of what is possible at |
diff --git a/net/wireless/core.h b/net/wireless/core.h index 6e809325af3b..705835047f98 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Wireless configuration interface internals. | 3 | * Wireless configuration interface internals. |
3 | * | 4 | * |
diff --git a/net/wireless/debugfs.h b/net/wireless/debugfs.h index 74fdd3811427..a8a135d94ab5 100644 --- a/net/wireless/debugfs.h +++ b/net/wireless/debugfs.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef __CFG80211_DEBUGFS_H | 2 | #ifndef __CFG80211_DEBUGFS_H |
2 | #define __CFG80211_DEBUGFS_H | 3 | #define __CFG80211_DEBUGFS_H |
3 | 4 | ||
diff --git a/net/wireless/ethtool.c b/net/wireless/ethtool.c index e9e91298c70d..a9c0f368db5d 100644 --- a/net/wireless/ethtool.c +++ b/net/wireless/ethtool.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/utsname.h> | 2 | #include <linux/utsname.h> |
2 | #include <net/cfg80211.h> | 3 | #include <net/cfg80211.h> |
3 | #include "core.h" | 4 | #include "core.h" |
diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c index 10bf040a0982..413d4f4e6334 100644 --- a/net/wireless/ibss.c +++ b/net/wireless/ibss.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Some IBSS support code for cfg80211. | 3 | * Some IBSS support code for cfg80211. |
3 | * | 4 | * |
diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c index 421a6b80ec62..51aa55618ef7 100644 --- a/net/wireless/mesh.c +++ b/net/wireless/mesh.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/ieee80211.h> | 2 | #include <linux/ieee80211.h> |
2 | #include <linux/export.h> | 3 | #include <linux/export.h> |
3 | #include <net/cfg80211.h> | 4 | #include <net/cfg80211.h> |
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c index d8df7a5180a0..e7c64a8dce54 100644 --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * cfg80211 MLME SAP interface | 3 | * cfg80211 MLME SAP interface |
3 | * | 4 | * |
diff --git a/net/wireless/nl80211.h b/net/wireless/nl80211.h index b96933322077..fc415c8f7aac 100644 --- a/net/wireless/nl80211.h +++ b/net/wireless/nl80211.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef __NET_WIRELESS_NL80211_H | 2 | #ifndef __NET_WIRELESS_NL80211_H |
2 | #define __NET_WIRELESS_NL80211_H | 3 | #define __NET_WIRELESS_NL80211_H |
3 | 4 | ||
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h index ce23d7d49960..0c06240d25af 100644 --- a/net/wireless/rdev-ops.h +++ b/net/wireless/rdev-ops.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef __CFG80211_RDEV_OPS | 2 | #ifndef __CFG80211_RDEV_OPS |
2 | #define __CFG80211_RDEV_OPS | 3 | #define __CFG80211_RDEV_OPS |
3 | 4 | ||
diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 9f0901f3e42b..f6c5fe482506 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * cfg80211 scan result handling | 3 | * cfg80211 scan result handling |
3 | * | 4 | * |
diff --git a/net/wireless/sme.c b/net/wireless/sme.c index 0a49b88070d0..3dd05a08c60a 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * SME code for cfg80211 | 3 | * SME code for cfg80211 |
3 | * both driver SME event handling and the SME implementation | 4 | * both driver SME event handling and the SME implementation |
@@ -522,11 +523,6 @@ static int cfg80211_sme_connect(struct wireless_dev *wdev, | |||
522 | return -EOPNOTSUPP; | 523 | return -EOPNOTSUPP; |
523 | 524 | ||
524 | if (wdev->current_bss) { | 525 | if (wdev->current_bss) { |
525 | if (!prev_bssid) | ||
526 | return -EALREADY; | ||
527 | if (prev_bssid && | ||
528 | !ether_addr_equal(prev_bssid, wdev->current_bss->pub.bssid)) | ||
529 | return -ENOTCONN; | ||
530 | cfg80211_unhold_bss(wdev->current_bss); | 526 | cfg80211_unhold_bss(wdev->current_bss); |
531 | cfg80211_put_bss(wdev->wiphy, &wdev->current_bss->pub); | 527 | cfg80211_put_bss(wdev->wiphy, &wdev->current_bss->pub); |
532 | wdev->current_bss = NULL; | 528 | wdev->current_bss = NULL; |
@@ -1063,11 +1059,35 @@ int cfg80211_connect(struct cfg80211_registered_device *rdev, | |||
1063 | 1059 | ||
1064 | ASSERT_WDEV_LOCK(wdev); | 1060 | ASSERT_WDEV_LOCK(wdev); |
1065 | 1061 | ||
1066 | if (WARN_ON(wdev->connect_keys)) { | 1062 | /* |
1067 | kzfree(wdev->connect_keys); | 1063 | * If we have an ssid_len, we're trying to connect or are |
1068 | wdev->connect_keys = NULL; | 1064 | * already connected, so reject a new SSID unless it's the |
1065 | * same (which is the case for re-association.) | ||
1066 | */ | ||
1067 | if (wdev->ssid_len && | ||
1068 | (wdev->ssid_len != connect->ssid_len || | ||
1069 | memcmp(wdev->ssid, connect->ssid, wdev->ssid_len))) | ||
1070 | return -EALREADY; | ||
1071 | |||
1072 | /* | ||
1073 | * If connected, reject (re-)association unless prev_bssid | ||
1074 | * matches the current BSSID. | ||
1075 | */ | ||
1076 | if (wdev->current_bss) { | ||
1077 | if (!prev_bssid) | ||
1078 | return -EALREADY; | ||
1079 | if (!ether_addr_equal(prev_bssid, wdev->current_bss->pub.bssid)) | ||
1080 | return -ENOTCONN; | ||
1069 | } | 1081 | } |
1070 | 1082 | ||
1083 | /* | ||
1084 | * Reject if we're in the process of connecting with WEP, | ||
1085 | * this case isn't very interesting and trying to handle | ||
1086 | * it would make the code much more complex. | ||
1087 | */ | ||
1088 | if (wdev->connect_keys) | ||
1089 | return -EINPROGRESS; | ||
1090 | |||
1071 | cfg80211_oper_and_ht_capa(&connect->ht_capa_mask, | 1091 | cfg80211_oper_and_ht_capa(&connect->ht_capa_mask, |
1072 | rdev->wiphy.ht_capa_mod_mask); | 1092 | rdev->wiphy.ht_capa_mod_mask); |
1073 | 1093 | ||
@@ -1118,7 +1138,12 @@ int cfg80211_connect(struct cfg80211_registered_device *rdev, | |||
1118 | 1138 | ||
1119 | if (err) { | 1139 | if (err) { |
1120 | wdev->connect_keys = NULL; | 1140 | wdev->connect_keys = NULL; |
1121 | wdev->ssid_len = 0; | 1141 | /* |
1142 | * This could be reassoc getting refused, don't clear | ||
1143 | * ssid_len in that case. | ||
1144 | */ | ||
1145 | if (!wdev->current_bss) | ||
1146 | wdev->ssid_len = 0; | ||
1122 | return err; | 1147 | return err; |
1123 | } | 1148 | } |
1124 | 1149 | ||
@@ -1145,6 +1170,14 @@ int cfg80211_disconnect(struct cfg80211_registered_device *rdev, | |||
1145 | else if (wdev->ssid_len) | 1170 | else if (wdev->ssid_len) |
1146 | err = rdev_disconnect(rdev, dev, reason); | 1171 | err = rdev_disconnect(rdev, dev, reason); |
1147 | 1172 | ||
1173 | /* | ||
1174 | * Clear ssid_len unless we actually were fully connected, | ||
1175 | * in which case cfg80211_disconnected() will take care of | ||
1176 | * this later. | ||
1177 | */ | ||
1178 | if (!wdev->current_bss) | ||
1179 | wdev->ssid_len = 0; | ||
1180 | |||
1148 | return err; | 1181 | return err; |
1149 | } | 1182 | } |
1150 | 1183 | ||
diff --git a/net/wireless/sysfs.h b/net/wireless/sysfs.h index b533ed71daff..7b454c2de9b7 100644 --- a/net/wireless/sysfs.h +++ b/net/wireless/sysfs.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef __WIRELESS_SYSFS_H | 2 | #ifndef __WIRELESS_SYSFS_H |
2 | #define __WIRELESS_SYSFS_H | 3 | #define __WIRELESS_SYSFS_H |
3 | 4 | ||
diff --git a/net/wireless/trace.h b/net/wireless/trace.h index 0f8db41eaddb..f3353fe5b35b 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #undef TRACE_SYSTEM | 2 | #undef TRACE_SYSTEM |
2 | #define TRACE_SYSTEM cfg80211 | 3 | #define TRACE_SYSTEM cfg80211 |
3 | 4 | ||
diff --git a/net/wireless/util.c b/net/wireless/util.c index bcb1284c3415..c1238d582fd1 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Wireless utility functions | 3 | * Wireless utility functions |
3 | * | 4 | * |
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c index 5d4a02c7979b..7ca04a7de85a 100644 --- a/net/wireless/wext-compat.c +++ b/net/wireless/wext-compat.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * cfg80211 - wext compat code | 3 | * cfg80211 - wext compat code |
3 | * | 4 | * |
diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c index c434f193f39a..c67d7a82ab13 100644 --- a/net/wireless/wext-sme.c +++ b/net/wireless/wext-sme.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * cfg80211 wext compat for managed mode. | 3 | * cfg80211 wext compat for managed mode. |
3 | * | 4 | * |
diff --git a/net/x25/Makefile b/net/x25/Makefile index a2c34ab6f194..5dd544a231f2 100644 --- a/net/x25/Makefile +++ b/net/x25/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the Linux X.25 Packet layer. | 3 | # Makefile for the Linux X.25 Packet layer. |
3 | # | 4 | # |
diff --git a/net/x25/sysctl_net_x25.c b/net/x25/sysctl_net_x25.c index ba078c85f0a1..e9802afa43d0 100644 --- a/net/x25/sysctl_net_x25.c +++ b/net/x25/sysctl_net_x25.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* -*- linux-c -*- | 2 | /* -*- linux-c -*- |
2 | * sysctl_net_x25.c: sysctl interface to net X.25 subsystem. | 3 | * sysctl_net_x25.c: sysctl interface to net X.25 subsystem. |
3 | * | 4 | * |
diff --git a/net/xfrm/Makefile b/net/xfrm/Makefile index 55b2ac300995..0bd2465a8c5a 100644 --- a/net/xfrm/Makefile +++ b/net/xfrm/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the XFRM subsystem. | 3 | # Makefile for the XFRM subsystem. |
3 | # | 4 | # |
diff --git a/net/xfrm/xfrm_hash.c b/net/xfrm/xfrm_hash.c index 1e98bc0fe0a5..2ad33ce1ea17 100644 --- a/net/xfrm/xfrm_hash.c +++ b/net/xfrm/xfrm_hash.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* xfrm_hash.c: Common hash table code. | 2 | /* xfrm_hash.c: Common hash table code. |
2 | * | 3 | * |
3 | * Copyright (C) 2006 David S. Miller (davem@davemloft.net) | 4 | * Copyright (C) 2006 David S. Miller (davem@davemloft.net) |
diff --git a/net/xfrm/xfrm_hash.h b/net/xfrm/xfrm_hash.h index eaea9c4fb3b0..61be810389d8 100644 --- a/net/xfrm/xfrm_hash.h +++ b/net/xfrm/xfrm_hash.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef _XFRM_HASH_H | 2 | #ifndef _XFRM_HASH_H |
2 | #define _XFRM_HASH_H | 3 | #define _XFRM_HASH_H |
3 | 4 | ||
diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c index 8ac9d32fb79d..82d20ee34581 100644 --- a/net/xfrm/xfrm_input.c +++ b/net/xfrm/xfrm_input.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * xfrm_input.c | 3 | * xfrm_input.c |
3 | * | 4 | * |
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c index 31a2e6d34dba..73ad8c8ef344 100644 --- a/net/xfrm/xfrm_output.c +++ b/net/xfrm/xfrm_output.c | |||
@@ -105,6 +105,9 @@ static int xfrm_output_one(struct sk_buff *skb, int err) | |||
105 | if (xfrm_offload(skb)) { | 105 | if (xfrm_offload(skb)) { |
106 | x->type_offload->encap(x, skb); | 106 | x->type_offload->encap(x, skb); |
107 | } else { | 107 | } else { |
108 | /* Inner headers are invalid now. */ | ||
109 | skb->encapsulation = 0; | ||
110 | |||
108 | err = x->type->output(x, skb); | 111 | err = x->type->output(x, skb); |
109 | if (err == -EINPROGRESS) | 112 | if (err == -EINPROGRESS) |
110 | goto out; | 113 | goto out; |
@@ -208,7 +211,6 @@ int xfrm_output(struct sock *sk, struct sk_buff *skb) | |||
208 | int err; | 211 | int err; |
209 | 212 | ||
210 | secpath_reset(skb); | 213 | secpath_reset(skb); |
211 | skb->encapsulation = 0; | ||
212 | 214 | ||
213 | if (xfrm_dev_offload_ok(skb, x)) { | 215 | if (xfrm_dev_offload_ok(skb, x)) { |
214 | struct sec_path *sp; | 216 | struct sec_path *sp; |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index f06253969972..8cafb3c0a4ac 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -1573,6 +1573,14 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy, | |||
1573 | goto put_states; | 1573 | goto put_states; |
1574 | } | 1574 | } |
1575 | 1575 | ||
1576 | if (!dst_prev) | ||
1577 | dst0 = dst1; | ||
1578 | else | ||
1579 | /* Ref count is taken during xfrm_alloc_dst() | ||
1580 | * No need to do dst_clone() on dst1 | ||
1581 | */ | ||
1582 | dst_prev->child = dst1; | ||
1583 | |||
1576 | if (xfrm[i]->sel.family == AF_UNSPEC) { | 1584 | if (xfrm[i]->sel.family == AF_UNSPEC) { |
1577 | inner_mode = xfrm_ip2inner_mode(xfrm[i], | 1585 | inner_mode = xfrm_ip2inner_mode(xfrm[i], |
1578 | xfrm_af2proto(family)); | 1586 | xfrm_af2proto(family)); |
@@ -1584,14 +1592,6 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy, | |||
1584 | } else | 1592 | } else |
1585 | inner_mode = xfrm[i]->inner_mode; | 1593 | inner_mode = xfrm[i]->inner_mode; |
1586 | 1594 | ||
1587 | if (!dst_prev) | ||
1588 | dst0 = dst1; | ||
1589 | else | ||
1590 | /* Ref count is taken during xfrm_alloc_dst() | ||
1591 | * No need to do dst_clone() on dst1 | ||
1592 | */ | ||
1593 | dst_prev->child = dst1; | ||
1594 | |||
1595 | xdst->route = dst; | 1595 | xdst->route = dst; |
1596 | dst_copy_metrics(dst1, dst); | 1596 | dst_copy_metrics(dst1, dst); |
1597 | 1597 | ||
@@ -2076,7 +2076,6 @@ make_dummy_bundle: | |||
2076 | xdst->num_xfrms = num_xfrms; | 2076 | xdst->num_xfrms = num_xfrms; |
2077 | memcpy(xdst->pols, pols, sizeof(struct xfrm_policy *) * num_pols); | 2077 | memcpy(xdst->pols, pols, sizeof(struct xfrm_policy *) * num_pols); |
2078 | 2078 | ||
2079 | dst_hold(&xdst->u.dst); | ||
2080 | return xdst; | 2079 | return xdst; |
2081 | 2080 | ||
2082 | inc_error: | 2081 | inc_error: |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 12213477cd3a..1f5cee2269af 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -2069,6 +2069,7 @@ int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen | |||
2069 | if (err >= 0) { | 2069 | if (err >= 0) { |
2070 | xfrm_sk_policy_insert(sk, err, pol); | 2070 | xfrm_sk_policy_insert(sk, err, pol); |
2071 | xfrm_pol_put(pol); | 2071 | xfrm_pol_put(pol); |
2072 | __sk_dst_reset(sk); | ||
2072 | err = 0; | 2073 | err = 0; |
2073 | } | 2074 | } |
2074 | 2075 | ||
diff --git a/net/xfrm/xfrm_sysctl.c b/net/xfrm/xfrm_sysctl.c index 35a7e794ad04..0c6c5ef65f9d 100644 --- a/net/xfrm/xfrm_sysctl.c +++ b/net/xfrm/xfrm_sysctl.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/sysctl.h> | 2 | #include <linux/sysctl.h> |
2 | #include <linux/slab.h> | 3 | #include <linux/slab.h> |
3 | #include <net/net_namespace.h> | 4 | #include <net/net_namespace.h> |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index b997f1395357..e44a0fed48dd 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -1693,32 +1693,34 @@ static int dump_one_policy(struct xfrm_policy *xp, int dir, int count, void *ptr | |||
1693 | 1693 | ||
1694 | static int xfrm_dump_policy_done(struct netlink_callback *cb) | 1694 | static int xfrm_dump_policy_done(struct netlink_callback *cb) |
1695 | { | 1695 | { |
1696 | struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *) &cb->args[1]; | 1696 | struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *)cb->args; |
1697 | struct net *net = sock_net(cb->skb->sk); | 1697 | struct net *net = sock_net(cb->skb->sk); |
1698 | 1698 | ||
1699 | xfrm_policy_walk_done(walk, net); | 1699 | xfrm_policy_walk_done(walk, net); |
1700 | return 0; | 1700 | return 0; |
1701 | } | 1701 | } |
1702 | 1702 | ||
1703 | static int xfrm_dump_policy_start(struct netlink_callback *cb) | ||
1704 | { | ||
1705 | struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *)cb->args; | ||
1706 | |||
1707 | BUILD_BUG_ON(sizeof(*walk) > sizeof(cb->args)); | ||
1708 | |||
1709 | xfrm_policy_walk_init(walk, XFRM_POLICY_TYPE_ANY); | ||
1710 | return 0; | ||
1711 | } | ||
1712 | |||
1703 | static int xfrm_dump_policy(struct sk_buff *skb, struct netlink_callback *cb) | 1713 | static int xfrm_dump_policy(struct sk_buff *skb, struct netlink_callback *cb) |
1704 | { | 1714 | { |
1705 | struct net *net = sock_net(skb->sk); | 1715 | struct net *net = sock_net(skb->sk); |
1706 | struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *) &cb->args[1]; | 1716 | struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *)cb->args; |
1707 | struct xfrm_dump_info info; | 1717 | struct xfrm_dump_info info; |
1708 | 1718 | ||
1709 | BUILD_BUG_ON(sizeof(struct xfrm_policy_walk) > | ||
1710 | sizeof(cb->args) - sizeof(cb->args[0])); | ||
1711 | |||
1712 | info.in_skb = cb->skb; | 1719 | info.in_skb = cb->skb; |
1713 | info.out_skb = skb; | 1720 | info.out_skb = skb; |
1714 | info.nlmsg_seq = cb->nlh->nlmsg_seq; | 1721 | info.nlmsg_seq = cb->nlh->nlmsg_seq; |
1715 | info.nlmsg_flags = NLM_F_MULTI; | 1722 | info.nlmsg_flags = NLM_F_MULTI; |
1716 | 1723 | ||
1717 | if (!cb->args[0]) { | ||
1718 | cb->args[0] = 1; | ||
1719 | xfrm_policy_walk_init(walk, XFRM_POLICY_TYPE_ANY); | ||
1720 | } | ||
1721 | |||
1722 | (void) xfrm_policy_walk(net, walk, dump_one_policy, &info); | 1724 | (void) xfrm_policy_walk(net, walk, dump_one_policy, &info); |
1723 | 1725 | ||
1724 | return skb->len; | 1726 | return skb->len; |
@@ -2474,6 +2476,7 @@ static const struct nla_policy xfrma_spd_policy[XFRMA_SPD_MAX+1] = { | |||
2474 | 2476 | ||
2475 | static const struct xfrm_link { | 2477 | static const struct xfrm_link { |
2476 | int (*doit)(struct sk_buff *, struct nlmsghdr *, struct nlattr **); | 2478 | int (*doit)(struct sk_buff *, struct nlmsghdr *, struct nlattr **); |
2479 | int (*start)(struct netlink_callback *); | ||
2477 | int (*dump)(struct sk_buff *, struct netlink_callback *); | 2480 | int (*dump)(struct sk_buff *, struct netlink_callback *); |
2478 | int (*done)(struct netlink_callback *); | 2481 | int (*done)(struct netlink_callback *); |
2479 | const struct nla_policy *nla_pol; | 2482 | const struct nla_policy *nla_pol; |
@@ -2487,6 +2490,7 @@ static const struct xfrm_link { | |||
2487 | [XFRM_MSG_NEWPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_add_policy }, | 2490 | [XFRM_MSG_NEWPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_add_policy }, |
2488 | [XFRM_MSG_DELPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_get_policy }, | 2491 | [XFRM_MSG_DELPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_get_policy }, |
2489 | [XFRM_MSG_GETPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_get_policy, | 2492 | [XFRM_MSG_GETPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_get_policy, |
2493 | .start = xfrm_dump_policy_start, | ||
2490 | .dump = xfrm_dump_policy, | 2494 | .dump = xfrm_dump_policy, |
2491 | .done = xfrm_dump_policy_done }, | 2495 | .done = xfrm_dump_policy_done }, |
2492 | [XFRM_MSG_ALLOCSPI - XFRM_MSG_BASE] = { .doit = xfrm_alloc_userspi }, | 2496 | [XFRM_MSG_ALLOCSPI - XFRM_MSG_BASE] = { .doit = xfrm_alloc_userspi }, |
@@ -2539,6 +2543,7 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
2539 | 2543 | ||
2540 | { | 2544 | { |
2541 | struct netlink_dump_control c = { | 2545 | struct netlink_dump_control c = { |
2546 | .start = link->start, | ||
2542 | .dump = link->dump, | 2547 | .dump = link->dump, |
2543 | .done = link->done, | 2548 | .done = link->done, |
2544 | }; | 2549 | }; |