aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CREDITS20
-rw-r--r--Documentation/admin-guide/README.rst32
-rw-r--r--Documentation/networking/msg_zerocopy.rst2
-rw-r--r--Documentation/process/applying-patches.rst117
-rw-r--r--Documentation/translations/it_IT/admin-guide/README.rst2
-rw-r--r--MAINTAINERS5
-rw-r--r--arch/arc/Kconfig20
-rw-r--r--arch/arc/configs/nps_defconfig1
-rw-r--r--arch/arc/configs/vdk_hs38_defconfig1
-rw-r--r--arch/arc/configs/vdk_hs38_smp_defconfig2
-rw-r--r--arch/arc/include/asm/arcregs.h8
-rw-r--r--arch/arc/include/asm/cache.h11
-rw-r--r--arch/arc/include/asm/entry-arcv2.h54
-rw-r--r--arch/arc/include/asm/uaccess.h8
-rw-r--r--arch/arc/kernel/entry-arcv2.S4
-rw-r--r--arch/arc/kernel/head.S16
-rw-r--r--arch/arc/kernel/intc-arcv2.c2
-rw-r--r--arch/arc/kernel/setup.c119
-rw-r--r--arch/arc/lib/memcpy-archs.S14
-rw-r--r--arch/arc/plat-hsdk/Kconfig1
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/boot/dts/am335x-evm.dts2
-rw-r--r--arch/arm/boot/dts/am335x-evmsk.dts4
-rw-r--r--arch/arm/boot/dts/armada-xp-db.dts46
-rw-r--r--arch/arm/boot/dts/armada-xp-gp.dts13
-rw-r--r--arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts85
-rw-r--r--arch/arm/boot/dts/tegra124-nyan.dtsi17
-rw-r--r--arch/arm/include/asm/irq.h1
-rw-r--r--arch/arm/kernel/irq.c62
-rw-r--r--arch/arm/kernel/smp.c2
-rw-r--r--arch/arm/mm/dma-mapping.c2
-rw-r--r--arch/arm/probes/kprobes/opt-arm.c2
-rw-r--r--arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts2
-rw-r--r--arch/arm64/include/asm/neon-intrinsics.h4
-rw-r--r--arch/arm64/kernel/head.S3
-rw-r--r--arch/arm64/kernel/ptrace.c15
-rw-r--r--arch/arm64/kernel/setup.c3
-rw-r--r--arch/arm64/mm/kasan_init.c2
-rw-r--r--arch/mips/net/ebpf_jit.c24
-rw-r--r--arch/parisc/kernel/ptrace.c29
-rw-r--r--arch/sh/boot/dts/Makefile2
-rw-r--r--crypto/af_alg.c4
-rw-r--r--drivers/clk/at91/at91sam9x5.c5
-rw-r--r--drivers/clk/at91/sama5d2.c4
-rw-r--r--drivers/clk/at91/sama5d4.c2
-rw-r--r--drivers/clk/sunxi-ng/ccu-sun6i-a31.c4
-rw-r--r--drivers/clk/sunxi-ng/ccu-sun8i-v3s.c2
-rw-r--r--drivers/gpio/gpio-mt7621.c20
-rw-r--r--drivers/gpio/gpio-pxa.c1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c4
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c5
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c11
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce100/dce100_hw_sequencer.h4
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce80/dce80_hw_sequencer.c2
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c19
-rw-r--r--drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c4
-rw-r--r--drivers/gpu/drm/i915/intel_fbdev.c12
-rw-r--r--drivers/gpu/drm/radeon/radeon_kms.c1
-rw-r--r--drivers/infiniband/hw/cxgb4/device.c15
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c10
-rw-r--r--drivers/mailbox/bcm-flexrm-mailbox.c4
-rw-r--r--drivers/mailbox/mailbox.c1
-rw-r--r--drivers/mtd/devices/powernv_flash.c2
-rw-r--r--drivers/mtd/mtdcore.c1
-rw-r--r--drivers/net/dsa/b53/b53_common.c90
-rw-r--r--drivers/net/dsa/b53/b53_priv.h3
-rw-r--r--drivers/net/dsa/bcm_sf2.c10
-rw-r--r--drivers/net/ethernet/broadcom/bcmsysport.c4
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c1
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h1
-rw-r--r--drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c3
-rw-r--r--drivers/net/ethernet/marvell/mv643xx_eth.c7
-rw-r--r--drivers/net/ethernet/marvell/sky2.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_netdev.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum.c12
-rw-r--r--drivers/net/ethernet/qlogic/qed/qed_iwarp.c21
-rw-r--r--drivers/net/ethernet/qlogic/qed/qed_iwarp.h1
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c9
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c22
-rw-r--r--drivers/net/ethernet/ti/netcp_core.c2
-rw-r--r--drivers/net/phy/xilinx_gmii2rgmii.c5
-rw-r--r--drivers/net/usb/qmi_wwan.c4
-rw-r--r--drivers/net/usb/r8152.c5
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x0/usb.c46
-rw-r--r--drivers/pinctrl/meson/pinctrl-meson8b.c2
-rw-r--r--drivers/pinctrl/qcom/pinctrl-qcs404.c2
-rw-r--r--drivers/vhost/vhost.c2
-rw-r--r--fs/binfmt_script.c57
-rw-r--r--fs/ceph/snap.c3
-rw-r--r--fs/nfs/nfs4idmap.c31
-rw-r--r--fs/proc/base.c4
-rw-r--r--include/keys/request_key_auth-type.h36
-rw-r--r--include/linux/key-type.h22
-rw-r--r--include/linux/netdev_features.h24
-rw-r--r--include/linux/skbuff.h8
-rw-r--r--include/linux/virtio_net.h9
-rw-r--r--init/initramfs.c6
-rw-r--r--kernel/bpf/stackmap.c8
-rw-r--r--kernel/bpf/verifier.c11
-rw-r--r--kernel/sched/psi.c2
-rw-r--r--kernel/trace/trace.c2
-rw-r--r--kernel/trace/trace_kprobe.c10
-rw-r--r--lib/assoc_array.c8
-rw-r--r--mm/debug.c4
-rw-r--r--mm/kasan/Makefile2
-rw-r--r--mm/kasan/common.c29
-rw-r--r--mm/kasan/tags.c2
-rw-r--r--mm/kmemleak.c10
-rw-r--r--mm/memory_hotplug.c27
-rw-r--r--mm/mempolicy.c6
-rw-r--r--mm/page_alloc.c20
-rw-r--r--mm/shmem.c10
-rw-r--r--mm/slab.c15
-rw-r--r--mm/slab.h7
-rw-r--r--mm/slab_common.c3
-rw-r--r--mm/slub.c59
-rw-r--r--mm/swap.c17
-rw-r--r--mm/util.c2
-rw-r--r--net/ceph/messenger.c15
-rw-r--r--net/core/dev.c4
-rw-r--r--net/core/filter.c12
-rw-r--r--net/core/skbuff.c4
-rw-r--r--net/ipv4/tcp.c2
-rw-r--r--net/ipv4/tcp_ipv4.c5
-rw-r--r--net/ipv6/ip6_gre.c34
-rw-r--r--net/mac80211/cfg.c6
-rw-r--r--net/mac80211/mesh.h6
-rw-r--r--net/mac80211/mesh_pathtbl.c157
-rw-r--r--net/netfilter/ipvs/ip_vs_ctl.c3
-rw-r--r--net/netfilter/nf_tables_api.c3
-rw-r--r--net/xdp/xdp_umem.c11
-rw-r--r--net/xdp/xsk.c4
-rw-r--r--scripts/kallsyms.c4
-rw-r--r--security/keys/internal.h13
-rw-r--r--security/keys/key.c5
-rw-r--r--security/keys/keyctl.c1
-rw-r--r--security/keys/process_keys.c1
-rw-r--r--security/keys/request_key.c72
-rw-r--r--security/keys/request_key_auth.c16
-rw-r--r--sound/pci/hda/patch_realtek.c42
-rw-r--r--sound/soc/generic/simple-card.c2
-rw-r--r--sound/soc/samsung/i2s.c8
-rw-r--r--sound/soc/soc-topology.c8
145 files changed, 1224 insertions, 824 deletions
diff --git a/CREDITS b/CREDITS
index e818eb6a3e71..0175098d4776 100644
--- a/CREDITS
+++ b/CREDITS
@@ -842,10 +842,9 @@ D: ax25-utils maintainer.
842 842
843N: Helge Deller 843N: Helge Deller
844E: deller@gmx.de 844E: deller@gmx.de
845E: hdeller@redhat.de 845W: http://www.parisc-linux.org/
846D: PA-RISC Linux hacker, LASI-, ASP-, WAX-, LCD/LED-driver 846D: PA-RISC Linux architecture maintainer
847S: Schimmelsrain 1 847D: LASI-, ASP-, WAX-, LCD/LED-driver
848S: D-69231 Rauenberg
849S: Germany 848S: Germany
850 849
851N: Jean Delvare 850N: Jean Delvare
@@ -1361,7 +1360,7 @@ S: Stellenbosch, Western Cape
1361S: South Africa 1360S: South Africa
1362 1361
1363N: Grant Grundler 1362N: Grant Grundler
1364E: grundler@parisc-linux.org 1363E: grantgrundler@gmail.com
1365W: http://obmouse.sourceforge.net/ 1364W: http://obmouse.sourceforge.net/
1366W: http://www.parisc-linux.org/ 1365W: http://www.parisc-linux.org/
1367D: obmouse - rewrote Olivier Florent's Omnibook 600 "pop-up" mouse driver 1366D: obmouse - rewrote Olivier Florent's Omnibook 600 "pop-up" mouse driver
@@ -2492,7 +2491,7 @@ S: Syracuse, New York 13206
2492S: USA 2491S: USA
2493 2492
2494N: Kyle McMartin 2493N: Kyle McMartin
2495E: kyle@parisc-linux.org 2494E: kyle@mcmartin.ca
2496D: Linux/PARISC hacker 2495D: Linux/PARISC hacker
2497D: AD1889 sound driver 2496D: AD1889 sound driver
2498S: Ottawa, Canada 2497S: Ottawa, Canada
@@ -3780,14 +3779,13 @@ S: 21513 Conradia Ct
3780S: Cupertino, CA 95014 3779S: Cupertino, CA 95014
3781S: USA 3780S: USA
3782 3781
3783N: Thibaut Varene 3782N: Thibaut Varène
3784E: T-Bone@parisc-linux.org 3783E: hacks+kernel@slashdirt.org
3785W: http://www.parisc-linux.org/~varenet/ 3784W: http://hacks.slashdirt.org/
3786P: 1024D/B7D2F063 E67C 0D43 A75E 12A5 BB1C FA2F 1E32 C3DA B7D2 F063
3787D: PA-RISC port minion, PDC and GSCPS2 drivers, debuglocks and other bits 3785D: PA-RISC port minion, PDC and GSCPS2 drivers, debuglocks and other bits
3788D: Some ARM at91rm9200 bits, S1D13XXX FB driver, random patches here and there 3786D: Some ARM at91rm9200 bits, S1D13XXX FB driver, random patches here and there
3789D: AD1889 sound driver 3787D: AD1889 sound driver
3790S: Paris, France 3788S: France
3791 3789
3792N: Heikki Vatiainen 3790N: Heikki Vatiainen
3793E: hessu@cs.tut.fi 3791E: hessu@cs.tut.fi
diff --git a/Documentation/admin-guide/README.rst b/Documentation/admin-guide/README.rst
index 0797eec76be1..47e577264198 100644
--- a/Documentation/admin-guide/README.rst
+++ b/Documentation/admin-guide/README.rst
@@ -1,9 +1,9 @@
1.. _readme: 1.. _readme:
2 2
3Linux kernel release 4.x <http://kernel.org/> 3Linux kernel release 5.x <http://kernel.org/>
4============================================= 4=============================================
5 5
6These are the release notes for Linux version 4. Read them carefully, 6These are the release notes for Linux version 5. Read them carefully,
7as they tell you what this is all about, explain how to install the 7as they tell you what this is all about, explain how to install the
8kernel, and what to do if something goes wrong. 8kernel, and what to do if something goes wrong.
9 9
@@ -63,7 +63,7 @@ Installing the kernel source
63 directory where you have permissions (e.g. your home directory) and 63 directory where you have permissions (e.g. your home directory) and
64 unpack it:: 64 unpack it::
65 65
66 xz -cd linux-4.X.tar.xz | tar xvf - 66 xz -cd linux-5.x.tar.xz | tar xvf -
67 67
68 Replace "X" with the version number of the latest kernel. 68 Replace "X" with the version number of the latest kernel.
69 69
@@ -72,26 +72,26 @@ Installing the kernel source
72 files. They should match the library, and not get messed up by 72 files. They should match the library, and not get messed up by
73 whatever the kernel-du-jour happens to be. 73 whatever the kernel-du-jour happens to be.
74 74
75 - You can also upgrade between 4.x releases by patching. Patches are 75 - You can also upgrade between 5.x releases by patching. Patches are
76 distributed in the xz format. To install by patching, get all the 76 distributed in the xz format. To install by patching, get all the
77 newer patch files, enter the top level directory of the kernel source 77 newer patch files, enter the top level directory of the kernel source
78 (linux-4.X) and execute:: 78 (linux-5.x) and execute::
79 79
80 xz -cd ../patch-4.x.xz | patch -p1 80 xz -cd ../patch-5.x.xz | patch -p1
81 81
82 Replace "x" for all versions bigger than the version "X" of your current 82 Replace "x" for all versions bigger than the version "x" of your current
83 source tree, **in_order**, and you should be ok. You may want to remove 83 source tree, **in_order**, and you should be ok. You may want to remove
84 the backup files (some-file-name~ or some-file-name.orig), and make sure 84 the backup files (some-file-name~ or some-file-name.orig), and make sure
85 that there are no failed patches (some-file-name# or some-file-name.rej). 85 that there are no failed patches (some-file-name# or some-file-name.rej).
86 If there are, either you or I have made a mistake. 86 If there are, either you or I have made a mistake.
87 87
88 Unlike patches for the 4.x kernels, patches for the 4.x.y kernels 88 Unlike patches for the 5.x kernels, patches for the 5.x.y kernels
89 (also known as the -stable kernels) are not incremental but instead apply 89 (also known as the -stable kernels) are not incremental but instead apply
90 directly to the base 4.x kernel. For example, if your base kernel is 4.0 90 directly to the base 5.x kernel. For example, if your base kernel is 5.0
91 and you want to apply the 4.0.3 patch, you must not first apply the 4.0.1 91 and you want to apply the 5.0.3 patch, you must not first apply the 5.0.1
92 and 4.0.2 patches. Similarly, if you are running kernel version 4.0.2 and 92 and 5.0.2 patches. Similarly, if you are running kernel version 5.0.2 and
93 want to jump to 4.0.3, you must first reverse the 4.0.2 patch (that is, 93 want to jump to 5.0.3, you must first reverse the 5.0.2 patch (that is,
94 patch -R) **before** applying the 4.0.3 patch. You can read more on this in 94 patch -R) **before** applying the 5.0.3 patch. You can read more on this in
95 :ref:`Documentation/process/applying-patches.rst <applying_patches>`. 95 :ref:`Documentation/process/applying-patches.rst <applying_patches>`.
96 96
97 Alternatively, the script patch-kernel can be used to automate this 97 Alternatively, the script patch-kernel can be used to automate this
@@ -114,7 +114,7 @@ Installing the kernel source
114Software requirements 114Software requirements
115--------------------- 115---------------------
116 116
117 Compiling and running the 4.x kernels requires up-to-date 117 Compiling and running the 5.x kernels requires up-to-date
118 versions of various software packages. Consult 118 versions of various software packages. Consult
119 :ref:`Documentation/process/changes.rst <changes>` for the minimum version numbers 119 :ref:`Documentation/process/changes.rst <changes>` for the minimum version numbers
120 required and how to get updates for these packages. Beware that using 120 required and how to get updates for these packages. Beware that using
@@ -132,12 +132,12 @@ Build directory for the kernel
132 place for the output files (including .config). 132 place for the output files (including .config).
133 Example:: 133 Example::
134 134
135 kernel source code: /usr/src/linux-4.X 135 kernel source code: /usr/src/linux-5.x
136 build directory: /home/name/build/kernel 136 build directory: /home/name/build/kernel
137 137
138 To configure and build the kernel, use:: 138 To configure and build the kernel, use::
139 139
140 cd /usr/src/linux-4.X 140 cd /usr/src/linux-5.x
141 make O=/home/name/build/kernel menuconfig 141 make O=/home/name/build/kernel menuconfig
142 make O=/home/name/build/kernel 142 make O=/home/name/build/kernel
143 sudo make O=/home/name/build/kernel modules_install install 143 sudo make O=/home/name/build/kernel modules_install install
diff --git a/Documentation/networking/msg_zerocopy.rst b/Documentation/networking/msg_zerocopy.rst
index fe46d4867e2d..18c1415e7bfa 100644
--- a/Documentation/networking/msg_zerocopy.rst
+++ b/Documentation/networking/msg_zerocopy.rst
@@ -7,7 +7,7 @@ Intro
7===== 7=====
8 8
9The MSG_ZEROCOPY flag enables copy avoidance for socket send calls. 9The MSG_ZEROCOPY flag enables copy avoidance for socket send calls.
10The feature is currently implemented for TCP sockets. 10The feature is currently implemented for TCP and UDP sockets.
11 11
12 12
13Opportunity and Caveats 13Opportunity and Caveats
diff --git a/Documentation/process/applying-patches.rst b/Documentation/process/applying-patches.rst
index dc2ddc345044..fbb9297e6360 100644
--- a/Documentation/process/applying-patches.rst
+++ b/Documentation/process/applying-patches.rst
@@ -216,14 +216,14 @@ You can use the ``interdiff`` program (http://cyberelk.net/tim/patchutils/) to
216generate a patch representing the differences between two patches and then 216generate a patch representing the differences between two patches and then
217apply the result. 217apply the result.
218 218
219This will let you move from something like 4.7.2 to 4.7.3 in a single 219This will let you move from something like 5.7.2 to 5.7.3 in a single
220step. The -z flag to interdiff will even let you feed it patches in gzip or 220step. The -z flag to interdiff will even let you feed it patches in gzip or
221bzip2 compressed form directly without the use of zcat or bzcat or manual 221bzip2 compressed form directly without the use of zcat or bzcat or manual
222decompression. 222decompression.
223 223
224Here's how you'd go from 4.7.2 to 4.7.3 in a single step:: 224Here's how you'd go from 5.7.2 to 5.7.3 in a single step::
225 225
226 interdiff -z ../patch-4.7.2.gz ../patch-4.7.3.gz | patch -p1 226 interdiff -z ../patch-5.7.2.gz ../patch-5.7.3.gz | patch -p1
227 227
228Although interdiff may save you a step or two you are generally advised to 228Although interdiff may save you a step or two you are generally advised to
229do the additional steps since interdiff can get things wrong in some cases. 229do the additional steps since interdiff can get things wrong in some cases.
@@ -245,62 +245,67 @@ The patches are available at http://kernel.org/
245Most recent patches are linked from the front page, but they also have 245Most recent patches are linked from the front page, but they also have
246specific homes. 246specific homes.
247 247
248The 4.x.y (-stable) and 4.x patches live at 248The 5.x.y (-stable) and 5.x patches live at
249 249
250 https://www.kernel.org/pub/linux/kernel/v4.x/ 250 https://www.kernel.org/pub/linux/kernel/v5.x/
251 251
252The -rc patches live at 252The -rc patches are not stored on the webserver but are generated on
253demand from git tags such as
253 254
254 https://www.kernel.org/pub/linux/kernel/v4.x/testing/ 255 https://git.kernel.org/torvalds/p/v5.1-rc1/v5.0
255 256
257The stable -rc patches live at
256 258
257The 4.x kernels 259 https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/
260
261
262The 5.x kernels
258=============== 263===============
259 264
260These are the base stable releases released by Linus. The highest numbered 265These are the base stable releases released by Linus. The highest numbered
261release is the most recent. 266release is the most recent.
262 267
263If regressions or other serious flaws are found, then a -stable fix patch 268If regressions or other serious flaws are found, then a -stable fix patch
264will be released (see below) on top of this base. Once a new 4.x base 269will be released (see below) on top of this base. Once a new 5.x base
265kernel is released, a patch is made available that is a delta between the 270kernel is released, a patch is made available that is a delta between the
266previous 4.x kernel and the new one. 271previous 5.x kernel and the new one.
267 272
268To apply a patch moving from 4.6 to 4.7, you'd do the following (note 273To apply a patch moving from 5.6 to 5.7, you'd do the following (note
269that such patches do **NOT** apply on top of 4.x.y kernels but on top of the 274that such patches do **NOT** apply on top of 5.x.y kernels but on top of the
270base 4.x kernel -- if you need to move from 4.x.y to 4.x+1 you need to 275base 5.x kernel -- if you need to move from 5.x.y to 5.x+1 you need to
271first revert the 4.x.y patch). 276first revert the 5.x.y patch).
272 277
273Here are some examples:: 278Here are some examples::
274 279
275 # moving from 4.6 to 4.7 280 # moving from 5.6 to 5.7
276 281
277 $ cd ~/linux-4.6 # change to kernel source dir 282 $ cd ~/linux-5.6 # change to kernel source dir
278 $ patch -p1 < ../patch-4.7 # apply the 4.7 patch 283 $ patch -p1 < ../patch-5.7 # apply the 5.7 patch
279 $ cd .. 284 $ cd ..
280 $ mv linux-4.6 linux-4.7 # rename source dir 285 $ mv linux-5.6 linux-5.7 # rename source dir
281 286
282 # moving from 4.6.1 to 4.7 287 # moving from 5.6.1 to 5.7
283 288
284 $ cd ~/linux-4.6.1 # change to kernel source dir 289 $ cd ~/linux-5.6.1 # change to kernel source dir
285 $ patch -p1 -R < ../patch-4.6.1 # revert the 4.6.1 patch 290 $ patch -p1 -R < ../patch-5.6.1 # revert the 5.6.1 patch
286 # source dir is now 4.6 291 # source dir is now 5.6
287 $ patch -p1 < ../patch-4.7 # apply new 4.7 patch 292 $ patch -p1 < ../patch-5.7 # apply new 5.7 patch
288 $ cd .. 293 $ cd ..
289 $ mv linux-4.6.1 linux-4.7 # rename source dir 294 $ mv linux-5.6.1 linux-5.7 # rename source dir
290 295
291 296
292The 4.x.y kernels 297The 5.x.y kernels
293================= 298=================
294 299
295Kernels with 3-digit versions are -stable kernels. They contain small(ish) 300Kernels with 3-digit versions are -stable kernels. They contain small(ish)
296critical fixes for security problems or significant regressions discovered 301critical fixes for security problems or significant regressions discovered
297in a given 4.x kernel. 302in a given 5.x kernel.
298 303
299This is the recommended branch for users who want the most recent stable 304This is the recommended branch for users who want the most recent stable
300kernel and are not interested in helping test development/experimental 305kernel and are not interested in helping test development/experimental
301versions. 306versions.
302 307
303If no 4.x.y kernel is available, then the highest numbered 4.x kernel is 308If no 5.x.y kernel is available, then the highest numbered 5.x kernel is
304the current stable kernel. 309the current stable kernel.
305 310
306.. note:: 311.. note::
@@ -308,23 +313,23 @@ the current stable kernel.
308 The -stable team usually do make incremental patches available as well 313 The -stable team usually do make incremental patches available as well
309 as patches against the latest mainline release, but I only cover the 314 as patches against the latest mainline release, but I only cover the
310 non-incremental ones below. The incremental ones can be found at 315 non-incremental ones below. The incremental ones can be found at
311 https://www.kernel.org/pub/linux/kernel/v4.x/incr/ 316 https://www.kernel.org/pub/linux/kernel/v5.x/incr/
312 317
313These patches are not incremental, meaning that for example the 4.7.3 318These patches are not incremental, meaning that for example the 5.7.3
314patch does not apply on top of the 4.7.2 kernel source, but rather on top 319patch does not apply on top of the 5.7.2 kernel source, but rather on top
315of the base 4.7 kernel source. 320of the base 5.7 kernel source.
316 321
317So, in order to apply the 4.7.3 patch to your existing 4.7.2 kernel 322So, in order to apply the 5.7.3 patch to your existing 5.7.2 kernel
318source you have to first back out the 4.7.2 patch (so you are left with a 323source you have to first back out the 5.7.2 patch (so you are left with a
319base 4.7 kernel source) and then apply the new 4.7.3 patch. 324base 5.7 kernel source) and then apply the new 5.7.3 patch.
320 325
321Here's a small example:: 326Here's a small example::
322 327
323 $ cd ~/linux-4.7.2 # change to the kernel source dir 328 $ cd ~/linux-5.7.2 # change to the kernel source dir
324 $ patch -p1 -R < ../patch-4.7.2 # revert the 4.7.2 patch 329 $ patch -p1 -R < ../patch-5.7.2 # revert the 5.7.2 patch
325 $ patch -p1 < ../patch-4.7.3 # apply the new 4.7.3 patch 330 $ patch -p1 < ../patch-5.7.3 # apply the new 5.7.3 patch
326 $ cd .. 331 $ cd ..
327 $ mv linux-4.7.2 linux-4.7.3 # rename the kernel source dir 332 $ mv linux-5.7.2 linux-5.7.3 # rename the kernel source dir
328 333
329The -rc kernels 334The -rc kernels
330=============== 335===============
@@ -343,38 +348,38 @@ This is a good branch to run for people who want to help out testing
343development kernels but do not want to run some of the really experimental 348development kernels but do not want to run some of the really experimental
344stuff (such people should see the sections about -next and -mm kernels below). 349stuff (such people should see the sections about -next and -mm kernels below).
345 350
346The -rc patches are not incremental, they apply to a base 4.x kernel, just 351The -rc patches are not incremental, they apply to a base 5.x kernel, just
347like the 4.x.y patches described above. The kernel version before the -rcN 352like the 5.x.y patches described above. The kernel version before the -rcN
348suffix denotes the version of the kernel that this -rc kernel will eventually 353suffix denotes the version of the kernel that this -rc kernel will eventually
349turn into. 354turn into.
350 355
351So, 4.8-rc5 means that this is the fifth release candidate for the 4.8 356So, 5.8-rc5 means that this is the fifth release candidate for the 5.8
352kernel and the patch should be applied on top of the 4.7 kernel source. 357kernel and the patch should be applied on top of the 5.7 kernel source.
353 358
354Here are 3 examples of how to apply these patches:: 359Here are 3 examples of how to apply these patches::
355 360
356 # first an example of moving from 4.7 to 4.8-rc3 361 # first an example of moving from 5.7 to 5.8-rc3
357 362
358 $ cd ~/linux-4.7 # change to the 4.7 source dir 363 $ cd ~/linux-5.7 # change to the 5.7 source dir
359 $ patch -p1 < ../patch-4.8-rc3 # apply the 4.8-rc3 patch 364 $ patch -p1 < ../patch-5.8-rc3 # apply the 5.8-rc3 patch
360 $ cd .. 365 $ cd ..
361 $ mv linux-4.7 linux-4.8-rc3 # rename the source dir 366 $ mv linux-5.7 linux-5.8-rc3 # rename the source dir
362 367
363 # now let's move from 4.8-rc3 to 4.8-rc5 368 # now let's move from 5.8-rc3 to 5.8-rc5
364 369
365 $ cd ~/linux-4.8-rc3 # change to the 4.8-rc3 dir 370 $ cd ~/linux-5.8-rc3 # change to the 5.8-rc3 dir
366 $ patch -p1 -R < ../patch-4.8-rc3 # revert the 4.8-rc3 patch 371 $ patch -p1 -R < ../patch-5.8-rc3 # revert the 5.8-rc3 patch
367 $ patch -p1 < ../patch-4.8-rc5 # apply the new 4.8-rc5 patch 372 $ patch -p1 < ../patch-5.8-rc5 # apply the new 5.8-rc5 patch
368 $ cd .. 373 $ cd ..
369 $ mv linux-4.8-rc3 linux-4.8-rc5 # rename the source dir 374 $ mv linux-5.8-rc3 linux-5.8-rc5 # rename the source dir
370 375
371 # finally let's try and move from 4.7.3 to 4.8-rc5 376 # finally let's try and move from 5.7.3 to 5.8-rc5
372 377
373 $ cd ~/linux-4.7.3 # change to the kernel source dir 378 $ cd ~/linux-5.7.3 # change to the kernel source dir
374 $ patch -p1 -R < ../patch-4.7.3 # revert the 4.7.3 patch 379 $ patch -p1 -R < ../patch-5.7.3 # revert the 5.7.3 patch
375 $ patch -p1 < ../patch-4.8-rc5 # apply new 4.8-rc5 patch 380 $ patch -p1 < ../patch-5.8-rc5 # apply new 5.8-rc5 patch
376 $ cd .. 381 $ cd ..
377 $ mv linux-4.7.3 linux-4.8-rc5 # rename the kernel source dir 382 $ mv linux-5.7.3 linux-5.8-rc5 # rename the kernel source dir
378 383
379 384
380The -mm patches and the linux-next tree 385The -mm patches and the linux-next tree
diff --git a/Documentation/translations/it_IT/admin-guide/README.rst b/Documentation/translations/it_IT/admin-guide/README.rst
index 80f5ffc94a9e..b37166817842 100644
--- a/Documentation/translations/it_IT/admin-guide/README.rst
+++ b/Documentation/translations/it_IT/admin-guide/README.rst
@@ -4,7 +4,7 @@
4 4
5.. _it_readme: 5.. _it_readme:
6 6
7Rilascio del kernel Linux 4.x <http://kernel.org/> 7Rilascio del kernel Linux 5.x <http://kernel.org/>
8=================================================== 8===================================================
9 9
10.. warning:: 10.. warning::
diff --git a/MAINTAINERS b/MAINTAINERS
index 41ce5f4ad838..e6e17d8c5aae 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -409,8 +409,7 @@ F: drivers/platform/x86/wmi.c
409F: include/uapi/linux/wmi.h 409F: include/uapi/linux/wmi.h
410 410
411AD1889 ALSA SOUND DRIVER 411AD1889 ALSA SOUND DRIVER
412M: Thibaut Varene <T-Bone@parisc-linux.org> 412W: https://parisc.wiki.kernel.org/index.php/AD1889
413W: http://wiki.parisc-linux.org/AD1889
414L: linux-parisc@vger.kernel.org 413L: linux-parisc@vger.kernel.org
415S: Maintained 414S: Maintained
416F: sound/pci/ad1889.* 415F: sound/pci/ad1889.*
@@ -11488,7 +11487,7 @@ F: Documentation/blockdev/paride.txt
11488F: drivers/block/paride/ 11487F: drivers/block/paride/
11489 11488
11490PARISC ARCHITECTURE 11489PARISC ARCHITECTURE
11491M: "James E.J. Bottomley" <jejb@parisc-linux.org> 11490M: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
11492M: Helge Deller <deller@gmx.de> 11491M: Helge Deller <deller@gmx.de>
11493L: linux-parisc@vger.kernel.org 11492L: linux-parisc@vger.kernel.org
11494W: http://www.parisc-linux.org/ 11493W: http://www.parisc-linux.org/
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 376366a7db81..d750b302d5ab 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -191,7 +191,6 @@ config NR_CPUS
191 191
192config ARC_SMP_HALT_ON_RESET 192config ARC_SMP_HALT_ON_RESET
193 bool "Enable Halt-on-reset boot mode" 193 bool "Enable Halt-on-reset boot mode"
194 default y if ARC_UBOOT_SUPPORT
195 help 194 help
196 In SMP configuration cores can be configured as Halt-on-reset 195 In SMP configuration cores can be configured as Halt-on-reset
197 or they could all start at same time. For Halt-on-reset, non 196 or they could all start at same time. For Halt-on-reset, non
@@ -407,6 +406,14 @@ config ARC_HAS_ACCL_REGS
407 (also referred to as r58:r59). These can also be used by gcc as GPR so 406 (also referred to as r58:r59). These can also be used by gcc as GPR so
408 kernel needs to save/restore per process 407 kernel needs to save/restore per process
409 408
409config ARC_IRQ_NO_AUTOSAVE
410 bool "Disable hardware autosave regfile on interrupts"
411 default n
412 help
413 On HS cores, taken interrupt auto saves the regfile on stack.
414 This is programmable and can be optionally disabled in which case
415 software INTERRUPT_PROLOGUE/EPILGUE do the needed work
416
410endif # ISA_ARCV2 417endif # ISA_ARCV2
411 418
412endmenu # "ARC CPU Configuration" 419endmenu # "ARC CPU Configuration"
@@ -515,17 +522,6 @@ config ARC_DBG_TLB_PARANOIA
515 522
516endif 523endif
517 524
518config ARC_UBOOT_SUPPORT
519 bool "Support uboot arg Handling"
520 help
521 ARC Linux by default checks for uboot provided args as pointers to
522 external cmdline or DTB. This however breaks in absence of uboot,
523 when booting from Metaware debugger directly, as the registers are
524 not zeroed out on reset by mdb and/or ARCv2 based cores. The bogus
525 registers look like uboot args to kernel which then chokes.
526 So only enable the uboot arg checking/processing if users are sure
527 of uboot being in play.
528
529config ARC_BUILTIN_DTB_NAME 525config ARC_BUILTIN_DTB_NAME
530 string "Built in DTB" 526 string "Built in DTB"
531 help 527 help
diff --git a/arch/arc/configs/nps_defconfig b/arch/arc/configs/nps_defconfig
index 6e84060e7c90..621f59407d76 100644
--- a/arch/arc/configs/nps_defconfig
+++ b/arch/arc/configs/nps_defconfig
@@ -31,7 +31,6 @@ CONFIG_ARC_CACHE_LINE_SHIFT=5
31# CONFIG_ARC_HAS_LLSC is not set 31# CONFIG_ARC_HAS_LLSC is not set
32CONFIG_ARC_KVADDR_SIZE=402 32CONFIG_ARC_KVADDR_SIZE=402
33CONFIG_ARC_EMUL_UNALIGNED=y 33CONFIG_ARC_EMUL_UNALIGNED=y
34CONFIG_ARC_UBOOT_SUPPORT=y
35CONFIG_PREEMPT=y 34CONFIG_PREEMPT=y
36CONFIG_NET=y 35CONFIG_NET=y
37CONFIG_UNIX=y 36CONFIG_UNIX=y
diff --git a/arch/arc/configs/vdk_hs38_defconfig b/arch/arc/configs/vdk_hs38_defconfig
index 1e59a2e9c602..e447ace6fa1c 100644
--- a/arch/arc/configs/vdk_hs38_defconfig
+++ b/arch/arc/configs/vdk_hs38_defconfig
@@ -13,7 +13,6 @@ CONFIG_PARTITION_ADVANCED=y
13CONFIG_ARC_PLAT_AXS10X=y 13CONFIG_ARC_PLAT_AXS10X=y
14CONFIG_AXS103=y 14CONFIG_AXS103=y
15CONFIG_ISA_ARCV2=y 15CONFIG_ISA_ARCV2=y
16CONFIG_ARC_UBOOT_SUPPORT=y
17CONFIG_ARC_BUILTIN_DTB_NAME="vdk_hs38" 16CONFIG_ARC_BUILTIN_DTB_NAME="vdk_hs38"
18CONFIG_PREEMPT=y 17CONFIG_PREEMPT=y
19CONFIG_NET=y 18CONFIG_NET=y
diff --git a/arch/arc/configs/vdk_hs38_smp_defconfig b/arch/arc/configs/vdk_hs38_smp_defconfig
index b5c3f6c54b03..c82cdb10aaf4 100644
--- a/arch/arc/configs/vdk_hs38_smp_defconfig
+++ b/arch/arc/configs/vdk_hs38_smp_defconfig
@@ -15,8 +15,6 @@ CONFIG_AXS103=y
15CONFIG_ISA_ARCV2=y 15CONFIG_ISA_ARCV2=y
16CONFIG_SMP=y 16CONFIG_SMP=y
17# CONFIG_ARC_TIMERS_64BIT is not set 17# CONFIG_ARC_TIMERS_64BIT is not set
18# CONFIG_ARC_SMP_HALT_ON_RESET is not set
19CONFIG_ARC_UBOOT_SUPPORT=y
20CONFIG_ARC_BUILTIN_DTB_NAME="vdk_hs38_smp" 18CONFIG_ARC_BUILTIN_DTB_NAME="vdk_hs38_smp"
21CONFIG_PREEMPT=y 19CONFIG_PREEMPT=y
22CONFIG_NET=y 20CONFIG_NET=y
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h
index f1b86cef0905..a27eafdc8260 100644
--- a/arch/arc/include/asm/arcregs.h
+++ b/arch/arc/include/asm/arcregs.h
@@ -151,6 +151,14 @@ struct bcr_isa_arcv2 {
151#endif 151#endif
152}; 152};
153 153
154struct bcr_uarch_build_arcv2 {
155#ifdef CONFIG_CPU_BIG_ENDIAN
156 unsigned int pad:8, prod:8, maj:8, min:8;
157#else
158 unsigned int min:8, maj:8, prod:8, pad:8;
159#endif
160};
161
154struct bcr_mpy { 162struct bcr_mpy {
155#ifdef CONFIG_CPU_BIG_ENDIAN 163#ifdef CONFIG_CPU_BIG_ENDIAN
156 unsigned int pad:8, x1616:8, dsp:4, cycles:2, type:2, ver:8; 164 unsigned int pad:8, x1616:8, dsp:4, cycles:2, type:2, ver:8;
diff --git a/arch/arc/include/asm/cache.h b/arch/arc/include/asm/cache.h
index f393b663413e..2ad77fb43639 100644
--- a/arch/arc/include/asm/cache.h
+++ b/arch/arc/include/asm/cache.h
@@ -52,6 +52,17 @@
52#define cache_line_size() SMP_CACHE_BYTES 52#define cache_line_size() SMP_CACHE_BYTES
53#define ARCH_DMA_MINALIGN SMP_CACHE_BYTES 53#define ARCH_DMA_MINALIGN SMP_CACHE_BYTES
54 54
55/*
56 * Make sure slab-allocated buffers are 64-bit aligned when atomic64_t uses
57 * ARCv2 64-bit atomics (LLOCKD/SCONDD). This guarantess runtime 64-bit
58 * alignment for any atomic64_t embedded in buffer.
59 * Default ARCH_SLAB_MINALIGN is __alignof__(long long) which has a relaxed
60 * value of 4 (and not 8) in ARC ABI.
61 */
62#if defined(CONFIG_ARC_HAS_LL64) && defined(CONFIG_ARC_HAS_LLSC)
63#define ARCH_SLAB_MINALIGN 8
64#endif
65
55extern void arc_cache_init(void); 66extern void arc_cache_init(void);
56extern char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len); 67extern char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len);
57extern void read_decode_cache_bcr(void); 68extern void read_decode_cache_bcr(void);
diff --git a/arch/arc/include/asm/entry-arcv2.h b/arch/arc/include/asm/entry-arcv2.h
index 309f4e6721b3..225e7df2d8ed 100644
--- a/arch/arc/include/asm/entry-arcv2.h
+++ b/arch/arc/include/asm/entry-arcv2.h
@@ -17,6 +17,33 @@
17 ; 17 ;
18 ; Now manually save: r12, sp, fp, gp, r25 18 ; Now manually save: r12, sp, fp, gp, r25
19 19
20#ifdef CONFIG_ARC_IRQ_NO_AUTOSAVE
21.ifnc \called_from, exception
22 st.as r9, [sp, -10] ; save r9 in it's final stack slot
23 sub sp, sp, 12 ; skip JLI, LDI, EI
24
25 PUSH lp_count
26 PUSHAX lp_start
27 PUSHAX lp_end
28 PUSH blink
29
30 PUSH r11
31 PUSH r10
32
33 sub sp, sp, 4 ; skip r9
34
35 PUSH r8
36 PUSH r7
37 PUSH r6
38 PUSH r5
39 PUSH r4
40 PUSH r3
41 PUSH r2
42 PUSH r1
43 PUSH r0
44.endif
45#endif
46
20#ifdef CONFIG_ARC_HAS_ACCL_REGS 47#ifdef CONFIG_ARC_HAS_ACCL_REGS
21 PUSH r59 48 PUSH r59
22 PUSH r58 49 PUSH r58
@@ -86,6 +113,33 @@
86 POP r59 113 POP r59
87#endif 114#endif
88 115
116#ifdef CONFIG_ARC_IRQ_NO_AUTOSAVE
117.ifnc \called_from, exception
118 POP r0
119 POP r1
120 POP r2
121 POP r3
122 POP r4
123 POP r5
124 POP r6
125 POP r7
126 POP r8
127 POP r9
128 POP r10
129 POP r11
130
131 POP blink
132 POPAX lp_end
133 POPAX lp_start
134
135 POP r9
136 mov lp_count, r9
137
138 add sp, sp, 12 ; skip JLI, LDI, EI
139 ld.as r9, [sp, -10] ; reload r9 which got clobbered
140.endif
141#endif
142
89.endm 143.endm
90 144
91/*------------------------------------------------------------------------*/ 145/*------------------------------------------------------------------------*/
diff --git a/arch/arc/include/asm/uaccess.h b/arch/arc/include/asm/uaccess.h
index c9173c02081c..eabc3efa6c6d 100644
--- a/arch/arc/include/asm/uaccess.h
+++ b/arch/arc/include/asm/uaccess.h
@@ -207,7 +207,7 @@ raw_copy_from_user(void *to, const void __user *from, unsigned long n)
207 */ 207 */
208 "=&r" (tmp), "+r" (to), "+r" (from) 208 "=&r" (tmp), "+r" (to), "+r" (from)
209 : 209 :
210 : "lp_count", "lp_start", "lp_end", "memory"); 210 : "lp_count", "memory");
211 211
212 return n; 212 return n;
213 } 213 }
@@ -433,7 +433,7 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)
433 */ 433 */
434 "=&r" (tmp), "+r" (to), "+r" (from) 434 "=&r" (tmp), "+r" (to), "+r" (from)
435 : 435 :
436 : "lp_count", "lp_start", "lp_end", "memory"); 436 : "lp_count", "memory");
437 437
438 return n; 438 return n;
439 } 439 }
@@ -653,7 +653,7 @@ static inline unsigned long __arc_clear_user(void __user *to, unsigned long n)
653 " .previous \n" 653 " .previous \n"
654 : "+r"(d_char), "+r"(res) 654 : "+r"(d_char), "+r"(res)
655 : "i"(0) 655 : "i"(0)
656 : "lp_count", "lp_start", "lp_end", "memory"); 656 : "lp_count", "memory");
657 657
658 return res; 658 return res;
659} 659}
@@ -686,7 +686,7 @@ __arc_strncpy_from_user(char *dst, const char __user *src, long count)
686 " .previous \n" 686 " .previous \n"
687 : "+r"(res), "+r"(dst), "+r"(src), "=r"(val) 687 : "+r"(res), "+r"(dst), "+r"(src), "=r"(val)
688 : "g"(-EFAULT), "r"(count) 688 : "g"(-EFAULT), "r"(count)
689 : "lp_count", "lp_start", "lp_end", "memory"); 689 : "lp_count", "memory");
690 690
691 return res; 691 return res;
692} 692}
diff --git a/arch/arc/kernel/entry-arcv2.S b/arch/arc/kernel/entry-arcv2.S
index cc558a25b8fa..562089d62d9d 100644
--- a/arch/arc/kernel/entry-arcv2.S
+++ b/arch/arc/kernel/entry-arcv2.S
@@ -209,7 +209,9 @@ restore_regs:
209;####### Return from Intr ####### 209;####### Return from Intr #######
210 210
211debug_marker_l1: 211debug_marker_l1:
212 bbit1.nt r0, STATUS_DE_BIT, .Lintr_ret_to_delay_slot 212 ; bbit1.nt r0, STATUS_DE_BIT, .Lintr_ret_to_delay_slot
213 btst r0, STATUS_DE_BIT ; Z flag set if bit clear
214 bnz .Lintr_ret_to_delay_slot ; branch if STATUS_DE_BIT set
213 215
214.Lisr_ret_fast_path: 216.Lisr_ret_fast_path:
215 ; Handle special case #1: (Entry via Exception, Return via IRQ) 217 ; Handle special case #1: (Entry via Exception, Return via IRQ)
diff --git a/arch/arc/kernel/head.S b/arch/arc/kernel/head.S
index 8b90d25a15cc..30e090625916 100644
--- a/arch/arc/kernel/head.S
+++ b/arch/arc/kernel/head.S
@@ -17,6 +17,7 @@
17#include <asm/entry.h> 17#include <asm/entry.h>
18#include <asm/arcregs.h> 18#include <asm/arcregs.h>
19#include <asm/cache.h> 19#include <asm/cache.h>
20#include <asm/irqflags.h>
20 21
21.macro CPU_EARLY_SETUP 22.macro CPU_EARLY_SETUP
22 23
@@ -47,6 +48,15 @@
47 sr r5, [ARC_REG_DC_CTRL] 48 sr r5, [ARC_REG_DC_CTRL]
48 49
491: 501:
51
52#ifdef CONFIG_ISA_ARCV2
53 ; Unaligned access is disabled at reset, so re-enable early as
54 ; gcc 7.3.1 (ARC GNU 2018.03) onwards generates unaligned access
55 ; by default
56 lr r5, [status32]
57 bset r5, r5, STATUS_AD_BIT
58 kflag r5
59#endif
50.endm 60.endm
51 61
52 .section .init.text, "ax",@progbits 62 .section .init.text, "ax",@progbits
@@ -90,15 +100,13 @@ ENTRY(stext)
90 st.ab 0, [r5, 4] 100 st.ab 0, [r5, 4]
911: 1011:
92 102
93#ifdef CONFIG_ARC_UBOOT_SUPPORT
94 ; Uboot - kernel ABI 103 ; Uboot - kernel ABI
95 ; r0 = [0] No uboot interaction, [1] cmdline in r2, [2] DTB in r2 104 ; r0 = [0] No uboot interaction, [1] cmdline in r2, [2] DTB in r2
96 ; r1 = magic number (board identity, unused as of now 105 ; r1 = magic number (always zero as of now)
97 ; r2 = pointer to uboot provided cmdline or external DTB in mem 106 ; r2 = pointer to uboot provided cmdline or external DTB in mem
98 ; These are handled later in setup_arch() 107 ; These are handled later in handle_uboot_args()
99 st r0, [@uboot_tag] 108 st r0, [@uboot_tag]
100 st r2, [@uboot_arg] 109 st r2, [@uboot_arg]
101#endif
102 110
103 ; setup "current" tsk and optionally cache it in dedicated r25 111 ; setup "current" tsk and optionally cache it in dedicated r25
104 mov r9, @init_task 112 mov r9, @init_task
diff --git a/arch/arc/kernel/intc-arcv2.c b/arch/arc/kernel/intc-arcv2.c
index 067ea362fb3e..cf18b3e5a934 100644
--- a/arch/arc/kernel/intc-arcv2.c
+++ b/arch/arc/kernel/intc-arcv2.c
@@ -49,11 +49,13 @@ void arc_init_IRQ(void)
49 49
50 *(unsigned int *)&ictrl = 0; 50 *(unsigned int *)&ictrl = 0;
51 51
52#ifndef CONFIG_ARC_IRQ_NO_AUTOSAVE
52 ictrl.save_nr_gpr_pairs = 6; /* r0 to r11 (r12 saved manually) */ 53 ictrl.save_nr_gpr_pairs = 6; /* r0 to r11 (r12 saved manually) */
53 ictrl.save_blink = 1; 54 ictrl.save_blink = 1;
54 ictrl.save_lp_regs = 1; /* LP_COUNT, LP_START, LP_END */ 55 ictrl.save_lp_regs = 1; /* LP_COUNT, LP_START, LP_END */
55 ictrl.save_u_to_u = 0; /* user ctxt saved on kernel stack */ 56 ictrl.save_u_to_u = 0; /* user ctxt saved on kernel stack */
56 ictrl.save_idx_regs = 1; /* JLI, LDI, EI */ 57 ictrl.save_idx_regs = 1; /* JLI, LDI, EI */
58#endif
57 59
58 WRITE_AUX(AUX_IRQ_CTRL, ictrl); 60 WRITE_AUX(AUX_IRQ_CTRL, ictrl);
59 61
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index feb90093e6b1..7b2340996cf8 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -199,20 +199,36 @@ static void read_arc_build_cfg_regs(void)
199 cpu->bpu.ret_stk = 4 << bpu.rse; 199 cpu->bpu.ret_stk = 4 << bpu.rse;
200 200
201 if (cpu->core.family >= 0x54) { 201 if (cpu->core.family >= 0x54) {
202 unsigned int exec_ctrl;
203 202
204 READ_BCR(AUX_EXEC_CTRL, exec_ctrl); 203 struct bcr_uarch_build_arcv2 uarch;
205 cpu->extn.dual_enb = !(exec_ctrl & 1);
206 204
207 /* dual issue always present for this core */ 205 /*
208 cpu->extn.dual = 1; 206 * The first 0x54 core (uarch maj:min 0:1 or 0:2) was
207 * dual issue only (HS4x). But next uarch rev (1:0)
208 * allows it be configured for single issue (HS3x)
209 * Ensure we fiddle with dual issue only on HS4x
210 */
211 READ_BCR(ARC_REG_MICRO_ARCH_BCR, uarch);
212
213 if (uarch.prod == 4) {
214 unsigned int exec_ctrl;
215
216 /* dual issue hardware always present */
217 cpu->extn.dual = 1;
218
219 READ_BCR(AUX_EXEC_CTRL, exec_ctrl);
220
221 /* dual issue hardware enabled ? */
222 cpu->extn.dual_enb = !(exec_ctrl & 1);
223
224 }
209 } 225 }
210 } 226 }
211 227
212 READ_BCR(ARC_REG_AP_BCR, ap); 228 READ_BCR(ARC_REG_AP_BCR, ap);
213 if (ap.ver) { 229 if (ap.ver) {
214 cpu->extn.ap_num = 2 << ap.num; 230 cpu->extn.ap_num = 2 << ap.num;
215 cpu->extn.ap_full = !!ap.min; 231 cpu->extn.ap_full = !ap.min;
216 } 232 }
217 233
218 READ_BCR(ARC_REG_SMART_BCR, bcr); 234 READ_BCR(ARC_REG_SMART_BCR, bcr);
@@ -462,43 +478,78 @@ void setup_processor(void)
462 arc_chk_core_config(); 478 arc_chk_core_config();
463} 479}
464 480
465static inline int is_kernel(unsigned long addr) 481static inline bool uboot_arg_invalid(unsigned long addr)
466{ 482{
467 if (addr >= (unsigned long)_stext && addr <= (unsigned long)_end) 483 /*
468 return 1; 484 * Check that it is a untranslated address (although MMU is not enabled
469 return 0; 485 * yet, it being a high address ensures this is not by fluke)
486 */
487 if (addr < PAGE_OFFSET)
488 return true;
489
490 /* Check that address doesn't clobber resident kernel image */
491 return addr >= (unsigned long)_stext && addr <= (unsigned long)_end;
470} 492}
471 493
472void __init setup_arch(char **cmdline_p) 494#define IGNORE_ARGS "Ignore U-boot args: "
495
496/* uboot_tag values for U-boot - kernel ABI revision 0; see head.S */
497#define UBOOT_TAG_NONE 0
498#define UBOOT_TAG_CMDLINE 1
499#define UBOOT_TAG_DTB 2
500
501void __init handle_uboot_args(void)
473{ 502{
474#ifdef CONFIG_ARC_UBOOT_SUPPORT 503 bool use_embedded_dtb = true;
475 /* make sure that uboot passed pointer to cmdline/dtb is valid */ 504 bool append_cmdline = false;
476 if (uboot_tag && is_kernel((unsigned long)uboot_arg)) 505
477 panic("Invalid uboot arg\n"); 506 /* check that we know this tag */
478 507 if (uboot_tag != UBOOT_TAG_NONE &&
479 /* See if u-boot passed an external Device Tree blob */ 508 uboot_tag != UBOOT_TAG_CMDLINE &&
480 machine_desc = setup_machine_fdt(uboot_arg); /* uboot_tag == 2 */ 509 uboot_tag != UBOOT_TAG_DTB) {
481 if (!machine_desc) 510 pr_warn(IGNORE_ARGS "invalid uboot tag: '%08x'\n", uboot_tag);
482#endif 511 goto ignore_uboot_args;
483 { 512 }
484 /* No, so try the embedded one */ 513
514 if (uboot_tag != UBOOT_TAG_NONE &&
515 uboot_arg_invalid((unsigned long)uboot_arg)) {
516 pr_warn(IGNORE_ARGS "invalid uboot arg: '%px'\n", uboot_arg);
517 goto ignore_uboot_args;
518 }
519
520 /* see if U-boot passed an external Device Tree blob */
521 if (uboot_tag == UBOOT_TAG_DTB) {
522 machine_desc = setup_machine_fdt((void *)uboot_arg);
523
524 /* external Device Tree blob is invalid - use embedded one */
525 use_embedded_dtb = !machine_desc;
526 }
527
528 if (uboot_tag == UBOOT_TAG_CMDLINE)
529 append_cmdline = true;
530
531ignore_uboot_args:
532
533 if (use_embedded_dtb) {
485 machine_desc = setup_machine_fdt(__dtb_start); 534 machine_desc = setup_machine_fdt(__dtb_start);
486 if (!machine_desc) 535 if (!machine_desc)
487 panic("Embedded DT invalid\n"); 536 panic("Embedded DT invalid\n");
537 }
488 538
489 /* 539 /*
490 * If we are here, it is established that @uboot_arg didn't 540 * NOTE: @boot_command_line is populated by setup_machine_fdt() so this
491 * point to DT blob. Instead if u-boot says it is cmdline, 541 * append processing can only happen after.
492 * append to embedded DT cmdline. 542 */
493 * setup_machine_fdt() would have populated @boot_command_line 543 if (append_cmdline) {
494 */ 544 /* Ensure a whitespace between the 2 cmdlines */
495 if (uboot_tag == 1) { 545 strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
496 /* Ensure a whitespace between the 2 cmdlines */ 546 strlcat(boot_command_line, uboot_arg, COMMAND_LINE_SIZE);
497 strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
498 strlcat(boot_command_line, uboot_arg,
499 COMMAND_LINE_SIZE);
500 }
501 } 547 }
548}
549
550void __init setup_arch(char **cmdline_p)
551{
552 handle_uboot_args();
502 553
503 /* Save unparsed command line copy for /proc/cmdline */ 554 /* Save unparsed command line copy for /proc/cmdline */
504 *cmdline_p = boot_command_line; 555 *cmdline_p = boot_command_line;
diff --git a/arch/arc/lib/memcpy-archs.S b/arch/arc/lib/memcpy-archs.S
index d61044dd8b58..ea14b0bf3116 100644
--- a/arch/arc/lib/memcpy-archs.S
+++ b/arch/arc/lib/memcpy-archs.S
@@ -25,15 +25,11 @@
25#endif 25#endif
26 26
27#ifdef CONFIG_ARC_HAS_LL64 27#ifdef CONFIG_ARC_HAS_LL64
28# define PREFETCH_READ(RX) prefetch [RX, 56]
29# define PREFETCH_WRITE(RX) prefetchw [RX, 64]
30# define LOADX(DST,RX) ldd.ab DST, [RX, 8] 28# define LOADX(DST,RX) ldd.ab DST, [RX, 8]
31# define STOREX(SRC,RX) std.ab SRC, [RX, 8] 29# define STOREX(SRC,RX) std.ab SRC, [RX, 8]
32# define ZOLSHFT 5 30# define ZOLSHFT 5
33# define ZOLAND 0x1F 31# define ZOLAND 0x1F
34#else 32#else
35# define PREFETCH_READ(RX) prefetch [RX, 28]
36# define PREFETCH_WRITE(RX) prefetchw [RX, 32]
37# define LOADX(DST,RX) ld.ab DST, [RX, 4] 33# define LOADX(DST,RX) ld.ab DST, [RX, 4]
38# define STOREX(SRC,RX) st.ab SRC, [RX, 4] 34# define STOREX(SRC,RX) st.ab SRC, [RX, 4]
39# define ZOLSHFT 4 35# define ZOLSHFT 4
@@ -41,8 +37,6 @@
41#endif 37#endif
42 38
43ENTRY_CFI(memcpy) 39ENTRY_CFI(memcpy)
44 prefetch [r1] ; Prefetch the read location
45 prefetchw [r0] ; Prefetch the write location
46 mov.f 0, r2 40 mov.f 0, r2
47;;; if size is zero 41;;; if size is zero
48 jz.d [blink] 42 jz.d [blink]
@@ -72,8 +66,6 @@ ENTRY_CFI(memcpy)
72 lpnz @.Lcopy32_64bytes 66 lpnz @.Lcopy32_64bytes
73 ;; LOOP START 67 ;; LOOP START
74 LOADX (r6, r1) 68 LOADX (r6, r1)
75 PREFETCH_READ (r1)
76 PREFETCH_WRITE (r3)
77 LOADX (r8, r1) 69 LOADX (r8, r1)
78 LOADX (r10, r1) 70 LOADX (r10, r1)
79 LOADX (r4, r1) 71 LOADX (r4, r1)
@@ -117,9 +109,7 @@ ENTRY_CFI(memcpy)
117 lpnz @.Lcopy8bytes_1 109 lpnz @.Lcopy8bytes_1
118 ;; LOOP START 110 ;; LOOP START
119 ld.ab r6, [r1, 4] 111 ld.ab r6, [r1, 4]
120 prefetch [r1, 28] ;Prefetch the next read location
121 ld.ab r8, [r1,4] 112 ld.ab r8, [r1,4]
122 prefetchw [r3, 32] ;Prefetch the next write location
123 113
124 SHIFT_1 (r7, r6, 24) 114 SHIFT_1 (r7, r6, 24)
125 or r7, r7, r5 115 or r7, r7, r5
@@ -162,9 +152,7 @@ ENTRY_CFI(memcpy)
162 lpnz @.Lcopy8bytes_2 152 lpnz @.Lcopy8bytes_2
163 ;; LOOP START 153 ;; LOOP START
164 ld.ab r6, [r1, 4] 154 ld.ab r6, [r1, 4]
165 prefetch [r1, 28] ;Prefetch the next read location
166 ld.ab r8, [r1,4] 155 ld.ab r8, [r1,4]
167 prefetchw [r3, 32] ;Prefetch the next write location
168 156
169 SHIFT_1 (r7, r6, 16) 157 SHIFT_1 (r7, r6, 16)
170 or r7, r7, r5 158 or r7, r7, r5
@@ -204,9 +192,7 @@ ENTRY_CFI(memcpy)
204 lpnz @.Lcopy8bytes_3 192 lpnz @.Lcopy8bytes_3
205 ;; LOOP START 193 ;; LOOP START
206 ld.ab r6, [r1, 4] 194 ld.ab r6, [r1, 4]
207 prefetch [r1, 28] ;Prefetch the next read location
208 ld.ab r8, [r1,4] 195 ld.ab r8, [r1,4]
209 prefetchw [r3, 32] ;Prefetch the next write location
210 196
211 SHIFT_1 (r7, r6, 8) 197 SHIFT_1 (r7, r6, 8)
212 or r7, r7, r5 198 or r7, r7, r5
diff --git a/arch/arc/plat-hsdk/Kconfig b/arch/arc/plat-hsdk/Kconfig
index f25c085b9874..23e00216e5a5 100644
--- a/arch/arc/plat-hsdk/Kconfig
+++ b/arch/arc/plat-hsdk/Kconfig
@@ -9,6 +9,7 @@ menuconfig ARC_SOC_HSDK
9 bool "ARC HS Development Kit SOC" 9 bool "ARC HS Development Kit SOC"
10 depends on ISA_ARCV2 10 depends on ISA_ARCV2
11 select ARC_HAS_ACCL_REGS 11 select ARC_HAS_ACCL_REGS
12 select ARC_IRQ_NO_AUTOSAVE
12 select CLK_HSDK 13 select CLK_HSDK
13 select RESET_HSDK 14 select RESET_HSDK
14 select HAVE_PCI 15 select HAVE_PCI
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 664e918e2624..26524b75970a 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1400,6 +1400,7 @@ config NR_CPUS
1400config HOTPLUG_CPU 1400config HOTPLUG_CPU
1401 bool "Support for hot-pluggable CPUs" 1401 bool "Support for hot-pluggable CPUs"
1402 depends on SMP 1402 depends on SMP
1403 select GENERIC_IRQ_MIGRATION
1403 help 1404 help
1404 Say Y here to experiment with turning CPUs off and on. CPUs 1405 Say Y here to experiment with turning CPUs off and on. CPUs
1405 can be controlled through /sys/devices/system/cpu. 1406 can be controlled through /sys/devices/system/cpu.
diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts
index b67f5fee1469..dce5be5df97b 100644
--- a/arch/arm/boot/dts/am335x-evm.dts
+++ b/arch/arm/boot/dts/am335x-evm.dts
@@ -729,7 +729,7 @@
729 729
730&cpsw_emac0 { 730&cpsw_emac0 {
731 phy-handle = <&ethphy0>; 731 phy-handle = <&ethphy0>;
732 phy-mode = "rgmii-txid"; 732 phy-mode = "rgmii-id";
733}; 733};
734 734
735&tscadc { 735&tscadc {
diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts
index 172c0224e7f6..b128998097ce 100644
--- a/arch/arm/boot/dts/am335x-evmsk.dts
+++ b/arch/arm/boot/dts/am335x-evmsk.dts
@@ -651,13 +651,13 @@
651 651
652&cpsw_emac0 { 652&cpsw_emac0 {
653 phy-handle = <&ethphy0>; 653 phy-handle = <&ethphy0>;
654 phy-mode = "rgmii-txid"; 654 phy-mode = "rgmii-id";
655 dual_emac_res_vlan = <1>; 655 dual_emac_res_vlan = <1>;
656}; 656};
657 657
658&cpsw_emac1 { 658&cpsw_emac1 {
659 phy-handle = <&ethphy1>; 659 phy-handle = <&ethphy1>;
660 phy-mode = "rgmii-txid"; 660 phy-mode = "rgmii-id";
661 dual_emac_res_vlan = <2>; 661 dual_emac_res_vlan = <2>;
662}; 662};
663 663
diff --git a/arch/arm/boot/dts/armada-xp-db.dts b/arch/arm/boot/dts/armada-xp-db.dts
index f3ac7483afed..5d04dc68cf57 100644
--- a/arch/arm/boot/dts/armada-xp-db.dts
+++ b/arch/arm/boot/dts/armada-xp-db.dts
@@ -144,30 +144,32 @@
144 status = "okay"; 144 status = "okay";
145 }; 145 };
146 146
147 nand@d0000 { 147 nand-controller@d0000 {
148 status = "okay"; 148 status = "okay";
149 label = "pxa3xx_nand-0";
150 num-cs = <1>;
151 marvell,nand-keep-config;
152 nand-on-flash-bbt;
153
154 partitions {
155 compatible = "fixed-partitions";
156 #address-cells = <1>;
157 #size-cells = <1>;
158
159 partition@0 {
160 label = "U-Boot";
161 reg = <0 0x800000>;
162 };
163 partition@800000 {
164 label = "Linux";
165 reg = <0x800000 0x800000>;
166 };
167 partition@1000000 {
168 label = "Filesystem";
169 reg = <0x1000000 0x3f000000>;
170 149
150 nand@0 {
151 reg = <0>;
152 label = "pxa3xx_nand-0";
153 nand-rb = <0>;
154 nand-on-flash-bbt;
155
156 partitions {
157 compatible = "fixed-partitions";
158 #address-cells = <1>;
159 #size-cells = <1>;
160
161 partition@0 {
162 label = "U-Boot";
163 reg = <0 0x800000>;
164 };
165 partition@800000 {
166 label = "Linux";
167 reg = <0x800000 0x800000>;
168 };
169 partition@1000000 {
170 label = "Filesystem";
171 reg = <0x1000000 0x3f000000>;
172 };
171 }; 173 };
172 }; 174 };
173 }; 175 };
diff --git a/arch/arm/boot/dts/armada-xp-gp.dts b/arch/arm/boot/dts/armada-xp-gp.dts
index 1139e9469a83..b4cca507cf13 100644
--- a/arch/arm/boot/dts/armada-xp-gp.dts
+++ b/arch/arm/boot/dts/armada-xp-gp.dts
@@ -160,12 +160,15 @@
160 status = "okay"; 160 status = "okay";
161 }; 161 };
162 162
163 nand@d0000 { 163 nand-controller@d0000 {
164 status = "okay"; 164 status = "okay";
165 label = "pxa3xx_nand-0"; 165
166 num-cs = <1>; 166 nand@0 {
167 marvell,nand-keep-config; 167 reg = <0>;
168 nand-on-flash-bbt; 168 label = "pxa3xx_nand-0";
169 nand-rb = <0>;
170 nand-on-flash-bbt;
171 };
169 }; 172 };
170 }; 173 };
171 174
diff --git a/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts b/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts
index bbbb38888bb8..87dcb502f72d 100644
--- a/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts
+++ b/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts
@@ -81,49 +81,52 @@
81 81
82 }; 82 };
83 83
84 nand@d0000 { 84 nand-controller@d0000 {
85 status = "okay"; 85 status = "okay";
86 label = "pxa3xx_nand-0";
87 num-cs = <1>;
88 marvell,nand-keep-config;
89 nand-on-flash-bbt;
90
91 partitions {
92 compatible = "fixed-partitions";
93 #address-cells = <1>;
94 #size-cells = <1>;
95
96 partition@0 {
97 label = "u-boot";
98 reg = <0x00000000 0x000e0000>;
99 read-only;
100 };
101
102 partition@e0000 {
103 label = "u-boot-env";
104 reg = <0x000e0000 0x00020000>;
105 read-only;
106 };
107
108 partition@100000 {
109 label = "u-boot-env2";
110 reg = <0x00100000 0x00020000>;
111 read-only;
112 };
113
114 partition@120000 {
115 label = "zImage";
116 reg = <0x00120000 0x00400000>;
117 };
118
119 partition@520000 {
120 label = "initrd";
121 reg = <0x00520000 0x00400000>;
122 };
123 86
124 partition@e00000 { 87 nand@0 {
125 label = "boot"; 88 reg = <0>;
126 reg = <0x00e00000 0x3f200000>; 89 label = "pxa3xx_nand-0";
90 nand-rb = <0>;
91 nand-on-flash-bbt;
92
93 partitions {
94 compatible = "fixed-partitions";
95 #address-cells = <1>;
96 #size-cells = <1>;
97
98 partition@0 {
99 label = "u-boot";
100 reg = <0x00000000 0x000e0000>;
101 read-only;
102 };
103
104 partition@e0000 {
105 label = "u-boot-env";
106 reg = <0x000e0000 0x00020000>;
107 read-only;
108 };
109
110 partition@100000 {
111 label = "u-boot-env2";
112 reg = <0x00100000 0x00020000>;
113 read-only;
114 };
115
116 partition@120000 {
117 label = "zImage";
118 reg = <0x00120000 0x00400000>;
119 };
120
121 partition@520000 {
122 label = "initrd";
123 reg = <0x00520000 0x00400000>;
124 };
125
126 partition@e00000 {
127 label = "boot";
128 reg = <0x00e00000 0x3f200000>;
129 };
127 }; 130 };
128 }; 131 };
129 }; 132 };
diff --git a/arch/arm/boot/dts/tegra124-nyan.dtsi b/arch/arm/boot/dts/tegra124-nyan.dtsi
index d5f11d6d987e..bc85b6a166c7 100644
--- a/arch/arm/boot/dts/tegra124-nyan.dtsi
+++ b/arch/arm/boot/dts/tegra124-nyan.dtsi
@@ -13,10 +13,25 @@
13 stdout-path = "serial0:115200n8"; 13 stdout-path = "serial0:115200n8";
14 }; 14 };
15 15
16 memory@80000000 { 16 /*
17 * Note that recent version of the device tree compiler (starting with
18 * version 1.4.2) warn about this node containing a reg property, but
19 * missing a unit-address. However, the bootloader on these Chromebook
20 * devices relies on the full name of this node to be exactly /memory.
21 * Adding the unit-address causes the bootloader to create a /memory
22 * node and write the memory bank configuration to that node, which in
23 * turn leads the kernel to believe that the device has 2 GiB of
24 * memory instead of the amount detected by the bootloader.
25 *
26 * The name of this node is effectively ABI and must not be changed.
27 */
28 memory {
29 device_type = "memory";
17 reg = <0x0 0x80000000 0x0 0x80000000>; 30 reg = <0x0 0x80000000 0x0 0x80000000>;
18 }; 31 };
19 32
33 /delete-node/ memory@80000000;
34
20 host1x@50000000 { 35 host1x@50000000 {
21 hdmi@54280000 { 36 hdmi@54280000 {
22 status = "okay"; 37 status = "okay";
diff --git a/arch/arm/include/asm/irq.h b/arch/arm/include/asm/irq.h
index c883fcbe93b6..46d41140df27 100644
--- a/arch/arm/include/asm/irq.h
+++ b/arch/arm/include/asm/irq.h
@@ -25,7 +25,6 @@
25#ifndef __ASSEMBLY__ 25#ifndef __ASSEMBLY__
26struct irqaction; 26struct irqaction;
27struct pt_regs; 27struct pt_regs;
28extern void migrate_irqs(void);
29 28
30extern void asm_do_IRQ(unsigned int, struct pt_regs *); 29extern void asm_do_IRQ(unsigned int, struct pt_regs *);
31void handle_IRQ(unsigned int, struct pt_regs *); 30void handle_IRQ(unsigned int, struct pt_regs *);
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index 9908dacf9229..844861368cd5 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -31,7 +31,6 @@
31#include <linux/smp.h> 31#include <linux/smp.h>
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/seq_file.h> 33#include <linux/seq_file.h>
34#include <linux/ratelimit.h>
35#include <linux/errno.h> 34#include <linux/errno.h>
36#include <linux/list.h> 35#include <linux/list.h>
37#include <linux/kallsyms.h> 36#include <linux/kallsyms.h>
@@ -109,64 +108,3 @@ int __init arch_probe_nr_irqs(void)
109 return nr_irqs; 108 return nr_irqs;
110} 109}
111#endif 110#endif
112
113#ifdef CONFIG_HOTPLUG_CPU
114static bool migrate_one_irq(struct irq_desc *desc)
115{
116 struct irq_data *d = irq_desc_get_irq_data(desc);
117 const struct cpumask *affinity = irq_data_get_affinity_mask(d);
118 struct irq_chip *c;
119 bool ret = false;
120
121 /*
122 * If this is a per-CPU interrupt, or the affinity does not
123 * include this CPU, then we have nothing to do.
124 */
125 if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity))
126 return false;
127
128 if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) {
129 affinity = cpu_online_mask;
130 ret = true;
131 }
132
133 c = irq_data_get_irq_chip(d);
134 if (!c->irq_set_affinity)
135 pr_debug("IRQ%u: unable to set affinity\n", d->irq);
136 else if (c->irq_set_affinity(d, affinity, false) == IRQ_SET_MASK_OK && ret)
137 cpumask_copy(irq_data_get_affinity_mask(d), affinity);
138
139 return ret;
140}
141
142/*
143 * The current CPU has been marked offline. Migrate IRQs off this CPU.
144 * If the affinity settings do not allow other CPUs, force them onto any
145 * available CPU.
146 *
147 * Note: we must iterate over all IRQs, whether they have an attached
148 * action structure or not, as we need to get chained interrupts too.
149 */
150void migrate_irqs(void)
151{
152 unsigned int i;
153 struct irq_desc *desc;
154 unsigned long flags;
155
156 local_irq_save(flags);
157
158 for_each_irq_desc(i, desc) {
159 bool affinity_broken;
160
161 raw_spin_lock(&desc->lock);
162 affinity_broken = migrate_one_irq(desc);
163 raw_spin_unlock(&desc->lock);
164
165 if (affinity_broken)
166 pr_warn_ratelimited("IRQ%u no longer affine to CPU%u\n",
167 i, smp_processor_id());
168 }
169
170 local_irq_restore(flags);
171}
172#endif /* CONFIG_HOTPLUG_CPU */
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 3bf82232b1be..1d6f5ea522f4 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -254,7 +254,7 @@ int __cpu_disable(void)
254 /* 254 /*
255 * OK - migrate IRQs away from this CPU 255 * OK - migrate IRQs away from this CPU
256 */ 256 */
257 migrate_irqs(); 257 irq_migrate_all_off_this_cpu();
258 258
259 /* 259 /*
260 * Flush user cache and TLB mappings, and then remove this CPU 260 * Flush user cache and TLB mappings, and then remove this CPU
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index f1e2922e447c..1e3e08a1c456 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -2390,4 +2390,6 @@ void arch_teardown_dma_ops(struct device *dev)
2390 return; 2390 return;
2391 2391
2392 arm_teardown_iommu_dma_ops(dev); 2392 arm_teardown_iommu_dma_ops(dev);
2393 /* Let arch_setup_dma_ops() start again from scratch upon re-probe */
2394 set_dma_ops(dev, NULL);
2393} 2395}
diff --git a/arch/arm/probes/kprobes/opt-arm.c b/arch/arm/probes/kprobes/opt-arm.c
index 2c118a6ab358..0dc23fc227ed 100644
--- a/arch/arm/probes/kprobes/opt-arm.c
+++ b/arch/arm/probes/kprobes/opt-arm.c
@@ -247,7 +247,7 @@ int arch_prepare_optimized_kprobe(struct optimized_kprobe *op, struct kprobe *or
247 } 247 }
248 248
249 /* Copy arch-dep-instance from template. */ 249 /* Copy arch-dep-instance from template. */
250 memcpy(code, (unsigned char *)optprobe_template_entry, 250 memcpy(code, (unsigned long *)&optprobe_template_entry,
251 TMPL_END_IDX * sizeof(kprobe_opcode_t)); 251 TMPL_END_IDX * sizeof(kprobe_opcode_t));
252 252
253 /* Adjust buffer according to instruction. */ 253 /* Adjust buffer according to instruction. */
diff --git a/arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts b/arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts
index 5b4a9609e31f..2468762283a5 100644
--- a/arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts
+++ b/arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts
@@ -351,7 +351,7 @@
351 reg = <0>; 351 reg = <0>;
352 pinctrl-names = "default"; 352 pinctrl-names = "default";
353 pinctrl-0 = <&cp0_copper_eth_phy_reset>; 353 pinctrl-0 = <&cp0_copper_eth_phy_reset>;
354 reset-gpios = <&cp1_gpio1 11 GPIO_ACTIVE_LOW>; 354 reset-gpios = <&cp0_gpio2 11 GPIO_ACTIVE_LOW>;
355 reset-assert-us = <10000>; 355 reset-assert-us = <10000>;
356 }; 356 };
357 357
diff --git a/arch/arm64/include/asm/neon-intrinsics.h b/arch/arm64/include/asm/neon-intrinsics.h
index 2ba6c6b9541f..71abfc7612b2 100644
--- a/arch/arm64/include/asm/neon-intrinsics.h
+++ b/arch/arm64/include/asm/neon-intrinsics.h
@@ -36,4 +36,8 @@
36#include <arm_neon.h> 36#include <arm_neon.h>
37#endif 37#endif
38 38
39#ifdef CONFIG_CC_IS_CLANG
40#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
41#endif
42
39#endif /* __ASM_NEON_INTRINSICS_H */ 43#endif /* __ASM_NEON_INTRINSICS_H */
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index 15d79a8e5e5e..eecf7927dab0 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -539,8 +539,7 @@ set_hcr:
539 /* GICv3 system register access */ 539 /* GICv3 system register access */
540 mrs x0, id_aa64pfr0_el1 540 mrs x0, id_aa64pfr0_el1
541 ubfx x0, x0, #24, #4 541 ubfx x0, x0, #24, #4
542 cmp x0, #1 542 cbz x0, 3f
543 b.ne 3f
544 543
545 mrs_s x0, SYS_ICC_SRE_EL2 544 mrs_s x0, SYS_ICC_SRE_EL2
546 orr x0, x0, #ICC_SRE_EL2_SRE // Set ICC_SRE_EL2.SRE==1 545 orr x0, x0, #ICC_SRE_EL2_SRE // Set ICC_SRE_EL2.SRE==1
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index 9dce33b0e260..ddaea0fd2fa4 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -1702,19 +1702,20 @@ void syscall_trace_exit(struct pt_regs *regs)
1702} 1702}
1703 1703
1704/* 1704/*
1705 * SPSR_ELx bits which are always architecturally RES0 per ARM DDI 0487C.a 1705 * SPSR_ELx bits which are always architecturally RES0 per ARM DDI 0487D.a.
1706 * We also take into account DIT (bit 24), which is not yet documented, and 1706 * We permit userspace to set SSBS (AArch64 bit 12, AArch32 bit 23) which is
1707 * treat PAN and UAO as RES0 bits, as they are meaningless at EL0, and may be 1707 * not described in ARM DDI 0487D.a.
1708 * allocated an EL0 meaning in future. 1708 * We treat PAN and UAO as RES0 bits, as they are meaningless at EL0, and may
1709 * be allocated an EL0 meaning in future.
1709 * Userspace cannot use these until they have an architectural meaning. 1710 * Userspace cannot use these until they have an architectural meaning.
1710 * Note that this follows the SPSR_ELx format, not the AArch32 PSR format. 1711 * Note that this follows the SPSR_ELx format, not the AArch32 PSR format.
1711 * We also reserve IL for the kernel; SS is handled dynamically. 1712 * We also reserve IL for the kernel; SS is handled dynamically.
1712 */ 1713 */
1713#define SPSR_EL1_AARCH64_RES0_BITS \ 1714#define SPSR_EL1_AARCH64_RES0_BITS \
1714 (GENMASK_ULL(63,32) | GENMASK_ULL(27, 25) | GENMASK_ULL(23, 22) | \ 1715 (GENMASK_ULL(63, 32) | GENMASK_ULL(27, 25) | GENMASK_ULL(23, 22) | \
1715 GENMASK_ULL(20, 10) | GENMASK_ULL(5, 5)) 1716 GENMASK_ULL(20, 13) | GENMASK_ULL(11, 10) | GENMASK_ULL(5, 5))
1716#define SPSR_EL1_AARCH32_RES0_BITS \ 1717#define SPSR_EL1_AARCH32_RES0_BITS \
1717 (GENMASK_ULL(63,32) | GENMASK_ULL(23, 22) | GENMASK_ULL(20,20)) 1718 (GENMASK_ULL(63, 32) | GENMASK_ULL(22, 22) | GENMASK_ULL(20, 20))
1718 1719
1719static int valid_compat_regs(struct user_pt_regs *regs) 1720static int valid_compat_regs(struct user_pt_regs *regs)
1720{ 1721{
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index d09ec76f08cf..009849328289 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -339,6 +339,9 @@ void __init setup_arch(char **cmdline_p)
339 smp_init_cpus(); 339 smp_init_cpus();
340 smp_build_mpidr_hash(); 340 smp_build_mpidr_hash();
341 341
342 /* Init percpu seeds for random tags after cpus are set up. */
343 kasan_init_tags();
344
342#ifdef CONFIG_ARM64_SW_TTBR0_PAN 345#ifdef CONFIG_ARM64_SW_TTBR0_PAN
343 /* 346 /*
344 * Make sure init_thread_info.ttbr0 always generates translation 347 * Make sure init_thread_info.ttbr0 always generates translation
diff --git a/arch/arm64/mm/kasan_init.c b/arch/arm64/mm/kasan_init.c
index 4b55b15707a3..f37a86d2a69d 100644
--- a/arch/arm64/mm/kasan_init.c
+++ b/arch/arm64/mm/kasan_init.c
@@ -252,8 +252,6 @@ void __init kasan_init(void)
252 memset(kasan_early_shadow_page, KASAN_SHADOW_INIT, PAGE_SIZE); 252 memset(kasan_early_shadow_page, KASAN_SHADOW_INIT, PAGE_SIZE);
253 cpu_replace_ttbr1(lm_alias(swapper_pg_dir)); 253 cpu_replace_ttbr1(lm_alias(swapper_pg_dir));
254 254
255 kasan_init_tags();
256
257 /* At this point kasan is fully initialized. Enable error messages */ 255 /* At this point kasan is fully initialized. Enable error messages */
258 init_task.kasan_depth = 0; 256 init_task.kasan_depth = 0;
259 pr_info("KernelAddressSanitizer initialized\n"); 257 pr_info("KernelAddressSanitizer initialized\n");
diff --git a/arch/mips/net/ebpf_jit.c b/arch/mips/net/ebpf_jit.c
index b16710a8a9e7..76e9bf88d3b9 100644
--- a/arch/mips/net/ebpf_jit.c
+++ b/arch/mips/net/ebpf_jit.c
@@ -79,8 +79,6 @@ enum reg_val_type {
79 REG_64BIT_32BIT, 79 REG_64BIT_32BIT,
80 /* 32-bit compatible, need truncation for 64-bit ops. */ 80 /* 32-bit compatible, need truncation for 64-bit ops. */
81 REG_32BIT, 81 REG_32BIT,
82 /* 32-bit zero extended. */
83 REG_32BIT_ZERO_EX,
84 /* 32-bit no sign/zero extension needed. */ 82 /* 32-bit no sign/zero extension needed. */
85 REG_32BIT_POS 83 REG_32BIT_POS
86}; 84};
@@ -343,12 +341,15 @@ static int build_int_epilogue(struct jit_ctx *ctx, int dest_reg)
343 const struct bpf_prog *prog = ctx->skf; 341 const struct bpf_prog *prog = ctx->skf;
344 int stack_adjust = ctx->stack_size; 342 int stack_adjust = ctx->stack_size;
345 int store_offset = stack_adjust - 8; 343 int store_offset = stack_adjust - 8;
344 enum reg_val_type td;
346 int r0 = MIPS_R_V0; 345 int r0 = MIPS_R_V0;
347 346
348 if (dest_reg == MIPS_R_RA && 347 if (dest_reg == MIPS_R_RA) {
349 get_reg_val_type(ctx, prog->len, BPF_REG_0) == REG_32BIT_ZERO_EX)
350 /* Don't let zero extended value escape. */ 348 /* Don't let zero extended value escape. */
351 emit_instr(ctx, sll, r0, r0, 0); 349 td = get_reg_val_type(ctx, prog->len, BPF_REG_0);
350 if (td == REG_64BIT)
351 emit_instr(ctx, sll, r0, r0, 0);
352 }
352 353
353 if (ctx->flags & EBPF_SAVE_RA) { 354 if (ctx->flags & EBPF_SAVE_RA) {
354 emit_instr(ctx, ld, MIPS_R_RA, store_offset, MIPS_R_SP); 355 emit_instr(ctx, ld, MIPS_R_RA, store_offset, MIPS_R_SP);
@@ -692,7 +693,7 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
692 if (dst < 0) 693 if (dst < 0)
693 return dst; 694 return dst;
694 td = get_reg_val_type(ctx, this_idx, insn->dst_reg); 695 td = get_reg_val_type(ctx, this_idx, insn->dst_reg);
695 if (td == REG_64BIT || td == REG_32BIT_ZERO_EX) { 696 if (td == REG_64BIT) {
696 /* sign extend */ 697 /* sign extend */
697 emit_instr(ctx, sll, dst, dst, 0); 698 emit_instr(ctx, sll, dst, dst, 0);
698 } 699 }
@@ -707,7 +708,7 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
707 if (dst < 0) 708 if (dst < 0)
708 return dst; 709 return dst;
709 td = get_reg_val_type(ctx, this_idx, insn->dst_reg); 710 td = get_reg_val_type(ctx, this_idx, insn->dst_reg);
710 if (td == REG_64BIT || td == REG_32BIT_ZERO_EX) { 711 if (td == REG_64BIT) {
711 /* sign extend */ 712 /* sign extend */
712 emit_instr(ctx, sll, dst, dst, 0); 713 emit_instr(ctx, sll, dst, dst, 0);
713 } 714 }
@@ -721,7 +722,7 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
721 if (dst < 0) 722 if (dst < 0)
722 return dst; 723 return dst;
723 td = get_reg_val_type(ctx, this_idx, insn->dst_reg); 724 td = get_reg_val_type(ctx, this_idx, insn->dst_reg);
724 if (td == REG_64BIT || td == REG_32BIT_ZERO_EX) 725 if (td == REG_64BIT)
725 /* sign extend */ 726 /* sign extend */
726 emit_instr(ctx, sll, dst, dst, 0); 727 emit_instr(ctx, sll, dst, dst, 0);
727 if (insn->imm == 1) { 728 if (insn->imm == 1) {
@@ -860,13 +861,13 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
860 if (src < 0 || dst < 0) 861 if (src < 0 || dst < 0)
861 return -EINVAL; 862 return -EINVAL;
862 td = get_reg_val_type(ctx, this_idx, insn->dst_reg); 863 td = get_reg_val_type(ctx, this_idx, insn->dst_reg);
863 if (td == REG_64BIT || td == REG_32BIT_ZERO_EX) { 864 if (td == REG_64BIT) {
864 /* sign extend */ 865 /* sign extend */
865 emit_instr(ctx, sll, dst, dst, 0); 866 emit_instr(ctx, sll, dst, dst, 0);
866 } 867 }
867 did_move = false; 868 did_move = false;
868 ts = get_reg_val_type(ctx, this_idx, insn->src_reg); 869 ts = get_reg_val_type(ctx, this_idx, insn->src_reg);
869 if (ts == REG_64BIT || ts == REG_32BIT_ZERO_EX) { 870 if (ts == REG_64BIT) {
870 int tmp_reg = MIPS_R_AT; 871 int tmp_reg = MIPS_R_AT;
871 872
872 if (bpf_op == BPF_MOV) { 873 if (bpf_op == BPF_MOV) {
@@ -1254,8 +1255,7 @@ jeq_common:
1254 if (insn->imm == 64 && td == REG_32BIT) 1255 if (insn->imm == 64 && td == REG_32BIT)
1255 emit_instr(ctx, dinsu, dst, MIPS_R_ZERO, 32, 32); 1256 emit_instr(ctx, dinsu, dst, MIPS_R_ZERO, 32, 32);
1256 1257
1257 if (insn->imm != 64 && 1258 if (insn->imm != 64 && td == REG_64BIT) {
1258 (td == REG_64BIT || td == REG_32BIT_ZERO_EX)) {
1259 /* sign extend */ 1259 /* sign extend */
1260 emit_instr(ctx, sll, dst, dst, 0); 1260 emit_instr(ctx, sll, dst, dst, 0);
1261 } 1261 }
diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c
index 2582df1c529b..0964c236e3e5 100644
--- a/arch/parisc/kernel/ptrace.c
+++ b/arch/parisc/kernel/ptrace.c
@@ -308,15 +308,29 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
308 308
309long do_syscall_trace_enter(struct pt_regs *regs) 309long do_syscall_trace_enter(struct pt_regs *regs)
310{ 310{
311 if (test_thread_flag(TIF_SYSCALL_TRACE) && 311 if (test_thread_flag(TIF_SYSCALL_TRACE)) {
312 tracehook_report_syscall_entry(regs)) { 312 int rc = tracehook_report_syscall_entry(regs);
313
313 /* 314 /*
314 * Tracing decided this syscall should not happen or the 315 * As tracesys_next does not set %r28 to -ENOSYS
315 * debugger stored an invalid system call number. Skip 316 * when %r20 is set to -1, initialize it here.
316 * the system call and the system call restart handling.
317 */ 317 */
318 regs->gr[20] = -1UL; 318 regs->gr[28] = -ENOSYS;
319 goto out; 319
320 if (rc) {
321 /*
322 * A nonzero return code from
323 * tracehook_report_syscall_entry() tells us
324 * to prevent the syscall execution. Skip
325 * the syscall call and the syscall restart handling.
326 *
327 * Note that the tracer may also just change
328 * regs->gr[20] to an invalid syscall number,
329 * that is handled by tracesys_next.
330 */
331 regs->gr[20] = -1UL;
332 return -1;
333 }
320 } 334 }
321 335
322 /* Do the secure computing check after ptrace. */ 336 /* Do the secure computing check after ptrace. */
@@ -340,7 +354,6 @@ long do_syscall_trace_enter(struct pt_regs *regs)
340 regs->gr[24] & 0xffffffff, 354 regs->gr[24] & 0xffffffff,
341 regs->gr[23] & 0xffffffff); 355 regs->gr[23] & 0xffffffff);
342 356
343out:
344 /* 357 /*
345 * Sign extend the syscall number to 64bit since it may have been 358 * Sign extend the syscall number to 64bit since it may have been
346 * modified by a compat ptrace call 359 * modified by a compat ptrace call
diff --git a/arch/sh/boot/dts/Makefile b/arch/sh/boot/dts/Makefile
index 01d0f7fb14cc..2563d1e532e2 100644
--- a/arch/sh/boot/dts/Makefile
+++ b/arch/sh/boot/dts/Makefile
@@ -1,3 +1,3 @@
1ifneq ($(CONFIG_BUILTIN_DTB_SOURCE),"") 1ifneq ($(CONFIG_BUILTIN_DTB_SOURCE),"")
2obj-y += $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_SOURCE)).dtb.o 2obj-$(CONFIG_USE_BUILTIN_DTB) += $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_SOURCE)).dtb.o
3endif 3endif
diff --git a/crypto/af_alg.c b/crypto/af_alg.c
index 17eb09d222ff..ec78a04eb136 100644
--- a/crypto/af_alg.c
+++ b/crypto/af_alg.c
@@ -122,8 +122,10 @@ static void alg_do_release(const struct af_alg_type *type, void *private)
122 122
123int af_alg_release(struct socket *sock) 123int af_alg_release(struct socket *sock)
124{ 124{
125 if (sock->sk) 125 if (sock->sk) {
126 sock_put(sock->sk); 126 sock_put(sock->sk);
127 sock->sk = NULL;
128 }
127 return 0; 129 return 0;
128} 130}
129EXPORT_SYMBOL_GPL(af_alg_release); 131EXPORT_SYMBOL_GPL(af_alg_release);
diff --git a/drivers/clk/at91/at91sam9x5.c b/drivers/clk/at91/at91sam9x5.c
index 2fe225a697df..3487e03d4bc6 100644
--- a/drivers/clk/at91/at91sam9x5.c
+++ b/drivers/clk/at91/at91sam9x5.c
@@ -144,8 +144,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
144 return; 144 return;
145 145
146 at91sam9x5_pmc = pmc_data_allocate(PMC_MAIN + 1, 146 at91sam9x5_pmc = pmc_data_allocate(PMC_MAIN + 1,
147 nck(at91sam9x5_systemck), 147 nck(at91sam9x5_systemck), 31, 0);
148 nck(at91sam9x35_periphck), 0);
149 if (!at91sam9x5_pmc) 148 if (!at91sam9x5_pmc)
150 return; 149 return;
151 150
@@ -210,7 +209,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
210 parent_names[1] = "mainck"; 209 parent_names[1] = "mainck";
211 parent_names[2] = "plladivck"; 210 parent_names[2] = "plladivck";
212 parent_names[3] = "utmick"; 211 parent_names[3] = "utmick";
213 parent_names[4] = "mck"; 212 parent_names[4] = "masterck";
214 for (i = 0; i < 2; i++) { 213 for (i = 0; i < 2; i++) {
215 char name[6]; 214 char name[6];
216 215
diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c
index d69ad96fe988..cd0ef7274fdb 100644
--- a/drivers/clk/at91/sama5d2.c
+++ b/drivers/clk/at91/sama5d2.c
@@ -240,7 +240,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
240 parent_names[1] = "mainck"; 240 parent_names[1] = "mainck";
241 parent_names[2] = "plladivck"; 241 parent_names[2] = "plladivck";
242 parent_names[3] = "utmick"; 242 parent_names[3] = "utmick";
243 parent_names[4] = "mck"; 243 parent_names[4] = "masterck";
244 for (i = 0; i < 3; i++) { 244 for (i = 0; i < 3; i++) {
245 char name[6]; 245 char name[6];
246 246
@@ -291,7 +291,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
291 parent_names[1] = "mainck"; 291 parent_names[1] = "mainck";
292 parent_names[2] = "plladivck"; 292 parent_names[2] = "plladivck";
293 parent_names[3] = "utmick"; 293 parent_names[3] = "utmick";
294 parent_names[4] = "mck"; 294 parent_names[4] = "masterck";
295 parent_names[5] = "audiopll_pmcck"; 295 parent_names[5] = "audiopll_pmcck";
296 for (i = 0; i < ARRAY_SIZE(sama5d2_gck); i++) { 296 for (i = 0; i < ARRAY_SIZE(sama5d2_gck); i++) {
297 hw = at91_clk_register_generated(regmap, &pmc_pcr_lock, 297 hw = at91_clk_register_generated(regmap, &pmc_pcr_lock,
diff --git a/drivers/clk/at91/sama5d4.c b/drivers/clk/at91/sama5d4.c
index e358be7f6c8d..b645a9d59cdb 100644
--- a/drivers/clk/at91/sama5d4.c
+++ b/drivers/clk/at91/sama5d4.c
@@ -207,7 +207,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
207 parent_names[1] = "mainck"; 207 parent_names[1] = "mainck";
208 parent_names[2] = "plladivck"; 208 parent_names[2] = "plladivck";
209 parent_names[3] = "utmick"; 209 parent_names[3] = "utmick";
210 parent_names[4] = "mck"; 210 parent_names[4] = "masterck";
211 for (i = 0; i < 3; i++) { 211 for (i = 0; i < 3; i++) {
212 char name[6]; 212 char name[6];
213 213
diff --git a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c
index 3b97f60540ad..609970c0b666 100644
--- a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c
+++ b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c
@@ -264,9 +264,9 @@ static SUNXI_CCU_GATE(ahb1_mmc1_clk, "ahb1-mmc1", "ahb1",
264static SUNXI_CCU_GATE(ahb1_mmc2_clk, "ahb1-mmc2", "ahb1", 264static SUNXI_CCU_GATE(ahb1_mmc2_clk, "ahb1-mmc2", "ahb1",
265 0x060, BIT(10), 0); 265 0x060, BIT(10), 0);
266static SUNXI_CCU_GATE(ahb1_mmc3_clk, "ahb1-mmc3", "ahb1", 266static SUNXI_CCU_GATE(ahb1_mmc3_clk, "ahb1-mmc3", "ahb1",
267 0x060, BIT(12), 0); 267 0x060, BIT(11), 0);
268static SUNXI_CCU_GATE(ahb1_nand1_clk, "ahb1-nand1", "ahb1", 268static SUNXI_CCU_GATE(ahb1_nand1_clk, "ahb1-nand1", "ahb1",
269 0x060, BIT(13), 0); 269 0x060, BIT(12), 0);
270static SUNXI_CCU_GATE(ahb1_nand0_clk, "ahb1-nand0", "ahb1", 270static SUNXI_CCU_GATE(ahb1_nand0_clk, "ahb1-nand0", "ahb1",
271 0x060, BIT(13), 0); 271 0x060, BIT(13), 0);
272static SUNXI_CCU_GATE(ahb1_sdram_clk, "ahb1-sdram", "ahb1", 272static SUNXI_CCU_GATE(ahb1_sdram_clk, "ahb1-sdram", "ahb1",
diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c
index 621b1cd996db..ac12f261f8ca 100644
--- a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c
+++ b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c
@@ -542,7 +542,7 @@ static struct ccu_reset_map sun8i_v3s_ccu_resets[] = {
542 [RST_BUS_OHCI0] = { 0x2c0, BIT(29) }, 542 [RST_BUS_OHCI0] = { 0x2c0, BIT(29) },
543 543
544 [RST_BUS_VE] = { 0x2c4, BIT(0) }, 544 [RST_BUS_VE] = { 0x2c4, BIT(0) },
545 [RST_BUS_TCON0] = { 0x2c4, BIT(3) }, 545 [RST_BUS_TCON0] = { 0x2c4, BIT(4) },
546 [RST_BUS_CSI] = { 0x2c4, BIT(8) }, 546 [RST_BUS_CSI] = { 0x2c4, BIT(8) },
547 [RST_BUS_DE] = { 0x2c4, BIT(12) }, 547 [RST_BUS_DE] = { 0x2c4, BIT(12) },
548 [RST_BUS_DBG] = { 0x2c4, BIT(31) }, 548 [RST_BUS_DBG] = { 0x2c4, BIT(31) },
diff --git a/drivers/gpio/gpio-mt7621.c b/drivers/gpio/gpio-mt7621.c
index 00e954f22bc9..74401e0adb29 100644
--- a/drivers/gpio/gpio-mt7621.c
+++ b/drivers/gpio/gpio-mt7621.c
@@ -30,6 +30,7 @@
30#define GPIO_REG_EDGE 0xA0 30#define GPIO_REG_EDGE 0xA0
31 31
32struct mtk_gc { 32struct mtk_gc {
33 struct irq_chip irq_chip;
33 struct gpio_chip chip; 34 struct gpio_chip chip;
34 spinlock_t lock; 35 spinlock_t lock;
35 int bank; 36 int bank;
@@ -189,13 +190,6 @@ mediatek_gpio_irq_type(struct irq_data *d, unsigned int type)
189 return 0; 190 return 0;
190} 191}
191 192
192static struct irq_chip mediatek_gpio_irq_chip = {
193 .irq_unmask = mediatek_gpio_irq_unmask,
194 .irq_mask = mediatek_gpio_irq_mask,
195 .irq_mask_ack = mediatek_gpio_irq_mask,
196 .irq_set_type = mediatek_gpio_irq_type,
197};
198
199static int 193static int
200mediatek_gpio_xlate(struct gpio_chip *chip, 194mediatek_gpio_xlate(struct gpio_chip *chip,
201 const struct of_phandle_args *spec, u32 *flags) 195 const struct of_phandle_args *spec, u32 *flags)
@@ -254,6 +248,13 @@ mediatek_gpio_bank_probe(struct device *dev,
254 return ret; 248 return ret;
255 } 249 }
256 250
251 rg->irq_chip.name = dev_name(dev);
252 rg->irq_chip.parent_device = dev;
253 rg->irq_chip.irq_unmask = mediatek_gpio_irq_unmask;
254 rg->irq_chip.irq_mask = mediatek_gpio_irq_mask;
255 rg->irq_chip.irq_mask_ack = mediatek_gpio_irq_mask;
256 rg->irq_chip.irq_set_type = mediatek_gpio_irq_type;
257
257 if (mtk->gpio_irq) { 258 if (mtk->gpio_irq) {
258 /* 259 /*
259 * Manually request the irq here instead of passing 260 * Manually request the irq here instead of passing
@@ -270,14 +271,14 @@ mediatek_gpio_bank_probe(struct device *dev,
270 return ret; 271 return ret;
271 } 272 }
272 273
273 ret = gpiochip_irqchip_add(&rg->chip, &mediatek_gpio_irq_chip, 274 ret = gpiochip_irqchip_add(&rg->chip, &rg->irq_chip,
274 0, handle_simple_irq, IRQ_TYPE_NONE); 275 0, handle_simple_irq, IRQ_TYPE_NONE);
275 if (ret) { 276 if (ret) {
276 dev_err(dev, "failed to add gpiochip_irqchip\n"); 277 dev_err(dev, "failed to add gpiochip_irqchip\n");
277 return ret; 278 return ret;
278 } 279 }
279 280
280 gpiochip_set_chained_irqchip(&rg->chip, &mediatek_gpio_irq_chip, 281 gpiochip_set_chained_irqchip(&rg->chip, &rg->irq_chip,
281 mtk->gpio_irq, NULL); 282 mtk->gpio_irq, NULL);
282 } 283 }
283 284
@@ -310,7 +311,6 @@ mediatek_gpio_probe(struct platform_device *pdev)
310 mtk->gpio_irq = irq_of_parse_and_map(np, 0); 311 mtk->gpio_irq = irq_of_parse_and_map(np, 0);
311 mtk->dev = dev; 312 mtk->dev = dev;
312 platform_set_drvdata(pdev, mtk); 313 platform_set_drvdata(pdev, mtk);
313 mediatek_gpio_irq_chip.name = dev_name(dev);
314 314
315 for (i = 0; i < MTK_BANK_CNT; i++) { 315 for (i = 0; i < MTK_BANK_CNT; i++) {
316 ret = mediatek_gpio_bank_probe(dev, np, i); 316 ret = mediatek_gpio_bank_probe(dev, np, i);
diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index e9600b556f39..bcc6be4a5cb2 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -245,6 +245,7 @@ static bool pxa_gpio_has_pinctrl(void)
245{ 245{
246 switch (gpio_type) { 246 switch (gpio_type) {
247 case PXA3XX_GPIO: 247 case PXA3XX_GPIO:
248 case MMP2_GPIO:
248 return false; 249 return false;
249 250
250 default: 251 default:
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index bc62bf41b7e9..5dc349173e4f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -212,6 +212,7 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags)
212 } 212 }
213 213
214 if (amdgpu_device_is_px(dev)) { 214 if (amdgpu_device_is_px(dev)) {
215 dev_pm_set_driver_flags(dev->dev, DPM_FLAG_NEVER_SKIP);
215 pm_runtime_use_autosuspend(dev->dev); 216 pm_runtime_use_autosuspend(dev->dev);
216 pm_runtime_set_autosuspend_delay(dev->dev, 5000); 217 pm_runtime_set_autosuspend_delay(dev->dev, 5000);
217 pm_runtime_set_active(dev->dev); 218 pm_runtime_set_active(dev->dev);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 7c108e687683..698bcb8ce61d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -638,12 +638,14 @@ void amdgpu_vm_move_to_lru_tail(struct amdgpu_device *adev,
638 struct ttm_bo_global *glob = adev->mman.bdev.glob; 638 struct ttm_bo_global *glob = adev->mman.bdev.glob;
639 struct amdgpu_vm_bo_base *bo_base; 639 struct amdgpu_vm_bo_base *bo_base;
640 640
641#if 0
641 if (vm->bulk_moveable) { 642 if (vm->bulk_moveable) {
642 spin_lock(&glob->lru_lock); 643 spin_lock(&glob->lru_lock);
643 ttm_bo_bulk_move_lru_tail(&vm->lru_bulk_move); 644 ttm_bo_bulk_move_lru_tail(&vm->lru_bulk_move);
644 spin_unlock(&glob->lru_lock); 645 spin_unlock(&glob->lru_lock);
645 return; 646 return;
646 } 647 }
648#endif
647 649
648 memset(&vm->lru_bulk_move, 0, sizeof(vm->lru_bulk_move)); 650 memset(&vm->lru_bulk_move, 0, sizeof(vm->lru_bulk_move));
649 651
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
index 6811a5d05b27..aa2f71cc1eba 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
@@ -128,7 +128,7 @@ static const struct soc15_reg_golden golden_settings_sdma0_4_2_init[] = {
128 128
129static const struct soc15_reg_golden golden_settings_sdma0_4_2[] = 129static const struct soc15_reg_golden golden_settings_sdma0_4_2[] =
130{ 130{
131 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_CHICKEN_BITS, 0xfe931f07, 0x02831d07), 131 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_CHICKEN_BITS, 0xfe931f07, 0x02831f07),
132 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_CLK_CTRL, 0xffffffff, 0x3f000100), 132 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_CLK_CTRL, 0xffffffff, 0x3f000100),
133 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG, 0x0000773f, 0x00004002), 133 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG, 0x0000773f, 0x00004002),
134 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG_READ, 0x0000773f, 0x00004002), 134 SOC15_REG_GOLDEN_VALUE(SDMA0, 0, mmSDMA0_GB_ADDR_CONFIG_READ, 0x0000773f, 0x00004002),
@@ -158,7 +158,7 @@ static const struct soc15_reg_golden golden_settings_sdma0_4_2[] =
158}; 158};
159 159
160static const struct soc15_reg_golden golden_settings_sdma1_4_2[] = { 160static const struct soc15_reg_golden golden_settings_sdma1_4_2[] = {
161 SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CHICKEN_BITS, 0xfe931f07, 0x02831d07), 161 SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CHICKEN_BITS, 0xfe931f07, 0x02831f07),
162 SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CLK_CTRL, 0xffffffff, 0x3f000100), 162 SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_CLK_CTRL, 0xffffffff, 0x3f000100),
163 SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG, 0x0000773f, 0x00004002), 163 SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG, 0x0000773f, 0x00004002),
164 SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG_READ, 0x0000773f, 0x00004002), 164 SOC15_REG_GOLDEN_VALUE(SDMA1, 0, mmSDMA1_GB_ADDR_CONFIG_READ, 0x0000773f, 0x00004002),
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 0b392bfca284..5296b8f3e0ab 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -786,12 +786,13 @@ static int dm_suspend(void *handle)
786 struct amdgpu_display_manager *dm = &adev->dm; 786 struct amdgpu_display_manager *dm = &adev->dm;
787 int ret = 0; 787 int ret = 0;
788 788
789 WARN_ON(adev->dm.cached_state);
790 adev->dm.cached_state = drm_atomic_helper_suspend(adev->ddev);
791
789 s3_handle_mst(adev->ddev, true); 792 s3_handle_mst(adev->ddev, true);
790 793
791 amdgpu_dm_irq_suspend(adev); 794 amdgpu_dm_irq_suspend(adev);
792 795
793 WARN_ON(adev->dm.cached_state);
794 adev->dm.cached_state = drm_atomic_helper_suspend(adev->ddev);
795 796
796 dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D3); 797 dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D3);
797 798
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c
index 19801bdba0d2..7a72ee46f14b 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c
@@ -662,6 +662,11 @@ static void dce11_update_clocks(struct clk_mgr *clk_mgr,
662{ 662{
663 struct dce_clk_mgr *clk_mgr_dce = TO_DCE_CLK_MGR(clk_mgr); 663 struct dce_clk_mgr *clk_mgr_dce = TO_DCE_CLK_MGR(clk_mgr);
664 struct dm_pp_power_level_change_request level_change_req; 664 struct dm_pp_power_level_change_request level_change_req;
665 int patched_disp_clk = context->bw.dce.dispclk_khz;
666
667 /*TODO: W/A for dal3 linux, investigate why this works */
668 if (!clk_mgr_dce->dfs_bypass_active)
669 patched_disp_clk = patched_disp_clk * 115 / 100;
665 670
666 level_change_req.power_level = dce_get_required_clocks_state(clk_mgr, context); 671 level_change_req.power_level = dce_get_required_clocks_state(clk_mgr, context);
667 /* get max clock state from PPLIB */ 672 /* get max clock state from PPLIB */
@@ -671,9 +676,9 @@ static void dce11_update_clocks(struct clk_mgr *clk_mgr,
671 clk_mgr_dce->cur_min_clks_state = level_change_req.power_level; 676 clk_mgr_dce->cur_min_clks_state = level_change_req.power_level;
672 } 677 }
673 678
674 if (should_set_clock(safe_to_lower, context->bw.dce.dispclk_khz, clk_mgr->clks.dispclk_khz)) { 679 if (should_set_clock(safe_to_lower, patched_disp_clk, clk_mgr->clks.dispclk_khz)) {
675 context->bw.dce.dispclk_khz = dce_set_clock(clk_mgr, context->bw.dce.dispclk_khz); 680 context->bw.dce.dispclk_khz = dce_set_clock(clk_mgr, patched_disp_clk);
676 clk_mgr->clks.dispclk_khz = context->bw.dce.dispclk_khz; 681 clk_mgr->clks.dispclk_khz = patched_disp_clk;
677 } 682 }
678 dce11_pplib_apply_display_requirements(clk_mgr->ctx->dc, context); 683 dce11_pplib_apply_display_requirements(clk_mgr->ctx->dc, context);
679} 684}
diff --git a/drivers/gpu/drm/amd/display/dc/dce100/dce100_hw_sequencer.h b/drivers/gpu/drm/amd/display/dc/dce100/dce100_hw_sequencer.h
index acd418515346..a6b80fdaa666 100644
--- a/drivers/gpu/drm/amd/display/dc/dce100/dce100_hw_sequencer.h
+++ b/drivers/gpu/drm/amd/display/dc/dce100/dce100_hw_sequencer.h
@@ -37,6 +37,10 @@ void dce100_prepare_bandwidth(
37 struct dc *dc, 37 struct dc *dc,
38 struct dc_state *context); 38 struct dc_state *context);
39 39
40void dce100_optimize_bandwidth(
41 struct dc *dc,
42 struct dc_state *context);
43
40bool dce100_enable_display_power_gating(struct dc *dc, uint8_t controller_id, 44bool dce100_enable_display_power_gating(struct dc *dc, uint8_t controller_id,
41 struct dc_bios *dcb, 45 struct dc_bios *dcb,
42 enum pipe_gating_control power_gating); 46 enum pipe_gating_control power_gating);
diff --git a/drivers/gpu/drm/amd/display/dc/dce80/dce80_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dce80/dce80_hw_sequencer.c
index a60a90e68d91..c4543178ba20 100644
--- a/drivers/gpu/drm/amd/display/dc/dce80/dce80_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dce80/dce80_hw_sequencer.c
@@ -77,6 +77,6 @@ void dce80_hw_sequencer_construct(struct dc *dc)
77 dc->hwss.enable_display_power_gating = dce100_enable_display_power_gating; 77 dc->hwss.enable_display_power_gating = dce100_enable_display_power_gating;
78 dc->hwss.pipe_control_lock = dce_pipe_control_lock; 78 dc->hwss.pipe_control_lock = dce_pipe_control_lock;
79 dc->hwss.prepare_bandwidth = dce100_prepare_bandwidth; 79 dc->hwss.prepare_bandwidth = dce100_prepare_bandwidth;
80 dc->hwss.optimize_bandwidth = dce100_prepare_bandwidth; 80 dc->hwss.optimize_bandwidth = dce100_optimize_bandwidth;
81} 81}
82 82
diff --git a/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c b/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
index cdd1d6b7b9f2..4e9ea50141bd 100644
--- a/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
@@ -790,9 +790,22 @@ bool dce80_validate_bandwidth(
790 struct dc *dc, 790 struct dc *dc,
791 struct dc_state *context) 791 struct dc_state *context)
792{ 792{
793 /* TODO implement when needed but for now hardcode max value*/ 793 int i;
794 context->bw.dce.dispclk_khz = 681000; 794 bool at_least_one_pipe = false;
795 context->bw.dce.yclk_khz = 250000 * MEMORY_TYPE_MULTIPLIER_CZ; 795
796 for (i = 0; i < dc->res_pool->pipe_count; i++) {
797 if (context->res_ctx.pipe_ctx[i].stream)
798 at_least_one_pipe = true;
799 }
800
801 if (at_least_one_pipe) {
802 /* TODO implement when needed but for now hardcode max value*/
803 context->bw.dce.dispclk_khz = 681000;
804 context->bw.dce.yclk_khz = 250000 * MEMORY_TYPE_MULTIPLIER_CZ;
805 } else {
806 context->bw.dce.dispclk_khz = 0;
807 context->bw.dce.yclk_khz = 0;
808 }
796 809
797 return true; 810 return true;
798} 811}
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
index 58a12ddf12f3..41883c981789 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
@@ -2658,8 +2658,8 @@ static void dcn10_set_cursor_position(struct pipe_ctx *pipe_ctx)
2658 .mirror = pipe_ctx->plane_state->horizontal_mirror 2658 .mirror = pipe_ctx->plane_state->horizontal_mirror
2659 }; 2659 };
2660 2660
2661 pos_cpy.x -= pipe_ctx->plane_state->dst_rect.x; 2661 pos_cpy.x_hotspot += pipe_ctx->plane_state->dst_rect.x;
2662 pos_cpy.y -= pipe_ctx->plane_state->dst_rect.y; 2662 pos_cpy.y_hotspot += pipe_ctx->plane_state->dst_rect.y;
2663 2663
2664 if (pipe_ctx->plane_state->address.type 2664 if (pipe_ctx->plane_state->address.type
2665 == PLN_ADDR_TYPE_VIDEO_PROGRESSIVE) 2665 == PLN_ADDR_TYPE_VIDEO_PROGRESSIVE)
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 7f365ac0b549..4ee16b264dbe 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -336,8 +336,8 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
336 bool *enabled, int width, int height) 336 bool *enabled, int width, int height)
337{ 337{
338 struct drm_i915_private *dev_priv = to_i915(fb_helper->dev); 338 struct drm_i915_private *dev_priv = to_i915(fb_helper->dev);
339 unsigned long conn_configured, conn_seq, mask;
340 unsigned int count = min(fb_helper->connector_count, BITS_PER_LONG); 339 unsigned int count = min(fb_helper->connector_count, BITS_PER_LONG);
340 unsigned long conn_configured, conn_seq;
341 int i, j; 341 int i, j;
342 bool *save_enabled; 342 bool *save_enabled;
343 bool fallback = true, ret = true; 343 bool fallback = true, ret = true;
@@ -355,10 +355,9 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
355 drm_modeset_backoff(&ctx); 355 drm_modeset_backoff(&ctx);
356 356
357 memcpy(save_enabled, enabled, count); 357 memcpy(save_enabled, enabled, count);
358 mask = GENMASK(count - 1, 0); 358 conn_seq = GENMASK(count - 1, 0);
359 conn_configured = 0; 359 conn_configured = 0;
360retry: 360retry:
361 conn_seq = conn_configured;
362 for (i = 0; i < count; i++) { 361 for (i = 0; i < count; i++) {
363 struct drm_fb_helper_connector *fb_conn; 362 struct drm_fb_helper_connector *fb_conn;
364 struct drm_connector *connector; 363 struct drm_connector *connector;
@@ -371,7 +370,8 @@ retry:
371 if (conn_configured & BIT(i)) 370 if (conn_configured & BIT(i))
372 continue; 371 continue;
373 372
374 if (conn_seq == 0 && !connector->has_tile) 373 /* First pass, only consider tiled connectors */
374 if (conn_seq == GENMASK(count - 1, 0) && !connector->has_tile)
375 continue; 375 continue;
376 376
377 if (connector->status == connector_status_connected) 377 if (connector->status == connector_status_connected)
@@ -475,8 +475,10 @@ retry:
475 conn_configured |= BIT(i); 475 conn_configured |= BIT(i);
476 } 476 }
477 477
478 if ((conn_configured & mask) != mask && conn_configured != conn_seq) 478 if (conn_configured != conn_seq) { /* repeat until no more are found */
479 conn_seq = conn_configured;
479 goto retry; 480 goto retry;
481 }
480 482
481 /* 483 /*
482 * If the BIOS didn't enable everything it could, fall back to have the 484 * If the BIOS didn't enable everything it could, fall back to have the
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index dec1e081f529..6a8fb6fd183c 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -172,6 +172,7 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags)
172 } 172 }
173 173
174 if (radeon_is_px(dev)) { 174 if (radeon_is_px(dev)) {
175 dev_pm_set_driver_flags(dev->dev, DPM_FLAG_NEVER_SKIP);
175 pm_runtime_use_autosuspend(dev->dev); 176 pm_runtime_use_autosuspend(dev->dev);
176 pm_runtime_set_autosuspend_delay(dev->dev, 5000); 177 pm_runtime_set_autosuspend_delay(dev->dev, 5000);
177 pm_runtime_set_active(dev->dev); 178 pm_runtime_set_active(dev->dev);
diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c
index c13c0ba30f63..d499cd61c0e8 100644
--- a/drivers/infiniband/hw/cxgb4/device.c
+++ b/drivers/infiniband/hw/cxgb4/device.c
@@ -783,6 +783,7 @@ void c4iw_init_dev_ucontext(struct c4iw_rdev *rdev,
783static int c4iw_rdev_open(struct c4iw_rdev *rdev) 783static int c4iw_rdev_open(struct c4iw_rdev *rdev)
784{ 784{
785 int err; 785 int err;
786 unsigned int factor;
786 787
787 c4iw_init_dev_ucontext(rdev, &rdev->uctx); 788 c4iw_init_dev_ucontext(rdev, &rdev->uctx);
788 789
@@ -806,8 +807,18 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
806 return -EINVAL; 807 return -EINVAL;
807 } 808 }
808 809
809 rdev->qpmask = rdev->lldi.udb_density - 1; 810 /* This implementation requires a sge_host_page_size <= PAGE_SIZE. */
810 rdev->cqmask = rdev->lldi.ucq_density - 1; 811 if (rdev->lldi.sge_host_page_size > PAGE_SIZE) {
812 pr_err("%s: unsupported sge host page size %u\n",
813 pci_name(rdev->lldi.pdev),
814 rdev->lldi.sge_host_page_size);
815 return -EINVAL;
816 }
817
818 factor = PAGE_SIZE / rdev->lldi.sge_host_page_size;
819 rdev->qpmask = (rdev->lldi.udb_density * factor) - 1;
820 rdev->cqmask = (rdev->lldi.ucq_density * factor) - 1;
821
811 pr_debug("dev %s stag start 0x%0x size 0x%0x num stags %d pbl start 0x%0x size 0x%0x rq start 0x%0x size 0x%0x qp qid start %u size %u cq qid start %u size %u srq size %u\n", 822 pr_debug("dev %s stag start 0x%0x size 0x%0x num stags %d pbl start 0x%0x size 0x%0x rq start 0x%0x size 0x%0x qp qid start %u size %u cq qid start %u size %u srq size %u\n",
812 pci_name(rdev->lldi.pdev), rdev->lldi.vr->stag.start, 823 pci_name(rdev->lldi.pdev), rdev->lldi.vr->stag.start,
813 rdev->lldi.vr->stag.size, c4iw_num_stags(rdev), 824 rdev->lldi.vr->stag.size, c4iw_num_stags(rdev),
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 31d91538bbf4..694324b37480 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -3032,7 +3032,6 @@ static int srp_reset_device(struct scsi_cmnd *scmnd)
3032{ 3032{
3033 struct srp_target_port *target = host_to_target(scmnd->device->host); 3033 struct srp_target_port *target = host_to_target(scmnd->device->host);
3034 struct srp_rdma_ch *ch; 3034 struct srp_rdma_ch *ch;
3035 int i, j;
3036 u8 status; 3035 u8 status;
3037 3036
3038 shost_printk(KERN_ERR, target->scsi_host, "SRP reset_device called\n"); 3037 shost_printk(KERN_ERR, target->scsi_host, "SRP reset_device called\n");
@@ -3044,15 +3043,6 @@ static int srp_reset_device(struct scsi_cmnd *scmnd)
3044 if (status) 3043 if (status)
3045 return FAILED; 3044 return FAILED;
3046 3045
3047 for (i = 0; i < target->ch_count; i++) {
3048 ch = &target->ch[i];
3049 for (j = 0; j < target->req_ring_size; ++j) {
3050 struct srp_request *req = &ch->req_ring[j];
3051
3052 srp_finish_req(ch, req, scmnd->device, DID_RESET << 16);
3053 }
3054 }
3055
3056 return SUCCESS; 3046 return SUCCESS;
3057} 3047}
3058 3048
diff --git a/drivers/mailbox/bcm-flexrm-mailbox.c b/drivers/mailbox/bcm-flexrm-mailbox.c
index d713271ebf7c..a64116586b4c 100644
--- a/drivers/mailbox/bcm-flexrm-mailbox.c
+++ b/drivers/mailbox/bcm-flexrm-mailbox.c
@@ -1396,9 +1396,9 @@ static void flexrm_shutdown(struct mbox_chan *chan)
1396 1396
1397 /* Clear ring flush state */ 1397 /* Clear ring flush state */
1398 timeout = 1000; /* timeout of 1s */ 1398 timeout = 1000; /* timeout of 1s */
1399 writel_relaxed(0x0, ring + RING_CONTROL); 1399 writel_relaxed(0x0, ring->regs + RING_CONTROL);
1400 do { 1400 do {
1401 if (!(readl_relaxed(ring + RING_FLUSH_DONE) & 1401 if (!(readl_relaxed(ring->regs + RING_FLUSH_DONE) &
1402 FLUSH_DONE_MASK)) 1402 FLUSH_DONE_MASK))
1403 break; 1403 break;
1404 mdelay(1); 1404 mdelay(1);
diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index c6a7d4582dc6..38d9df3fb199 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -310,6 +310,7 @@ int mbox_flush(struct mbox_chan *chan, unsigned long timeout)
310 310
311 return ret; 311 return ret;
312} 312}
313EXPORT_SYMBOL_GPL(mbox_flush);
313 314
314/** 315/**
315 * mbox_request_channel - Request a mailbox channel. 316 * mbox_request_channel - Request a mailbox channel.
diff --git a/drivers/mtd/devices/powernv_flash.c b/drivers/mtd/devices/powernv_flash.c
index 22f753e555ac..83f88b8b5d9f 100644
--- a/drivers/mtd/devices/powernv_flash.c
+++ b/drivers/mtd/devices/powernv_flash.c
@@ -212,7 +212,7 @@ static int powernv_flash_set_driver_info(struct device *dev,
212 * Going to have to check what details I need to set and how to 212 * Going to have to check what details I need to set and how to
213 * get them 213 * get them
214 */ 214 */
215 mtd->name = devm_kasprintf(dev, GFP_KERNEL, "%pOFn", dev->of_node); 215 mtd->name = devm_kasprintf(dev, GFP_KERNEL, "%pOFP", dev->of_node);
216 mtd->type = MTD_NORFLASH; 216 mtd->type = MTD_NORFLASH;
217 mtd->flags = MTD_WRITEABLE; 217 mtd->flags = MTD_WRITEABLE;
218 mtd->size = size; 218 mtd->size = size;
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 999b705769a8..3ef01baef9b6 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -507,6 +507,7 @@ static int mtd_nvmem_add(struct mtd_info *mtd)
507{ 507{
508 struct nvmem_config config = {}; 508 struct nvmem_config config = {};
509 509
510 config.id = -1;
510 config.dev = &mtd->dev; 511 config.dev = &mtd->dev;
511 config.name = mtd->name; 512 config.name = mtd->name;
512 config.owner = THIS_MODULE; 513 config.owner = THIS_MODULE;
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 0e4bbdcc614f..c76892ac4e69 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -344,7 +344,8 @@ static void b53_set_forwarding(struct b53_device *dev, int enable)
344 b53_write8(dev, B53_CTRL_PAGE, B53_SWITCH_CTRL, mgmt); 344 b53_write8(dev, B53_CTRL_PAGE, B53_SWITCH_CTRL, mgmt);
345} 345}
346 346
347static void b53_enable_vlan(struct b53_device *dev, bool enable) 347static void b53_enable_vlan(struct b53_device *dev, bool enable,
348 bool enable_filtering)
348{ 349{
349 u8 mgmt, vc0, vc1, vc4 = 0, vc5; 350 u8 mgmt, vc0, vc1, vc4 = 0, vc5;
350 351
@@ -369,8 +370,13 @@ static void b53_enable_vlan(struct b53_device *dev, bool enable)
369 vc0 |= VC0_VLAN_EN | VC0_VID_CHK_EN | VC0_VID_HASH_VID; 370 vc0 |= VC0_VLAN_EN | VC0_VID_CHK_EN | VC0_VID_HASH_VID;
370 vc1 |= VC1_RX_MCST_UNTAG_EN | VC1_RX_MCST_FWD_EN; 371 vc1 |= VC1_RX_MCST_UNTAG_EN | VC1_RX_MCST_FWD_EN;
371 vc4 &= ~VC4_ING_VID_CHECK_MASK; 372 vc4 &= ~VC4_ING_VID_CHECK_MASK;
372 vc4 |= VC4_ING_VID_VIO_DROP << VC4_ING_VID_CHECK_S; 373 if (enable_filtering) {
373 vc5 |= VC5_DROP_VTABLE_MISS; 374 vc4 |= VC4_ING_VID_VIO_DROP << VC4_ING_VID_CHECK_S;
375 vc5 |= VC5_DROP_VTABLE_MISS;
376 } else {
377 vc4 |= VC4_ING_VID_VIO_FWD << VC4_ING_VID_CHECK_S;
378 vc5 &= ~VC5_DROP_VTABLE_MISS;
379 }
374 380
375 if (is5325(dev)) 381 if (is5325(dev))
376 vc0 &= ~VC0_RESERVED_1; 382 vc0 &= ~VC0_RESERVED_1;
@@ -420,6 +426,9 @@ static void b53_enable_vlan(struct b53_device *dev, bool enable)
420 } 426 }
421 427
422 b53_write8(dev, B53_CTRL_PAGE, B53_SWITCH_MODE, mgmt); 428 b53_write8(dev, B53_CTRL_PAGE, B53_SWITCH_MODE, mgmt);
429
430 dev->vlan_enabled = enable;
431 dev->vlan_filtering_enabled = enable_filtering;
423} 432}
424 433
425static int b53_set_jumbo(struct b53_device *dev, bool enable, bool allow_10_100) 434static int b53_set_jumbo(struct b53_device *dev, bool enable, bool allow_10_100)
@@ -632,25 +641,35 @@ static void b53_enable_mib(struct b53_device *dev)
632 b53_write8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, gc); 641 b53_write8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, gc);
633} 642}
634 643
644static u16 b53_default_pvid(struct b53_device *dev)
645{
646 if (is5325(dev) || is5365(dev))
647 return 1;
648 else
649 return 0;
650}
651
635int b53_configure_vlan(struct dsa_switch *ds) 652int b53_configure_vlan(struct dsa_switch *ds)
636{ 653{
637 struct b53_device *dev = ds->priv; 654 struct b53_device *dev = ds->priv;
638 struct b53_vlan vl = { 0 }; 655 struct b53_vlan vl = { 0 };
639 int i; 656 int i, def_vid;
657
658 def_vid = b53_default_pvid(dev);
640 659
641 /* clear all vlan entries */ 660 /* clear all vlan entries */
642 if (is5325(dev) || is5365(dev)) { 661 if (is5325(dev) || is5365(dev)) {
643 for (i = 1; i < dev->num_vlans; i++) 662 for (i = def_vid; i < dev->num_vlans; i++)
644 b53_set_vlan_entry(dev, i, &vl); 663 b53_set_vlan_entry(dev, i, &vl);
645 } else { 664 } else {
646 b53_do_vlan_op(dev, VTA_CMD_CLEAR); 665 b53_do_vlan_op(dev, VTA_CMD_CLEAR);
647 } 666 }
648 667
649 b53_enable_vlan(dev, false); 668 b53_enable_vlan(dev, false, dev->vlan_filtering_enabled);
650 669
651 b53_for_each_port(dev, i) 670 b53_for_each_port(dev, i)
652 b53_write16(dev, B53_VLAN_PAGE, 671 b53_write16(dev, B53_VLAN_PAGE,
653 B53_VLAN_PORT_DEF_TAG(i), 1); 672 B53_VLAN_PORT_DEF_TAG(i), def_vid);
654 673
655 if (!is5325(dev) && !is5365(dev)) 674 if (!is5325(dev) && !is5365(dev))
656 b53_set_jumbo(dev, dev->enable_jumbo, false); 675 b53_set_jumbo(dev, dev->enable_jumbo, false);
@@ -1255,6 +1274,46 @@ EXPORT_SYMBOL(b53_phylink_mac_link_up);
1255 1274
1256int b53_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering) 1275int b53_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering)
1257{ 1276{
1277 struct b53_device *dev = ds->priv;
1278 struct net_device *bridge_dev;
1279 unsigned int i;
1280 u16 pvid, new_pvid;
1281
1282 /* Handle the case were multiple bridges span the same switch device
1283 * and one of them has a different setting than what is being requested
1284 * which would be breaking filtering semantics for any of the other
1285 * bridge devices.
1286 */
1287 b53_for_each_port(dev, i) {
1288 bridge_dev = dsa_to_port(ds, i)->bridge_dev;
1289 if (bridge_dev &&
1290 bridge_dev != dsa_to_port(ds, port)->bridge_dev &&
1291 br_vlan_enabled(bridge_dev) != vlan_filtering) {
1292 netdev_err(bridge_dev,
1293 "VLAN filtering is global to the switch!\n");
1294 return -EINVAL;
1295 }
1296 }
1297
1298 b53_read16(dev, B53_VLAN_PAGE, B53_VLAN_PORT_DEF_TAG(port), &pvid);
1299 new_pvid = pvid;
1300 if (dev->vlan_filtering_enabled && !vlan_filtering) {
1301 /* Filtering is currently enabled, use the default PVID since
1302 * the bridge does not expect tagging anymore
1303 */
1304 dev->ports[port].pvid = pvid;
1305 new_pvid = b53_default_pvid(dev);
1306 } else if (!dev->vlan_filtering_enabled && vlan_filtering) {
1307 /* Filtering is currently disabled, restore the previous PVID */
1308 new_pvid = dev->ports[port].pvid;
1309 }
1310
1311 if (pvid != new_pvid)
1312 b53_write16(dev, B53_VLAN_PAGE, B53_VLAN_PORT_DEF_TAG(port),
1313 new_pvid);
1314
1315 b53_enable_vlan(dev, dev->vlan_enabled, vlan_filtering);
1316
1258 return 0; 1317 return 0;
1259} 1318}
1260EXPORT_SYMBOL(b53_vlan_filtering); 1319EXPORT_SYMBOL(b53_vlan_filtering);
@@ -1270,7 +1329,7 @@ int b53_vlan_prepare(struct dsa_switch *ds, int port,
1270 if (vlan->vid_end > dev->num_vlans) 1329 if (vlan->vid_end > dev->num_vlans)
1271 return -ERANGE; 1330 return -ERANGE;
1272 1331
1273 b53_enable_vlan(dev, true); 1332 b53_enable_vlan(dev, true, dev->vlan_filtering_enabled);
1274 1333
1275 return 0; 1334 return 0;
1276} 1335}
@@ -1300,7 +1359,7 @@ void b53_vlan_add(struct dsa_switch *ds, int port,
1300 b53_fast_age_vlan(dev, vid); 1359 b53_fast_age_vlan(dev, vid);
1301 } 1360 }
1302 1361
1303 if (pvid) { 1362 if (pvid && !dsa_is_cpu_port(ds, port)) {
1304 b53_write16(dev, B53_VLAN_PAGE, B53_VLAN_PORT_DEF_TAG(port), 1363 b53_write16(dev, B53_VLAN_PAGE, B53_VLAN_PORT_DEF_TAG(port),
1305 vlan->vid_end); 1364 vlan->vid_end);
1306 b53_fast_age_vlan(dev, vid); 1365 b53_fast_age_vlan(dev, vid);
@@ -1326,12 +1385,8 @@ int b53_vlan_del(struct dsa_switch *ds, int port,
1326 1385
1327 vl->members &= ~BIT(port); 1386 vl->members &= ~BIT(port);
1328 1387
1329 if (pvid == vid) { 1388 if (pvid == vid)
1330 if (is5325(dev) || is5365(dev)) 1389 pvid = b53_default_pvid(dev);
1331 pvid = 1;
1332 else
1333 pvid = 0;
1334 }
1335 1390
1336 if (untagged && !dsa_is_cpu_port(ds, port)) 1391 if (untagged && !dsa_is_cpu_port(ds, port))
1337 vl->untag &= ~(BIT(port)); 1392 vl->untag &= ~(BIT(port));
@@ -1644,10 +1699,7 @@ void b53_br_leave(struct dsa_switch *ds, int port, struct net_device *br)
1644 b53_write16(dev, B53_PVLAN_PAGE, B53_PVLAN_PORT_MASK(port), pvlan); 1699 b53_write16(dev, B53_PVLAN_PAGE, B53_PVLAN_PORT_MASK(port), pvlan);
1645 dev->ports[port].vlan_ctl_mask = pvlan; 1700 dev->ports[port].vlan_ctl_mask = pvlan;
1646 1701
1647 if (is5325(dev) || is5365(dev)) 1702 pvid = b53_default_pvid(dev);
1648 pvid = 1;
1649 else
1650 pvid = 0;
1651 1703
1652 /* Make this port join all VLANs without VLAN entries */ 1704 /* Make this port join all VLANs without VLAN entries */
1653 if (is58xx(dev)) { 1705 if (is58xx(dev)) {
diff --git a/drivers/net/dsa/b53/b53_priv.h b/drivers/net/dsa/b53/b53_priv.h
index ec796482792d..4dc7ee38b258 100644
--- a/drivers/net/dsa/b53/b53_priv.h
+++ b/drivers/net/dsa/b53/b53_priv.h
@@ -91,6 +91,7 @@ enum {
91struct b53_port { 91struct b53_port {
92 u16 vlan_ctl_mask; 92 u16 vlan_ctl_mask;
93 struct ethtool_eee eee; 93 struct ethtool_eee eee;
94 u16 pvid;
94}; 95};
95 96
96struct b53_vlan { 97struct b53_vlan {
@@ -137,6 +138,8 @@ struct b53_device {
137 138
138 unsigned int num_vlans; 139 unsigned int num_vlans;
139 struct b53_vlan *vlans; 140 struct b53_vlan *vlans;
141 bool vlan_enabled;
142 bool vlan_filtering_enabled;
140 unsigned int num_ports; 143 unsigned int num_ports;
141 struct b53_port *ports; 144 struct b53_port *ports;
142}; 145};
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 17ec32b0a1cc..14138d423cf1 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -726,10 +726,11 @@ static void bcm_sf2_sw_get_wol(struct dsa_switch *ds, int port,
726{ 726{
727 struct net_device *p = ds->ports[port].cpu_dp->master; 727 struct net_device *p = ds->ports[port].cpu_dp->master;
728 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); 728 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
729 struct ethtool_wolinfo pwol; 729 struct ethtool_wolinfo pwol = { };
730 730
731 /* Get the parent device WoL settings */ 731 /* Get the parent device WoL settings */
732 p->ethtool_ops->get_wol(p, &pwol); 732 if (p->ethtool_ops->get_wol)
733 p->ethtool_ops->get_wol(p, &pwol);
733 734
734 /* Advertise the parent device supported settings */ 735 /* Advertise the parent device supported settings */
735 wol->supported = pwol.supported; 736 wol->supported = pwol.supported;
@@ -750,9 +751,10 @@ static int bcm_sf2_sw_set_wol(struct dsa_switch *ds, int port,
750 struct net_device *p = ds->ports[port].cpu_dp->master; 751 struct net_device *p = ds->ports[port].cpu_dp->master;
751 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); 752 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
752 s8 cpu_port = ds->ports[port].cpu_dp->index; 753 s8 cpu_port = ds->ports[port].cpu_dp->index;
753 struct ethtool_wolinfo pwol; 754 struct ethtool_wolinfo pwol = { };
754 755
755 p->ethtool_ops->get_wol(p, &pwol); 756 if (p->ethtool_ops->get_wol)
757 p->ethtool_ops->get_wol(p, &pwol);
756 if (wol->wolopts & ~pwol.supported) 758 if (wol->wolopts & ~pwol.supported)
757 return -EINVAL; 759 return -EINVAL;
758 760
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 28c9b0bdf2f6..bc3ac369cbe3 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -134,6 +134,10 @@ static void bcm_sysport_set_rx_csum(struct net_device *dev,
134 134
135 priv->rx_chk_en = !!(wanted & NETIF_F_RXCSUM); 135 priv->rx_chk_en = !!(wanted & NETIF_F_RXCSUM);
136 reg = rxchk_readl(priv, RXCHK_CONTROL); 136 reg = rxchk_readl(priv, RXCHK_CONTROL);
137 /* Clear L2 header checks, which would prevent BPDUs
138 * from being received.
139 */
140 reg &= ~RXCHK_L2_HDR_DIS;
137 if (priv->rx_chk_en) 141 if (priv->rx_chk_en)
138 reg |= RXCHK_EN; 142 reg |= RXCHK_EN;
139 else 143 else
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
index c041f44324db..b3654598a2d5 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
@@ -660,6 +660,7 @@ static void uld_init(struct adapter *adap, struct cxgb4_lld_info *lld)
660 lld->cclk_ps = 1000000000 / adap->params.vpd.cclk; 660 lld->cclk_ps = 1000000000 / adap->params.vpd.cclk;
661 lld->udb_density = 1 << adap->params.sge.eq_qpp; 661 lld->udb_density = 1 << adap->params.sge.eq_qpp;
662 lld->ucq_density = 1 << adap->params.sge.iq_qpp; 662 lld->ucq_density = 1 << adap->params.sge.iq_qpp;
663 lld->sge_host_page_size = 1 << (adap->params.sge.hps + 10);
663 lld->filt_mode = adap->params.tp.vlan_pri_map; 664 lld->filt_mode = adap->params.tp.vlan_pri_map;
664 /* MODQ_REQ_MAP sets queues 0-3 to chan 0-3 */ 665 /* MODQ_REQ_MAP sets queues 0-3 to chan 0-3 */
665 for (i = 0; i < NCHAN; i++) 666 for (i = 0; i < NCHAN; i++)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
index 5fa9a2d5fc4b..21da34a4ca24 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
@@ -336,6 +336,7 @@ struct cxgb4_lld_info {
336 unsigned int cclk_ps; /* Core clock period in psec */ 336 unsigned int cclk_ps; /* Core clock period in psec */
337 unsigned short udb_density; /* # of user DB/page */ 337 unsigned short udb_density; /* # of user DB/page */
338 unsigned short ucq_density; /* # of user CQs/page */ 338 unsigned short ucq_density; /* # of user CQs/page */
339 unsigned int sge_host_page_size; /* SGE host page size */
339 unsigned short filt_mode; /* filter optional components */ 340 unsigned short filt_mode; /* filter optional components */
340 unsigned short tx_modq[NCHAN]; /* maps each tx channel to a */ 341 unsigned short tx_modq[NCHAN]; /* maps each tx channel to a */
341 /* scheduler queue */ 342 /* scheduler queue */
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
index b8155f5e71b4..ac55db065f16 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
@@ -3128,6 +3128,9 @@ int hns_dsaf_roce_reset(struct fwnode_handle *dsaf_fwnode, bool dereset)
3128 dsaf_set_bit(credit, DSAF_SBM_ROCEE_CFG_CRD_EN_B, 1); 3128 dsaf_set_bit(credit, DSAF_SBM_ROCEE_CFG_CRD_EN_B, 1);
3129 dsaf_write_dev(dsaf_dev, DSAF_SBM_ROCEE_CFG_REG_REG, credit); 3129 dsaf_write_dev(dsaf_dev, DSAF_SBM_ROCEE_CFG_REG_REG, credit);
3130 } 3130 }
3131
3132 put_device(&pdev->dev);
3133
3131 return 0; 3134 return 0;
3132} 3135}
3133EXPORT_SYMBOL(hns_dsaf_roce_reset); 3136EXPORT_SYMBOL(hns_dsaf_roce_reset);
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 2f427271a793..292a668ce88e 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -2879,7 +2879,7 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
2879 2879
2880 ret = mv643xx_eth_shared_of_probe(pdev); 2880 ret = mv643xx_eth_shared_of_probe(pdev);
2881 if (ret) 2881 if (ret)
2882 return ret; 2882 goto err_put_clk;
2883 pd = dev_get_platdata(&pdev->dev); 2883 pd = dev_get_platdata(&pdev->dev);
2884 2884
2885 msp->tx_csum_limit = (pd != NULL && pd->tx_csum_limit) ? 2885 msp->tx_csum_limit = (pd != NULL && pd->tx_csum_limit) ?
@@ -2887,6 +2887,11 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
2887 infer_hw_params(msp); 2887 infer_hw_params(msp);
2888 2888
2889 return 0; 2889 return 0;
2890
2891err_put_clk:
2892 if (!IS_ERR(msp->clk))
2893 clk_disable_unprepare(msp->clk);
2894 return ret;
2890} 2895}
2891 2896
2892static int mv643xx_eth_shared_remove(struct platform_device *pdev) 2897static int mv643xx_eth_shared_remove(struct platform_device *pdev)
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index f3a5fa84860f..57727fe1501e 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -5073,7 +5073,7 @@ static int sky2_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
5073 INIT_WORK(&hw->restart_work, sky2_restart); 5073 INIT_WORK(&hw->restart_work, sky2_restart);
5074 5074
5075 pci_set_drvdata(pdev, hw); 5075 pci_set_drvdata(pdev, hw);
5076 pdev->d3_delay = 200; 5076 pdev->d3_delay = 300;
5077 5077
5078 return 0; 5078 return 0;
5079 5079
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 6b88881b8e35..c1438ae52a11 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -3360,7 +3360,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
3360 dev->addr_len = ETH_ALEN; 3360 dev->addr_len = ETH_ALEN;
3361 mlx4_en_u64_to_mac(dev->dev_addr, mdev->dev->caps.def_mac[priv->port]); 3361 mlx4_en_u64_to_mac(dev->dev_addr, mdev->dev->caps.def_mac[priv->port]);
3362 if (!is_valid_ether_addr(dev->dev_addr)) { 3362 if (!is_valid_ether_addr(dev->dev_addr)) {
3363 en_err(priv, "Port: %d, invalid mac burned: %pM, quiting\n", 3363 en_err(priv, "Port: %d, invalid mac burned: %pM, quitting\n",
3364 priv->port, dev->dev_addr); 3364 priv->port, dev->dev_addr);
3365 err = -EINVAL; 3365 err = -EINVAL;
3366 goto out; 3366 goto out;
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 32519c93df17..b65e274b02e9 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -862,8 +862,9 @@ int __mlxsw_sp_port_headroom_set(struct mlxsw_sp_port *mlxsw_sp_port, int mtu,
862 for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) { 862 for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
863 bool configure = false; 863 bool configure = false;
864 bool pfc = false; 864 bool pfc = false;
865 u16 thres_cells;
866 u16 delay_cells;
865 bool lossy; 867 bool lossy;
866 u16 thres;
867 868
868 for (j = 0; j < IEEE_8021QAZ_MAX_TCS; j++) { 869 for (j = 0; j < IEEE_8021QAZ_MAX_TCS; j++) {
869 if (prio_tc[j] == i) { 870 if (prio_tc[j] == i) {
@@ -877,10 +878,11 @@ int __mlxsw_sp_port_headroom_set(struct mlxsw_sp_port *mlxsw_sp_port, int mtu,
877 continue; 878 continue;
878 879
879 lossy = !(pfc || pause_en); 880 lossy = !(pfc || pause_en);
880 thres = mlxsw_sp_pg_buf_threshold_get(mlxsw_sp, mtu); 881 thres_cells = mlxsw_sp_pg_buf_threshold_get(mlxsw_sp, mtu);
881 delay = mlxsw_sp_pg_buf_delay_get(mlxsw_sp, mtu, delay, pfc, 882 delay_cells = mlxsw_sp_pg_buf_delay_get(mlxsw_sp, mtu, delay,
882 pause_en); 883 pfc, pause_en);
883 mlxsw_sp_pg_buf_pack(pbmc_pl, i, thres + delay, thres, lossy); 884 mlxsw_sp_pg_buf_pack(pbmc_pl, i, thres_cells + delay_cells,
885 thres_cells, lossy);
884 } 886 }
885 887
886 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(pbmc), pbmc_pl); 888 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(pbmc), pbmc_pl);
diff --git a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c
index beb8e5d6401a..ded556b7bab5 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c
@@ -1688,6 +1688,15 @@ qed_iwarp_parse_rx_pkt(struct qed_hwfn *p_hwfn,
1688 1688
1689 eth_hlen = ETH_HLEN + (vlan_valid ? sizeof(u32) : 0); 1689 eth_hlen = ETH_HLEN + (vlan_valid ? sizeof(u32) : 0);
1690 1690
1691 if (!ether_addr_equal(ethh->h_dest,
1692 p_hwfn->p_rdma_info->iwarp.mac_addr)) {
1693 DP_VERBOSE(p_hwfn,
1694 QED_MSG_RDMA,
1695 "Got unexpected mac %pM instead of %pM\n",
1696 ethh->h_dest, p_hwfn->p_rdma_info->iwarp.mac_addr);
1697 return -EINVAL;
1698 }
1699
1691 ether_addr_copy(remote_mac_addr, ethh->h_source); 1700 ether_addr_copy(remote_mac_addr, ethh->h_source);
1692 ether_addr_copy(local_mac_addr, ethh->h_dest); 1701 ether_addr_copy(local_mac_addr, ethh->h_dest);
1693 1702
@@ -2605,7 +2614,7 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn,
2605 struct qed_iwarp_info *iwarp_info; 2614 struct qed_iwarp_info *iwarp_info;
2606 struct qed_ll2_acquire_data data; 2615 struct qed_ll2_acquire_data data;
2607 struct qed_ll2_cbs cbs; 2616 struct qed_ll2_cbs cbs;
2608 u32 mpa_buff_size; 2617 u32 buff_size;
2609 u16 n_ooo_bufs; 2618 u16 n_ooo_bufs;
2610 int rc = 0; 2619 int rc = 0;
2611 int i; 2620 int i;
@@ -2632,7 +2641,7 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn,
2632 2641
2633 memset(&data, 0, sizeof(data)); 2642 memset(&data, 0, sizeof(data));
2634 data.input.conn_type = QED_LL2_TYPE_IWARP; 2643 data.input.conn_type = QED_LL2_TYPE_IWARP;
2635 data.input.mtu = QED_IWARP_MAX_SYN_PKT_SIZE; 2644 data.input.mtu = params->max_mtu;
2636 data.input.rx_num_desc = QED_IWARP_LL2_SYN_RX_SIZE; 2645 data.input.rx_num_desc = QED_IWARP_LL2_SYN_RX_SIZE;
2637 data.input.tx_num_desc = QED_IWARP_LL2_SYN_TX_SIZE; 2646 data.input.tx_num_desc = QED_IWARP_LL2_SYN_TX_SIZE;
2638 data.input.tx_max_bds_per_packet = 1; /* will never be fragmented */ 2647 data.input.tx_max_bds_per_packet = 1; /* will never be fragmented */
@@ -2654,9 +2663,10 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn,
2654 goto err; 2663 goto err;
2655 } 2664 }
2656 2665
2666 buff_size = QED_IWARP_MAX_BUF_SIZE(params->max_mtu);
2657 rc = qed_iwarp_ll2_alloc_buffers(p_hwfn, 2667 rc = qed_iwarp_ll2_alloc_buffers(p_hwfn,
2658 QED_IWARP_LL2_SYN_RX_SIZE, 2668 QED_IWARP_LL2_SYN_RX_SIZE,
2659 QED_IWARP_MAX_SYN_PKT_SIZE, 2669 buff_size,
2660 iwarp_info->ll2_syn_handle); 2670 iwarp_info->ll2_syn_handle);
2661 if (rc) 2671 if (rc)
2662 goto err; 2672 goto err;
@@ -2710,10 +2720,9 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn,
2710 if (rc) 2720 if (rc)
2711 goto err; 2721 goto err;
2712 2722
2713 mpa_buff_size = QED_IWARP_MAX_BUF_SIZE(params->max_mtu);
2714 rc = qed_iwarp_ll2_alloc_buffers(p_hwfn, 2723 rc = qed_iwarp_ll2_alloc_buffers(p_hwfn,
2715 data.input.rx_num_desc, 2724 data.input.rx_num_desc,
2716 mpa_buff_size, 2725 buff_size,
2717 iwarp_info->ll2_mpa_handle); 2726 iwarp_info->ll2_mpa_handle);
2718 if (rc) 2727 if (rc)
2719 goto err; 2728 goto err;
@@ -2726,7 +2735,7 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn,
2726 2735
2727 iwarp_info->max_num_partial_fpdus = (u16)p_hwfn->p_rdma_info->num_qps; 2736 iwarp_info->max_num_partial_fpdus = (u16)p_hwfn->p_rdma_info->num_qps;
2728 2737
2729 iwarp_info->mpa_intermediate_buf = kzalloc(mpa_buff_size, GFP_KERNEL); 2738 iwarp_info->mpa_intermediate_buf = kzalloc(buff_size, GFP_KERNEL);
2730 if (!iwarp_info->mpa_intermediate_buf) 2739 if (!iwarp_info->mpa_intermediate_buf)
2731 goto err; 2740 goto err;
2732 2741
diff --git a/drivers/net/ethernet/qlogic/qed/qed_iwarp.h b/drivers/net/ethernet/qlogic/qed/qed_iwarp.h
index b8f612d00241..7ac959038324 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_iwarp.h
+++ b/drivers/net/ethernet/qlogic/qed/qed_iwarp.h
@@ -46,7 +46,6 @@ enum qed_iwarp_qp_state qed_roce2iwarp_state(enum qed_roce_qp_state state);
46 46
47#define QED_IWARP_LL2_SYN_TX_SIZE (128) 47#define QED_IWARP_LL2_SYN_TX_SIZE (128)
48#define QED_IWARP_LL2_SYN_RX_SIZE (256) 48#define QED_IWARP_LL2_SYN_RX_SIZE (256)
49#define QED_IWARP_MAX_SYN_PKT_SIZE (128)
50 49
51#define QED_IWARP_LL2_OOO_DEF_TX_SIZE (256) 50#define QED_IWARP_LL2_OOO_DEF_TX_SIZE (256)
52#define QED_IWARP_MAX_OOO (16) 51#define QED_IWARP_MAX_OOO (16)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
index 20299f6f65fc..736e29635b77 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
@@ -241,15 +241,18 @@ static inline void dwmac4_get_timestamp(void *desc, u32 ats, u64 *ts)
241static int dwmac4_rx_check_timestamp(void *desc) 241static int dwmac4_rx_check_timestamp(void *desc)
242{ 242{
243 struct dma_desc *p = (struct dma_desc *)desc; 243 struct dma_desc *p = (struct dma_desc *)desc;
244 unsigned int rdes0 = le32_to_cpu(p->des0);
245 unsigned int rdes1 = le32_to_cpu(p->des1);
246 unsigned int rdes3 = le32_to_cpu(p->des3);
244 u32 own, ctxt; 247 u32 own, ctxt;
245 int ret = 1; 248 int ret = 1;
246 249
247 own = p->des3 & RDES3_OWN; 250 own = rdes3 & RDES3_OWN;
248 ctxt = ((p->des3 & RDES3_CONTEXT_DESCRIPTOR) 251 ctxt = ((rdes3 & RDES3_CONTEXT_DESCRIPTOR)
249 >> RDES3_CONTEXT_DESCRIPTOR_SHIFT); 252 >> RDES3_CONTEXT_DESCRIPTOR_SHIFT);
250 253
251 if (likely(!own && ctxt)) { 254 if (likely(!own && ctxt)) {
252 if ((p->des0 == 0xffffffff) && (p->des1 == 0xffffffff)) 255 if ((rdes0 == 0xffffffff) && (rdes1 == 0xffffffff))
253 /* Corrupted value */ 256 /* Corrupted value */
254 ret = -EINVAL; 257 ret = -EINVAL;
255 else 258 else
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 5d85742a2be0..3c749c327cbd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -696,25 +696,27 @@ static int stmmac_ethtool_op_set_eee(struct net_device *dev,
696 struct ethtool_eee *edata) 696 struct ethtool_eee *edata)
697{ 697{
698 struct stmmac_priv *priv = netdev_priv(dev); 698 struct stmmac_priv *priv = netdev_priv(dev);
699 int ret;
699 700
700 priv->eee_enabled = edata->eee_enabled; 701 if (!edata->eee_enabled) {
701
702 if (!priv->eee_enabled)
703 stmmac_disable_eee_mode(priv); 702 stmmac_disable_eee_mode(priv);
704 else { 703 } else {
705 /* We are asking for enabling the EEE but it is safe 704 /* We are asking for enabling the EEE but it is safe
706 * to verify all by invoking the eee_init function. 705 * to verify all by invoking the eee_init function.
707 * In case of failure it will return an error. 706 * In case of failure it will return an error.
708 */ 707 */
709 priv->eee_enabled = stmmac_eee_init(priv); 708 edata->eee_enabled = stmmac_eee_init(priv);
710 if (!priv->eee_enabled) 709 if (!edata->eee_enabled)
711 return -EOPNOTSUPP; 710 return -EOPNOTSUPP;
712
713 /* Do not change tx_lpi_timer in case of failure */
714 priv->tx_lpi_timer = edata->tx_lpi_timer;
715 } 711 }
716 712
717 return phy_ethtool_set_eee(dev->phydev, edata); 713 ret = phy_ethtool_set_eee(dev->phydev, edata);
714 if (ret)
715 return ret;
716
717 priv->eee_enabled = edata->eee_enabled;
718 priv->tx_lpi_timer = edata->tx_lpi_timer;
719 return 0;
718} 720}
719 721
720static u32 stmmac_usec2riwt(u32 usec, struct stmmac_priv *priv) 722static u32 stmmac_usec2riwt(u32 usec, struct stmmac_priv *priv)
diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c
index 1f612268c998..d847f672a705 100644
--- a/drivers/net/ethernet/ti/netcp_core.c
+++ b/drivers/net/ethernet/ti/netcp_core.c
@@ -259,7 +259,7 @@ static int netcp_module_probe(struct netcp_device *netcp_device,
259 const char *name; 259 const char *name;
260 char node_name[32]; 260 char node_name[32];
261 261
262 if (of_property_read_string(node, "label", &name) < 0) { 262 if (of_property_read_string(child, "label", &name) < 0) {
263 snprintf(node_name, sizeof(node_name), "%pOFn", child); 263 snprintf(node_name, sizeof(node_name), "%pOFn", child);
264 name = node_name; 264 name = node_name;
265 } 265 }
diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c
index 74a8782313cf..bd6084e315de 100644
--- a/drivers/net/phy/xilinx_gmii2rgmii.c
+++ b/drivers/net/phy/xilinx_gmii2rgmii.c
@@ -44,7 +44,10 @@ static int xgmiitorgmii_read_status(struct phy_device *phydev)
44 u16 val = 0; 44 u16 val = 0;
45 int err; 45 int err;
46 46
47 err = priv->phy_drv->read_status(phydev); 47 if (priv->phy_drv->read_status)
48 err = priv->phy_drv->read_status(phydev);
49 else
50 err = genphy_read_status(phydev);
48 if (err < 0) 51 if (err < 0)
49 return err; 52 return err;
50 53
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 735ad838e2ba..18af2f8eee96 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -1201,8 +1201,8 @@ static const struct usb_device_id products[] = {
1201 {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */ 1201 {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */
1202 {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */ 1202 {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */
1203 {QMI_FIXED_INTF(0x1199, 0x68a2, 19)}, /* Sierra Wireless MC7710 in QMI mode */ 1203 {QMI_FIXED_INTF(0x1199, 0x68a2, 19)}, /* Sierra Wireless MC7710 in QMI mode */
1204 {QMI_FIXED_INTF(0x1199, 0x68c0, 8)}, /* Sierra Wireless MC7304/MC7354 */ 1204 {QMI_QUIRK_SET_DTR(0x1199, 0x68c0, 8)}, /* Sierra Wireless MC7304/MC7354, WP76xx */
1205 {QMI_FIXED_INTF(0x1199, 0x68c0, 10)}, /* Sierra Wireless MC7304/MC7354 */ 1205 {QMI_QUIRK_SET_DTR(0x1199, 0x68c0, 10)},/* Sierra Wireless MC7304/MC7354 */
1206 {QMI_FIXED_INTF(0x1199, 0x901c, 8)}, /* Sierra Wireless EM7700 */ 1206 {QMI_FIXED_INTF(0x1199, 0x901c, 8)}, /* Sierra Wireless EM7700 */
1207 {QMI_FIXED_INTF(0x1199, 0x901f, 8)}, /* Sierra Wireless EM7355 */ 1207 {QMI_FIXED_INTF(0x1199, 0x901f, 8)}, /* Sierra Wireless EM7355 */
1208 {QMI_FIXED_INTF(0x1199, 0x9041, 8)}, /* Sierra Wireless MC7305/MC7355 */ 1208 {QMI_FIXED_INTF(0x1199, 0x9041, 8)}, /* Sierra Wireless MC7305/MC7355 */
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 60dd1ec1665f..ada6baf8847a 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -557,6 +557,7 @@ enum spd_duplex {
557/* MAC PASSTHRU */ 557/* MAC PASSTHRU */
558#define AD_MASK 0xfee0 558#define AD_MASK 0xfee0
559#define BND_MASK 0x0004 559#define BND_MASK 0x0004
560#define BD_MASK 0x0001
560#define EFUSE 0xcfdb 561#define EFUSE 0xcfdb
561#define PASS_THRU_MASK 0x1 562#define PASS_THRU_MASK 0x1
562 563
@@ -1176,9 +1177,9 @@ static int vendor_mac_passthru_addr_read(struct r8152 *tp, struct sockaddr *sa)
1176 return -ENODEV; 1177 return -ENODEV;
1177 } 1178 }
1178 } else { 1179 } else {
1179 /* test for RTL8153-BND */ 1180 /* test for RTL8153-BND and RTL8153-BD */
1180 ocp_data = ocp_read_byte(tp, MCU_TYPE_USB, USB_MISC_1); 1181 ocp_data = ocp_read_byte(tp, MCU_TYPE_USB, USB_MISC_1);
1181 if ((ocp_data & BND_MASK) == 0) { 1182 if ((ocp_data & BND_MASK) == 0 && (ocp_data & BD_MASK)) {
1182 netif_dbg(tp, probe, tp->netdev, 1183 netif_dbg(tp, probe, tp->netdev,
1183 "Invalid variant for MAC pass through\n"); 1184 "Invalid variant for MAC pass through\n");
1184 return -ENODEV; 1185 return -ENODEV;
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
index 0e6b43bb4678..a5ea3ba495a4 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
@@ -158,39 +158,49 @@ static const struct ieee80211_ops mt76x0u_ops = {
158 .get_txpower = mt76x02_get_txpower, 158 .get_txpower = mt76x02_get_txpower,
159}; 159};
160 160
161static int mt76x0u_register_device(struct mt76x02_dev *dev) 161static int mt76x0u_init_hardware(struct mt76x02_dev *dev)
162{ 162{
163 struct ieee80211_hw *hw = dev->mt76.hw;
164 int err; 163 int err;
165 164
166 err = mt76u_alloc_queues(&dev->mt76);
167 if (err < 0)
168 goto out_err;
169
170 err = mt76u_mcu_init_rx(&dev->mt76);
171 if (err < 0)
172 goto out_err;
173
174 mt76x0_chip_onoff(dev, true, true); 165 mt76x0_chip_onoff(dev, true, true);
175 if (!mt76x02_wait_for_mac(&dev->mt76)) { 166
176 err = -ETIMEDOUT; 167 if (!mt76x02_wait_for_mac(&dev->mt76))
177 goto out_err; 168 return -ETIMEDOUT;
178 }
179 169
180 err = mt76x0u_mcu_init(dev); 170 err = mt76x0u_mcu_init(dev);
181 if (err < 0) 171 if (err < 0)
182 goto out_err; 172 return err;
183 173
184 mt76x0_init_usb_dma(dev); 174 mt76x0_init_usb_dma(dev);
185 err = mt76x0_init_hardware(dev); 175 err = mt76x0_init_hardware(dev);
186 if (err < 0) 176 if (err < 0)
187 goto out_err; 177 return err;
188 178
189 mt76_rmw(dev, MT_US_CYC_CFG, MT_US_CYC_CNT, 0x1e); 179 mt76_rmw(dev, MT_US_CYC_CFG, MT_US_CYC_CNT, 0x1e);
190 mt76_wr(dev, MT_TXOP_CTRL_CFG, 180 mt76_wr(dev, MT_TXOP_CTRL_CFG,
191 FIELD_PREP(MT_TXOP_TRUN_EN, 0x3f) | 181 FIELD_PREP(MT_TXOP_TRUN_EN, 0x3f) |
192 FIELD_PREP(MT_TXOP_EXT_CCA_DLY, 0x58)); 182 FIELD_PREP(MT_TXOP_EXT_CCA_DLY, 0x58));
193 183
184 return 0;
185}
186
187static int mt76x0u_register_device(struct mt76x02_dev *dev)
188{
189 struct ieee80211_hw *hw = dev->mt76.hw;
190 int err;
191
192 err = mt76u_alloc_queues(&dev->mt76);
193 if (err < 0)
194 goto out_err;
195
196 err = mt76u_mcu_init_rx(&dev->mt76);
197 if (err < 0)
198 goto out_err;
199
200 err = mt76x0u_init_hardware(dev);
201 if (err < 0)
202 goto out_err;
203
194 err = mt76x0_register_device(dev); 204 err = mt76x0_register_device(dev);
195 if (err < 0) 205 if (err < 0)
196 goto out_err; 206 goto out_err;
@@ -301,6 +311,8 @@ static int __maybe_unused mt76x0_suspend(struct usb_interface *usb_intf,
301 311
302 mt76u_stop_queues(&dev->mt76); 312 mt76u_stop_queues(&dev->mt76);
303 mt76x0u_mac_stop(dev); 313 mt76x0u_mac_stop(dev);
314 clear_bit(MT76_STATE_MCU_RUNNING, &dev->mt76.state);
315 mt76x0_chip_onoff(dev, false, false);
304 usb_kill_urb(usb->mcu.res.urb); 316 usb_kill_urb(usb->mcu.res.urb);
305 317
306 return 0; 318 return 0;
@@ -328,7 +340,7 @@ static int __maybe_unused mt76x0_resume(struct usb_interface *usb_intf)
328 tasklet_enable(&usb->rx_tasklet); 340 tasklet_enable(&usb->rx_tasklet);
329 tasklet_enable(&usb->tx_tasklet); 341 tasklet_enable(&usb->tx_tasklet);
330 342
331 ret = mt76x0_init_hardware(dev); 343 ret = mt76x0u_init_hardware(dev);
332 if (ret) 344 if (ret)
333 goto err; 345 goto err;
334 346
diff --git a/drivers/pinctrl/meson/pinctrl-meson8b.c b/drivers/pinctrl/meson/pinctrl-meson8b.c
index c69ca95b1ad5..0f140a802137 100644
--- a/drivers/pinctrl/meson/pinctrl-meson8b.c
+++ b/drivers/pinctrl/meson/pinctrl-meson8b.c
@@ -693,7 +693,7 @@ static const char * const sd_a_groups[] = {
693 693
694static const char * const sdxc_a_groups[] = { 694static const char * const sdxc_a_groups[] = {
695 "sdxc_d0_0_a", "sdxc_d13_0_a", "sdxc_d47_a", "sdxc_clk_a", 695 "sdxc_d0_0_a", "sdxc_d13_0_a", "sdxc_d47_a", "sdxc_clk_a",
696 "sdxc_cmd_a", "sdxc_d0_1_a", "sdxc_d0_13_1_a" 696 "sdxc_cmd_a", "sdxc_d0_1_a", "sdxc_d13_1_a"
697}; 697};
698 698
699static const char * const pcm_a_groups[] = { 699static const char * const pcm_a_groups[] = {
diff --git a/drivers/pinctrl/qcom/pinctrl-qcs404.c b/drivers/pinctrl/qcom/pinctrl-qcs404.c
index 7aae52a09ff0..4ffd56ff809e 100644
--- a/drivers/pinctrl/qcom/pinctrl-qcs404.c
+++ b/drivers/pinctrl/qcom/pinctrl-qcs404.c
@@ -79,7 +79,7 @@ enum {
79 .intr_cfg_reg = 0, \ 79 .intr_cfg_reg = 0, \
80 .intr_status_reg = 0, \ 80 .intr_status_reg = 0, \
81 .intr_target_reg = 0, \ 81 .intr_target_reg = 0, \
82 .tile = NORTH, \ 82 .tile = SOUTH, \
83 .mux_bit = -1, \ 83 .mux_bit = -1, \
84 .pull_bit = pull, \ 84 .pull_bit = pull, \
85 .drv_bit = drv, \ 85 .drv_bit = drv, \
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 24a129fcdd61..a2e5dc7716e2 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -1788,7 +1788,7 @@ static int log_used(struct vhost_virtqueue *vq, u64 used_offset, u64 len)
1788 1788
1789 ret = translate_desc(vq, (uintptr_t)vq->used + used_offset, 1789 ret = translate_desc(vq, (uintptr_t)vq->used + used_offset,
1790 len, iov, 64, VHOST_ACCESS_WO); 1790 len, iov, 64, VHOST_ACCESS_WO);
1791 if (ret) 1791 if (ret < 0)
1792 return ret; 1792 return ret;
1793 1793
1794 for (i = 0; i < ret; i++) { 1794 for (i = 0; i < ret; i++) {
diff --git a/fs/binfmt_script.c b/fs/binfmt_script.c
index 7cde3f46ad26..e996174cbfc0 100644
--- a/fs/binfmt_script.c
+++ b/fs/binfmt_script.c
@@ -14,13 +14,30 @@
14#include <linux/err.h> 14#include <linux/err.h>
15#include <linux/fs.h> 15#include <linux/fs.h>
16 16
17static inline bool spacetab(char c) { return c == ' ' || c == '\t'; }
18static inline char *next_non_spacetab(char *first, const char *last)
19{
20 for (; first <= last; first++)
21 if (!spacetab(*first))
22 return first;
23 return NULL;
24}
25static inline char *next_terminator(char *first, const char *last)
26{
27 for (; first <= last; first++)
28 if (spacetab(*first) || !*first)
29 return first;
30 return NULL;
31}
32
17static int load_script(struct linux_binprm *bprm) 33static int load_script(struct linux_binprm *bprm)
18{ 34{
19 const char *i_arg, *i_name; 35 const char *i_arg, *i_name;
20 char *cp; 36 char *cp, *buf_end;
21 struct file *file; 37 struct file *file;
22 int retval; 38 int retval;
23 39
40 /* Not ours to exec if we don't start with "#!". */
24 if ((bprm->buf[0] != '#') || (bprm->buf[1] != '!')) 41 if ((bprm->buf[0] != '#') || (bprm->buf[1] != '!'))
25 return -ENOEXEC; 42 return -ENOEXEC;
26 43
@@ -33,18 +50,40 @@ static int load_script(struct linux_binprm *bprm)
33 if (bprm->interp_flags & BINPRM_FLAGS_PATH_INACCESSIBLE) 50 if (bprm->interp_flags & BINPRM_FLAGS_PATH_INACCESSIBLE)
34 return -ENOENT; 51 return -ENOENT;
35 52
36 /* 53 /* Release since we are not mapping a binary into memory. */
37 * This section does the #! interpretation.
38 * Sorta complicated, but hopefully it will work. -TYT
39 */
40
41 allow_write_access(bprm->file); 54 allow_write_access(bprm->file);
42 fput(bprm->file); 55 fput(bprm->file);
43 bprm->file = NULL; 56 bprm->file = NULL;
44 57
45 bprm->buf[BINPRM_BUF_SIZE - 1] = '\0'; 58 /*
46 if ((cp = strchr(bprm->buf, '\n')) == NULL) 59 * This section handles parsing the #! line into separate
47 cp = bprm->buf+BINPRM_BUF_SIZE-1; 60 * interpreter path and argument strings. We must be careful
61 * because bprm->buf is not yet guaranteed to be NUL-terminated
62 * (though the buffer will have trailing NUL padding when the
63 * file size was smaller than the buffer size).
64 *
65 * We do not want to exec a truncated interpreter path, so either
66 * we find a newline (which indicates nothing is truncated), or
67 * we find a space/tab/NUL after the interpreter path (which
68 * itself may be preceded by spaces/tabs). Truncating the
69 * arguments is fine: the interpreter can re-read the script to
70 * parse them on its own.
71 */
72 buf_end = bprm->buf + sizeof(bprm->buf) - 1;
73 cp = strnchr(bprm->buf, sizeof(bprm->buf), '\n');
74 if (!cp) {
75 cp = next_non_spacetab(bprm->buf + 2, buf_end);
76 if (!cp)
77 return -ENOEXEC; /* Entire buf is spaces/tabs */
78 /*
79 * If there is no later space/tab/NUL we must assume the
80 * interpreter path is truncated.
81 */
82 if (!next_terminator(cp, buf_end))
83 return -ENOEXEC;
84 cp = buf_end;
85 }
86 /* NUL-terminate the buffer and any trailing spaces/tabs. */
48 *cp = '\0'; 87 *cp = '\0';
49 while (cp > bprm->buf) { 88 while (cp > bprm->buf) {
50 cp--; 89 cp--;
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
index 041c27ea8de1..f74193da0e09 100644
--- a/fs/ceph/snap.c
+++ b/fs/ceph/snap.c
@@ -616,7 +616,8 @@ int __ceph_finish_cap_snap(struct ceph_inode_info *ci,
616 capsnap->size); 616 capsnap->size);
617 617
618 spin_lock(&mdsc->snap_flush_lock); 618 spin_lock(&mdsc->snap_flush_lock);
619 list_add_tail(&ci->i_snap_flush_item, &mdsc->snap_flush_list); 619 if (list_empty(&ci->i_snap_flush_item))
620 list_add_tail(&ci->i_snap_flush_item, &mdsc->snap_flush_list);
620 spin_unlock(&mdsc->snap_flush_lock); 621 spin_unlock(&mdsc->snap_flush_lock);
621 return 1; /* caller may want to ceph_flush_snaps */ 622 return 1; /* caller may want to ceph_flush_snaps */
622} 623}
diff --git a/fs/nfs/nfs4idmap.c b/fs/nfs/nfs4idmap.c
index 3f23b6840547..bf34ddaa2ad7 100644
--- a/fs/nfs/nfs4idmap.c
+++ b/fs/nfs/nfs4idmap.c
@@ -44,6 +44,7 @@
44#include <linux/keyctl.h> 44#include <linux/keyctl.h>
45#include <linux/key-type.h> 45#include <linux/key-type.h>
46#include <keys/user-type.h> 46#include <keys/user-type.h>
47#include <keys/request_key_auth-type.h>
47#include <linux/module.h> 48#include <linux/module.h>
48 49
49#include "internal.h" 50#include "internal.h"
@@ -59,7 +60,7 @@ static struct key_type key_type_id_resolver_legacy;
59struct idmap_legacy_upcalldata { 60struct idmap_legacy_upcalldata {
60 struct rpc_pipe_msg pipe_msg; 61 struct rpc_pipe_msg pipe_msg;
61 struct idmap_msg idmap_msg; 62 struct idmap_msg idmap_msg;
62 struct key_construction *key_cons; 63 struct key *authkey;
63 struct idmap *idmap; 64 struct idmap *idmap;
64}; 65};
65 66
@@ -384,7 +385,7 @@ static const match_table_t nfs_idmap_tokens = {
384 { Opt_find_err, NULL } 385 { Opt_find_err, NULL }
385}; 386};
386 387
387static int nfs_idmap_legacy_upcall(struct key_construction *, const char *, void *); 388static int nfs_idmap_legacy_upcall(struct key *, void *);
388static ssize_t idmap_pipe_downcall(struct file *, const char __user *, 389static ssize_t idmap_pipe_downcall(struct file *, const char __user *,
389 size_t); 390 size_t);
390static void idmap_release_pipe(struct inode *); 391static void idmap_release_pipe(struct inode *);
@@ -549,11 +550,12 @@ nfs_idmap_prepare_pipe_upcall(struct idmap *idmap,
549static void 550static void
550nfs_idmap_complete_pipe_upcall_locked(struct idmap *idmap, int ret) 551nfs_idmap_complete_pipe_upcall_locked(struct idmap *idmap, int ret)
551{ 552{
552 struct key_construction *cons = idmap->idmap_upcall_data->key_cons; 553 struct key *authkey = idmap->idmap_upcall_data->authkey;
553 554
554 kfree(idmap->idmap_upcall_data); 555 kfree(idmap->idmap_upcall_data);
555 idmap->idmap_upcall_data = NULL; 556 idmap->idmap_upcall_data = NULL;
556 complete_request_key(cons, ret); 557 complete_request_key(authkey, ret);
558 key_put(authkey);
557} 559}
558 560
559static void 561static void
@@ -563,15 +565,14 @@ nfs_idmap_abort_pipe_upcall(struct idmap *idmap, int ret)
563 nfs_idmap_complete_pipe_upcall_locked(idmap, ret); 565 nfs_idmap_complete_pipe_upcall_locked(idmap, ret);
564} 566}
565 567
566static int nfs_idmap_legacy_upcall(struct key_construction *cons, 568static int nfs_idmap_legacy_upcall(struct key *authkey, void *aux)
567 const char *op,
568 void *aux)
569{ 569{
570 struct idmap_legacy_upcalldata *data; 570 struct idmap_legacy_upcalldata *data;
571 struct request_key_auth *rka = get_request_key_auth(authkey);
571 struct rpc_pipe_msg *msg; 572 struct rpc_pipe_msg *msg;
572 struct idmap_msg *im; 573 struct idmap_msg *im;
573 struct idmap *idmap = (struct idmap *)aux; 574 struct idmap *idmap = (struct idmap *)aux;
574 struct key *key = cons->key; 575 struct key *key = rka->target_key;
575 int ret = -ENOKEY; 576 int ret = -ENOKEY;
576 577
577 if (!aux) 578 if (!aux)
@@ -586,7 +587,7 @@ static int nfs_idmap_legacy_upcall(struct key_construction *cons,
586 msg = &data->pipe_msg; 587 msg = &data->pipe_msg;
587 im = &data->idmap_msg; 588 im = &data->idmap_msg;
588 data->idmap = idmap; 589 data->idmap = idmap;
589 data->key_cons = cons; 590 data->authkey = key_get(authkey);
590 591
591 ret = nfs_idmap_prepare_message(key->description, idmap, im, msg); 592 ret = nfs_idmap_prepare_message(key->description, idmap, im, msg);
592 if (ret < 0) 593 if (ret < 0)
@@ -604,7 +605,7 @@ static int nfs_idmap_legacy_upcall(struct key_construction *cons,
604out2: 605out2:
605 kfree(data); 606 kfree(data);
606out1: 607out1:
607 complete_request_key(cons, ret); 608 complete_request_key(authkey, ret);
608 return ret; 609 return ret;
609} 610}
610 611
@@ -651,9 +652,10 @@ out:
651static ssize_t 652static ssize_t
652idmap_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) 653idmap_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
653{ 654{
655 struct request_key_auth *rka;
654 struct rpc_inode *rpci = RPC_I(file_inode(filp)); 656 struct rpc_inode *rpci = RPC_I(file_inode(filp));
655 struct idmap *idmap = (struct idmap *)rpci->private; 657 struct idmap *idmap = (struct idmap *)rpci->private;
656 struct key_construction *cons; 658 struct key *authkey;
657 struct idmap_msg im; 659 struct idmap_msg im;
658 size_t namelen_in; 660 size_t namelen_in;
659 int ret = -ENOKEY; 661 int ret = -ENOKEY;
@@ -665,7 +667,8 @@ idmap_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
665 if (idmap->idmap_upcall_data == NULL) 667 if (idmap->idmap_upcall_data == NULL)
666 goto out_noupcall; 668 goto out_noupcall;
667 669
668 cons = idmap->idmap_upcall_data->key_cons; 670 authkey = idmap->idmap_upcall_data->authkey;
671 rka = get_request_key_auth(authkey);
669 672
670 if (mlen != sizeof(im)) { 673 if (mlen != sizeof(im)) {
671 ret = -ENOSPC; 674 ret = -ENOSPC;
@@ -690,9 +693,9 @@ idmap_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
690 693
691 ret = nfs_idmap_read_and_verify_message(&im, 694 ret = nfs_idmap_read_and_verify_message(&im,
692 &idmap->idmap_upcall_data->idmap_msg, 695 &idmap->idmap_upcall_data->idmap_msg,
693 cons->key, cons->authkey); 696 rka->target_key, authkey);
694 if (ret >= 0) { 697 if (ret >= 0) {
695 key_set_timeout(cons->key, nfs_idmap_cache_timeout); 698 key_set_timeout(rka->target_key, nfs_idmap_cache_timeout);
696 ret = mlen; 699 ret = mlen;
697 } 700 }
698 701
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 633a63462573..f5ed9512d193 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1086,10 +1086,6 @@ static int __set_oom_adj(struct file *file, int oom_adj, bool legacy)
1086 1086
1087 task_lock(p); 1087 task_lock(p);
1088 if (!p->vfork_done && process_shares_mm(p, mm)) { 1088 if (!p->vfork_done && process_shares_mm(p, mm)) {
1089 pr_info("updating oom_score_adj for %d (%s) from %d to %d because it shares mm with %d (%s). Report if this is unexpected.\n",
1090 task_pid_nr(p), p->comm,
1091 p->signal->oom_score_adj, oom_adj,
1092 task_pid_nr(task), task->comm);
1093 p->signal->oom_score_adj = oom_adj; 1089 p->signal->oom_score_adj = oom_adj;
1094 if (!legacy && has_capability_noaudit(current, CAP_SYS_RESOURCE)) 1090 if (!legacy && has_capability_noaudit(current, CAP_SYS_RESOURCE))
1095 p->signal->oom_score_adj_min = (short)oom_adj; 1091 p->signal->oom_score_adj_min = (short)oom_adj;
diff --git a/include/keys/request_key_auth-type.h b/include/keys/request_key_auth-type.h
new file mode 100644
index 000000000000..a726dd3f1dc6
--- /dev/null
+++ b/include/keys/request_key_auth-type.h
@@ -0,0 +1,36 @@
1/* request_key authorisation token key type
2 *
3 * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _KEYS_REQUEST_KEY_AUTH_TYPE_H
13#define _KEYS_REQUEST_KEY_AUTH_TYPE_H
14
15#include <linux/key.h>
16
17/*
18 * Authorisation record for request_key().
19 */
20struct request_key_auth {
21 struct key *target_key;
22 struct key *dest_keyring;
23 const struct cred *cred;
24 void *callout_info;
25 size_t callout_len;
26 pid_t pid;
27 char op[8];
28} __randomize_layout;
29
30static inline struct request_key_auth *get_request_key_auth(const struct key *key)
31{
32 return key->payload.data[0];
33}
34
35
36#endif /* _KEYS_REQUEST_KEY_AUTH_TYPE_H */
diff --git a/include/linux/key-type.h b/include/linux/key-type.h
index bc9af551fc83..e49d1de0614e 100644
--- a/include/linux/key-type.h
+++ b/include/linux/key-type.h
@@ -21,15 +21,6 @@ struct kernel_pkey_query;
21struct kernel_pkey_params; 21struct kernel_pkey_params;
22 22
23/* 23/*
24 * key under-construction record
25 * - passed to the request_key actor if supplied
26 */
27struct key_construction {
28 struct key *key; /* key being constructed */
29 struct key *authkey;/* authorisation for key being constructed */
30};
31
32/*
33 * Pre-parsed payload, used by key add, update and instantiate. 24 * Pre-parsed payload, used by key add, update and instantiate.
34 * 25 *
35 * This struct will be cleared and data and datalen will be set with the data 26 * This struct will be cleared and data and datalen will be set with the data
@@ -50,8 +41,7 @@ struct key_preparsed_payload {
50 time64_t expiry; /* Expiry time of key */ 41 time64_t expiry; /* Expiry time of key */
51} __randomize_layout; 42} __randomize_layout;
52 43
53typedef int (*request_key_actor_t)(struct key_construction *key, 44typedef int (*request_key_actor_t)(struct key *auth_key, void *aux);
54 const char *op, void *aux);
55 45
56/* 46/*
57 * Preparsed matching criterion. 47 * Preparsed matching criterion.
@@ -181,20 +171,20 @@ extern int key_instantiate_and_link(struct key *key,
181 const void *data, 171 const void *data,
182 size_t datalen, 172 size_t datalen,
183 struct key *keyring, 173 struct key *keyring,
184 struct key *instkey); 174 struct key *authkey);
185extern int key_reject_and_link(struct key *key, 175extern int key_reject_and_link(struct key *key,
186 unsigned timeout, 176 unsigned timeout,
187 unsigned error, 177 unsigned error,
188 struct key *keyring, 178 struct key *keyring,
189 struct key *instkey); 179 struct key *authkey);
190extern void complete_request_key(struct key_construction *cons, int error); 180extern void complete_request_key(struct key *authkey, int error);
191 181
192static inline int key_negate_and_link(struct key *key, 182static inline int key_negate_and_link(struct key *key,
193 unsigned timeout, 183 unsigned timeout,
194 struct key *keyring, 184 struct key *keyring,
195 struct key *instkey) 185 struct key *authkey)
196{ 186{
197 return key_reject_and_link(key, timeout, ENOKEY, keyring, instkey); 187 return key_reject_and_link(key, timeout, ENOKEY, keyring, authkey);
198} 188}
199 189
200extern int generic_key_instantiate(struct key *key, struct key_preparsed_payload *prep); 190extern int generic_key_instantiate(struct key *key, struct key_preparsed_payload *prep);
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 2b2a6dce1630..4c76fe2c8488 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -11,6 +11,8 @@
11#define _LINUX_NETDEV_FEATURES_H 11#define _LINUX_NETDEV_FEATURES_H
12 12
13#include <linux/types.h> 13#include <linux/types.h>
14#include <linux/bitops.h>
15#include <asm/byteorder.h>
14 16
15typedef u64 netdev_features_t; 17typedef u64 netdev_features_t;
16 18
@@ -154,8 +156,26 @@ enum {
154#define NETIF_F_HW_TLS_TX __NETIF_F(HW_TLS_TX) 156#define NETIF_F_HW_TLS_TX __NETIF_F(HW_TLS_TX)
155#define NETIF_F_HW_TLS_RX __NETIF_F(HW_TLS_RX) 157#define NETIF_F_HW_TLS_RX __NETIF_F(HW_TLS_RX)
156 158
157#define for_each_netdev_feature(mask_addr, bit) \ 159/* Finds the next feature with the highest number of the range of start till 0.
158 for_each_set_bit(bit, (unsigned long *)mask_addr, NETDEV_FEATURE_COUNT) 160 */
161static inline int find_next_netdev_feature(u64 feature, unsigned long start)
162{
163 /* like BITMAP_LAST_WORD_MASK() for u64
164 * this sets the most significant 64 - start to 0.
165 */
166 feature &= ~0ULL >> (-start & ((sizeof(feature) * 8) - 1));
167
168 return fls64(feature) - 1;
169}
170
171/* This goes for the MSB to the LSB through the set feature bits,
172 * mask_addr should be a u64 and bit an int
173 */
174#define for_each_netdev_feature(mask_addr, bit) \
175 for ((bit) = find_next_netdev_feature((mask_addr), \
176 NETDEV_FEATURE_COUNT); \
177 (bit) >= 0; \
178 (bit) = find_next_netdev_feature((mask_addr), (bit) - 1))
159 179
160/* Features valid for ethtool to change */ 180/* Features valid for ethtool to change */
161/* = all defined minus driver/device-class-related */ 181/* = all defined minus driver/device-class-related */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 95d25b010a25..bdb9563c64a0 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2434,7 +2434,7 @@ static inline void skb_probe_transport_header(struct sk_buff *skb,
2434 2434
2435 if (skb_flow_dissect_flow_keys_basic(skb, &keys, NULL, 0, 0, 0, 0)) 2435 if (skb_flow_dissect_flow_keys_basic(skb, &keys, NULL, 0, 0, 0, 0))
2436 skb_set_transport_header(skb, keys.control.thoff); 2436 skb_set_transport_header(skb, keys.control.thoff);
2437 else 2437 else if (offset_hint >= 0)
2438 skb_set_transport_header(skb, offset_hint); 2438 skb_set_transport_header(skb, offset_hint);
2439} 2439}
2440 2440
@@ -4212,6 +4212,12 @@ static inline bool skb_is_gso_sctp(const struct sk_buff *skb)
4212 return skb_shinfo(skb)->gso_type & SKB_GSO_SCTP; 4212 return skb_shinfo(skb)->gso_type & SKB_GSO_SCTP;
4213} 4213}
4214 4214
4215static inline bool skb_is_gso_tcp(const struct sk_buff *skb)
4216{
4217 return skb_is_gso(skb) &&
4218 skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6);
4219}
4220
4215static inline void skb_gso_reset(struct sk_buff *skb) 4221static inline void skb_gso_reset(struct sk_buff *skb)
4216{ 4222{
4217 skb_shinfo(skb)->gso_size = 0; 4223 skb_shinfo(skb)->gso_size = 0;
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index cb462f9ab7dd..71f2394abbf7 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -57,6 +57,15 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,
57 57
58 if (!skb_partial_csum_set(skb, start, off)) 58 if (!skb_partial_csum_set(skb, start, off))
59 return -EINVAL; 59 return -EINVAL;
60 } else {
61 /* gso packets without NEEDS_CSUM do not set transport_offset.
62 * probe and drop if does not match one of the above types.
63 */
64 if (gso_type) {
65 skb_probe_transport_header(skb, -1);
66 if (!skb_transport_header_was_set(skb))
67 return -EINVAL;
68 }
60 } 69 }
61 70
62 if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) { 71 if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) {
diff --git a/init/initramfs.c b/init/initramfs.c
index 7cea802d00ef..fca899622937 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -550,6 +550,7 @@ skip:
550 initrd_end = 0; 550 initrd_end = 0;
551} 551}
552 552
553#ifdef CONFIG_BLK_DEV_RAM
553#define BUF_SIZE 1024 554#define BUF_SIZE 1024
554static void __init clean_rootfs(void) 555static void __init clean_rootfs(void)
555{ 556{
@@ -596,6 +597,7 @@ static void __init clean_rootfs(void)
596 ksys_close(fd); 597 ksys_close(fd);
597 kfree(buf); 598 kfree(buf);
598} 599}
600#endif
599 601
600static int __init populate_rootfs(void) 602static int __init populate_rootfs(void)
601{ 603{
@@ -638,10 +640,8 @@ static int __init populate_rootfs(void)
638 printk(KERN_INFO "Unpacking initramfs...\n"); 640 printk(KERN_INFO "Unpacking initramfs...\n");
639 err = unpack_to_rootfs((char *)initrd_start, 641 err = unpack_to_rootfs((char *)initrd_start,
640 initrd_end - initrd_start); 642 initrd_end - initrd_start);
641 if (err) { 643 if (err)
642 printk(KERN_EMERG "Initramfs unpacking failed: %s\n", err); 644 printk(KERN_EMERG "Initramfs unpacking failed: %s\n", err);
643 clean_rootfs();
644 }
645 free_initrd(); 645 free_initrd();
646#endif 646#endif
647 } 647 }
diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c
index d43b14535827..950ab2f28922 100644
--- a/kernel/bpf/stackmap.c
+++ b/kernel/bpf/stackmap.c
@@ -44,7 +44,7 @@ static void do_up_read(struct irq_work *entry)
44 struct stack_map_irq_work *work; 44 struct stack_map_irq_work *work;
45 45
46 work = container_of(entry, struct stack_map_irq_work, irq_work); 46 work = container_of(entry, struct stack_map_irq_work, irq_work);
47 up_read(work->sem); 47 up_read_non_owner(work->sem);
48 work->sem = NULL; 48 work->sem = NULL;
49} 49}
50 50
@@ -338,6 +338,12 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs,
338 } else { 338 } else {
339 work->sem = &current->mm->mmap_sem; 339 work->sem = &current->mm->mmap_sem;
340 irq_work_queue(&work->irq_work); 340 irq_work_queue(&work->irq_work);
341 /*
342 * The irq_work will release the mmap_sem with
343 * up_read_non_owner(). The rwsem_release() is called
344 * here to release the lock from lockdep's perspective.
345 */
346 rwsem_release(&current->mm->mmap_sem.dep_map, 1, _RET_IP_);
341 } 347 }
342} 348}
343 349
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 56674a7c3778..8f295b790297 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -1617,12 +1617,13 @@ static int check_flow_keys_access(struct bpf_verifier_env *env, int off,
1617 return 0; 1617 return 0;
1618} 1618}
1619 1619
1620static int check_sock_access(struct bpf_verifier_env *env, u32 regno, int off, 1620static int check_sock_access(struct bpf_verifier_env *env, int insn_idx,
1621 int size, enum bpf_access_type t) 1621 u32 regno, int off, int size,
1622 enum bpf_access_type t)
1622{ 1623{
1623 struct bpf_reg_state *regs = cur_regs(env); 1624 struct bpf_reg_state *regs = cur_regs(env);
1624 struct bpf_reg_state *reg = &regs[regno]; 1625 struct bpf_reg_state *reg = &regs[regno];
1625 struct bpf_insn_access_aux info; 1626 struct bpf_insn_access_aux info = {};
1626 1627
1627 if (reg->smin_value < 0) { 1628 if (reg->smin_value < 0) {
1628 verbose(env, "R%d min value is negative, either use unsigned index or do a if (index >=0) check.\n", 1629 verbose(env, "R%d min value is negative, either use unsigned index or do a if (index >=0) check.\n",
@@ -1636,6 +1637,8 @@ static int check_sock_access(struct bpf_verifier_env *env, u32 regno, int off,
1636 return -EACCES; 1637 return -EACCES;
1637 } 1638 }
1638 1639
1640 env->insn_aux_data[insn_idx].ctx_field_size = info.ctx_field_size;
1641
1639 return 0; 1642 return 0;
1640} 1643}
1641 1644
@@ -2032,7 +2035,7 @@ static int check_mem_access(struct bpf_verifier_env *env, int insn_idx, u32 regn
2032 verbose(env, "cannot write into socket\n"); 2035 verbose(env, "cannot write into socket\n");
2033 return -EACCES; 2036 return -EACCES;
2034 } 2037 }
2035 err = check_sock_access(env, regno, off, size, t); 2038 err = check_sock_access(env, insn_idx, regno, off, size, t);
2036 if (!err && value_regno >= 0) 2039 if (!err && value_regno >= 0)
2037 mark_reg_unknown(env, regs, value_regno); 2040 mark_reg_unknown(env, regs, value_regno);
2038 } else { 2041 } else {
diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
index c3484785b179..0e97ca9306ef 100644
--- a/kernel/sched/psi.c
+++ b/kernel/sched/psi.c
@@ -322,7 +322,7 @@ static bool update_stats(struct psi_group *group)
322 expires = group->next_update; 322 expires = group->next_update;
323 if (now < expires) 323 if (now < expires)
324 goto out; 324 goto out;
325 if (now - expires > psi_period) 325 if (now - expires >= psi_period)
326 missed_periods = div_u64(now - expires, psi_period); 326 missed_periods = div_u64(now - expires, psi_period);
327 327
328 /* 328 /*
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index c521b7347482..c4238b441624 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3384,6 +3384,8 @@ static void print_func_help_header_irq(struct trace_buffer *buf, struct seq_file
3384 const char tgid_space[] = " "; 3384 const char tgid_space[] = " ";
3385 const char space[] = " "; 3385 const char space[] = " ";
3386 3386
3387 print_event_info(buf, m);
3388
3387 seq_printf(m, "# %s _-----=> irqs-off\n", 3389 seq_printf(m, "# %s _-----=> irqs-off\n",
3388 tgid ? tgid_space : space); 3390 tgid ? tgid_space : space);
3389 seq_printf(m, "# %s / _----=> need-resched\n", 3391 seq_printf(m, "# %s / _----=> need-resched\n",
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index d5fb09ebba8b..9eaf07f99212 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -861,22 +861,14 @@ static const struct file_operations kprobe_profile_ops = {
861static nokprobe_inline int 861static nokprobe_inline int
862fetch_store_strlen(unsigned long addr) 862fetch_store_strlen(unsigned long addr)
863{ 863{
864 mm_segment_t old_fs;
865 int ret, len = 0; 864 int ret, len = 0;
866 u8 c; 865 u8 c;
867 866
868 old_fs = get_fs();
869 set_fs(KERNEL_DS);
870 pagefault_disable();
871
872 do { 867 do {
873 ret = __copy_from_user_inatomic(&c, (u8 *)addr + len, 1); 868 ret = probe_mem_read(&c, (u8 *)addr + len, 1);
874 len++; 869 len++;
875 } while (c && ret == 0 && len < MAX_STRING_SIZE); 870 } while (c && ret == 0 && len < MAX_STRING_SIZE);
876 871
877 pagefault_enable();
878 set_fs(old_fs);
879
880 return (ret < 0) ? ret : len; 872 return (ret < 0) ? ret : len;
881} 873}
882 874
diff --git a/lib/assoc_array.c b/lib/assoc_array.c
index c6659cb37033..59875eb278ea 100644
--- a/lib/assoc_array.c
+++ b/lib/assoc_array.c
@@ -768,9 +768,11 @@ all_leaves_cluster_together:
768 new_s0->index_key[i] = 768 new_s0->index_key[i] =
769 ops->get_key_chunk(index_key, i * ASSOC_ARRAY_KEY_CHUNK_SIZE); 769 ops->get_key_chunk(index_key, i * ASSOC_ARRAY_KEY_CHUNK_SIZE);
770 770
771 blank = ULONG_MAX << (level & ASSOC_ARRAY_KEY_CHUNK_MASK); 771 if (level & ASSOC_ARRAY_KEY_CHUNK_MASK) {
772 pr_devel("blank off [%zu] %d: %lx\n", keylen - 1, level, blank); 772 blank = ULONG_MAX << (level & ASSOC_ARRAY_KEY_CHUNK_MASK);
773 new_s0->index_key[keylen - 1] &= ~blank; 773 pr_devel("blank off [%zu] %d: %lx\n", keylen - 1, level, blank);
774 new_s0->index_key[keylen - 1] &= ~blank;
775 }
774 776
775 /* This now reduces to a node splitting exercise for which we'll need 777 /* This now reduces to a node splitting exercise for which we'll need
776 * to regenerate the disparity table. 778 * to regenerate the disparity table.
diff --git a/mm/debug.c b/mm/debug.c
index 0abb987dad9b..1611cf00a137 100644
--- a/mm/debug.c
+++ b/mm/debug.c
@@ -44,7 +44,7 @@ const struct trace_print_flags vmaflag_names[] = {
44 44
45void __dump_page(struct page *page, const char *reason) 45void __dump_page(struct page *page, const char *reason)
46{ 46{
47 struct address_space *mapping = page_mapping(page); 47 struct address_space *mapping;
48 bool page_poisoned = PagePoisoned(page); 48 bool page_poisoned = PagePoisoned(page);
49 int mapcount; 49 int mapcount;
50 50
@@ -58,6 +58,8 @@ void __dump_page(struct page *page, const char *reason)
58 goto hex_only; 58 goto hex_only;
59 } 59 }
60 60
61 mapping = page_mapping(page);
62
61 /* 63 /*
62 * Avoid VM_BUG_ON() in page_mapcount(). 64 * Avoid VM_BUG_ON() in page_mapcount().
63 * page->_mapcount space in struct page is used by sl[aou]b pages to 65 * page->_mapcount space in struct page is used by sl[aou]b pages to
diff --git a/mm/kasan/Makefile b/mm/kasan/Makefile
index e2bb06c1b45e..5d1065efbd47 100644
--- a/mm/kasan/Makefile
+++ b/mm/kasan/Makefile
@@ -7,6 +7,8 @@ KCOV_INSTRUMENT := n
7 7
8CFLAGS_REMOVE_common.o = -pg 8CFLAGS_REMOVE_common.o = -pg
9CFLAGS_REMOVE_generic.o = -pg 9CFLAGS_REMOVE_generic.o = -pg
10CFLAGS_REMOVE_tags.o = -pg
11
10# Function splitter causes unnecessary splits in __asan_load1/__asan_store1 12# Function splitter causes unnecessary splits in __asan_load1/__asan_store1
11# see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63533 13# see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63533
12 14
diff --git a/mm/kasan/common.c b/mm/kasan/common.c
index 73c9cbfdedf4..09b534fbba17 100644
--- a/mm/kasan/common.c
+++ b/mm/kasan/common.c
@@ -361,10 +361,15 @@ void kasan_poison_object_data(struct kmem_cache *cache, void *object)
361 * get different tags. 361 * get different tags.
362 */ 362 */
363static u8 assign_tag(struct kmem_cache *cache, const void *object, 363static u8 assign_tag(struct kmem_cache *cache, const void *object,
364 bool init, bool krealloc) 364 bool init, bool keep_tag)
365{ 365{
366 /* Reuse the same tag for krealloc'ed objects. */ 366 /*
367 if (krealloc) 367 * 1. When an object is kmalloc()'ed, two hooks are called:
368 * kasan_slab_alloc() and kasan_kmalloc(). We assign the
369 * tag only in the first one.
370 * 2. We reuse the same tag for krealloc'ed objects.
371 */
372 if (keep_tag)
368 return get_tag(object); 373 return get_tag(object);
369 374
370 /* 375 /*
@@ -405,12 +410,6 @@ void * __must_check kasan_init_slab_obj(struct kmem_cache *cache,
405 return (void *)object; 410 return (void *)object;
406} 411}
407 412
408void * __must_check kasan_slab_alloc(struct kmem_cache *cache, void *object,
409 gfp_t flags)
410{
411 return kasan_kmalloc(cache, object, cache->object_size, flags);
412}
413
414static inline bool shadow_invalid(u8 tag, s8 shadow_byte) 413static inline bool shadow_invalid(u8 tag, s8 shadow_byte)
415{ 414{
416 if (IS_ENABLED(CONFIG_KASAN_GENERIC)) 415 if (IS_ENABLED(CONFIG_KASAN_GENERIC))
@@ -467,7 +466,7 @@ bool kasan_slab_free(struct kmem_cache *cache, void *object, unsigned long ip)
467} 466}
468 467
469static void *__kasan_kmalloc(struct kmem_cache *cache, const void *object, 468static void *__kasan_kmalloc(struct kmem_cache *cache, const void *object,
470 size_t size, gfp_t flags, bool krealloc) 469 size_t size, gfp_t flags, bool keep_tag)
471{ 470{
472 unsigned long redzone_start; 471 unsigned long redzone_start;
473 unsigned long redzone_end; 472 unsigned long redzone_end;
@@ -485,7 +484,7 @@ static void *__kasan_kmalloc(struct kmem_cache *cache, const void *object,
485 KASAN_SHADOW_SCALE_SIZE); 484 KASAN_SHADOW_SCALE_SIZE);
486 485
487 if (IS_ENABLED(CONFIG_KASAN_SW_TAGS)) 486 if (IS_ENABLED(CONFIG_KASAN_SW_TAGS))
488 tag = assign_tag(cache, object, false, krealloc); 487 tag = assign_tag(cache, object, false, keep_tag);
489 488
490 /* Tag is ignored in set_tag without CONFIG_KASAN_SW_TAGS */ 489 /* Tag is ignored in set_tag without CONFIG_KASAN_SW_TAGS */
491 kasan_unpoison_shadow(set_tag(object, tag), size); 490 kasan_unpoison_shadow(set_tag(object, tag), size);
@@ -498,10 +497,16 @@ static void *__kasan_kmalloc(struct kmem_cache *cache, const void *object,
498 return set_tag(object, tag); 497 return set_tag(object, tag);
499} 498}
500 499
500void * __must_check kasan_slab_alloc(struct kmem_cache *cache, void *object,
501 gfp_t flags)
502{
503 return __kasan_kmalloc(cache, object, cache->object_size, flags, false);
504}
505
501void * __must_check kasan_kmalloc(struct kmem_cache *cache, const void *object, 506void * __must_check kasan_kmalloc(struct kmem_cache *cache, const void *object,
502 size_t size, gfp_t flags) 507 size_t size, gfp_t flags)
503{ 508{
504 return __kasan_kmalloc(cache, object, size, flags, false); 509 return __kasan_kmalloc(cache, object, size, flags, true);
505} 510}
506EXPORT_SYMBOL(kasan_kmalloc); 511EXPORT_SYMBOL(kasan_kmalloc);
507 512
diff --git a/mm/kasan/tags.c b/mm/kasan/tags.c
index 0777649e07c4..63fca3172659 100644
--- a/mm/kasan/tags.c
+++ b/mm/kasan/tags.c
@@ -46,7 +46,7 @@ void kasan_init_tags(void)
46 int cpu; 46 int cpu;
47 47
48 for_each_possible_cpu(cpu) 48 for_each_possible_cpu(cpu)
49 per_cpu(prng_state, cpu) = get_random_u32(); 49 per_cpu(prng_state, cpu) = (u32)get_cycles();
50} 50}
51 51
52/* 52/*
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index f9d9dc250428..707fa5579f66 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -574,6 +574,7 @@ static struct kmemleak_object *create_object(unsigned long ptr, size_t size,
574 unsigned long flags; 574 unsigned long flags;
575 struct kmemleak_object *object, *parent; 575 struct kmemleak_object *object, *parent;
576 struct rb_node **link, *rb_parent; 576 struct rb_node **link, *rb_parent;
577 unsigned long untagged_ptr;
577 578
578 object = kmem_cache_alloc(object_cache, gfp_kmemleak_mask(gfp)); 579 object = kmem_cache_alloc(object_cache, gfp_kmemleak_mask(gfp));
579 if (!object) { 580 if (!object) {
@@ -619,8 +620,9 @@ static struct kmemleak_object *create_object(unsigned long ptr, size_t size,
619 620
620 write_lock_irqsave(&kmemleak_lock, flags); 621 write_lock_irqsave(&kmemleak_lock, flags);
621 622
622 min_addr = min(min_addr, ptr); 623 untagged_ptr = (unsigned long)kasan_reset_tag((void *)ptr);
623 max_addr = max(max_addr, ptr + size); 624 min_addr = min(min_addr, untagged_ptr);
625 max_addr = max(max_addr, untagged_ptr + size);
624 link = &object_tree_root.rb_node; 626 link = &object_tree_root.rb_node;
625 rb_parent = NULL; 627 rb_parent = NULL;
626 while (*link) { 628 while (*link) {
@@ -1333,6 +1335,7 @@ static void scan_block(void *_start, void *_end,
1333 unsigned long *start = PTR_ALIGN(_start, BYTES_PER_POINTER); 1335 unsigned long *start = PTR_ALIGN(_start, BYTES_PER_POINTER);
1334 unsigned long *end = _end - (BYTES_PER_POINTER - 1); 1336 unsigned long *end = _end - (BYTES_PER_POINTER - 1);
1335 unsigned long flags; 1337 unsigned long flags;
1338 unsigned long untagged_ptr;
1336 1339
1337 read_lock_irqsave(&kmemleak_lock, flags); 1340 read_lock_irqsave(&kmemleak_lock, flags);
1338 for (ptr = start; ptr < end; ptr++) { 1341 for (ptr = start; ptr < end; ptr++) {
@@ -1347,7 +1350,8 @@ static void scan_block(void *_start, void *_end,
1347 pointer = *ptr; 1350 pointer = *ptr;
1348 kasan_enable_current(); 1351 kasan_enable_current();
1349 1352
1350 if (pointer < min_addr || pointer >= max_addr) 1353 untagged_ptr = (unsigned long)kasan_reset_tag((void *)pointer);
1354 if (untagged_ptr < min_addr || untagged_ptr >= max_addr)
1351 continue; 1355 continue;
1352 1356
1353 /* 1357 /*
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 124e794867c5..1ad28323fb9f 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1188,11 +1188,13 @@ static inline int pageblock_free(struct page *page)
1188 return PageBuddy(page) && page_order(page) >= pageblock_order; 1188 return PageBuddy(page) && page_order(page) >= pageblock_order;
1189} 1189}
1190 1190
1191/* Return the start of the next active pageblock after a given page */ 1191/* Return the pfn of the start of the next active pageblock after a given pfn */
1192static struct page *next_active_pageblock(struct page *page) 1192static unsigned long next_active_pageblock(unsigned long pfn)
1193{ 1193{
1194 struct page *page = pfn_to_page(pfn);
1195
1194 /* Ensure the starting page is pageblock-aligned */ 1196 /* Ensure the starting page is pageblock-aligned */
1195 BUG_ON(page_to_pfn(page) & (pageblock_nr_pages - 1)); 1197 BUG_ON(pfn & (pageblock_nr_pages - 1));
1196 1198
1197 /* If the entire pageblock is free, move to the end of free page */ 1199 /* If the entire pageblock is free, move to the end of free page */
1198 if (pageblock_free(page)) { 1200 if (pageblock_free(page)) {
@@ -1200,16 +1202,16 @@ static struct page *next_active_pageblock(struct page *page)
1200 /* be careful. we don't have locks, page_order can be changed.*/ 1202 /* be careful. we don't have locks, page_order can be changed.*/
1201 order = page_order(page); 1203 order = page_order(page);
1202 if ((order < MAX_ORDER) && (order >= pageblock_order)) 1204 if ((order < MAX_ORDER) && (order >= pageblock_order))
1203 return page + (1 << order); 1205 return pfn + (1 << order);
1204 } 1206 }
1205 1207
1206 return page + pageblock_nr_pages; 1208 return pfn + pageblock_nr_pages;
1207} 1209}
1208 1210
1209static bool is_pageblock_removable_nolock(struct page *page) 1211static bool is_pageblock_removable_nolock(unsigned long pfn)
1210{ 1212{
1213 struct page *page = pfn_to_page(pfn);
1211 struct zone *zone; 1214 struct zone *zone;
1212 unsigned long pfn;
1213 1215
1214 /* 1216 /*
1215 * We have to be careful here because we are iterating over memory 1217 * We have to be careful here because we are iterating over memory
@@ -1232,13 +1234,14 @@ static bool is_pageblock_removable_nolock(struct page *page)
1232/* Checks if this range of memory is likely to be hot-removable. */ 1234/* Checks if this range of memory is likely to be hot-removable. */
1233bool is_mem_section_removable(unsigned long start_pfn, unsigned long nr_pages) 1235bool is_mem_section_removable(unsigned long start_pfn, unsigned long nr_pages)
1234{ 1236{
1235 struct page *page = pfn_to_page(start_pfn); 1237 unsigned long end_pfn, pfn;
1236 unsigned long end_pfn = min(start_pfn + nr_pages, zone_end_pfn(page_zone(page))); 1238
1237 struct page *end_page = pfn_to_page(end_pfn); 1239 end_pfn = min(start_pfn + nr_pages,
1240 zone_end_pfn(page_zone(pfn_to_page(start_pfn))));
1238 1241
1239 /* Check the starting page of each pageblock within the range */ 1242 /* Check the starting page of each pageblock within the range */
1240 for (; page < end_page; page = next_active_pageblock(page)) { 1243 for (pfn = start_pfn; pfn < end_pfn; pfn = next_active_pageblock(pfn)) {
1241 if (!is_pageblock_removable_nolock(page)) 1244 if (!is_pageblock_removable_nolock(pfn))
1242 return false; 1245 return false;
1243 cond_resched(); 1246 cond_resched();
1244 } 1247 }
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index d4496d9d34f5..ee2bce59d2bf 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1314,7 +1314,7 @@ static int copy_nodes_to_user(unsigned long __user *mask, unsigned long maxnode,
1314 nodemask_t *nodes) 1314 nodemask_t *nodes)
1315{ 1315{
1316 unsigned long copy = ALIGN(maxnode-1, 64) / 8; 1316 unsigned long copy = ALIGN(maxnode-1, 64) / 8;
1317 const int nbytes = BITS_TO_LONGS(MAX_NUMNODES) * sizeof(long); 1317 unsigned int nbytes = BITS_TO_LONGS(nr_node_ids) * sizeof(long);
1318 1318
1319 if (copy > nbytes) { 1319 if (copy > nbytes) {
1320 if (copy > PAGE_SIZE) 1320 if (copy > PAGE_SIZE)
@@ -1491,7 +1491,7 @@ static int kernel_get_mempolicy(int __user *policy,
1491 int uninitialized_var(pval); 1491 int uninitialized_var(pval);
1492 nodemask_t nodes; 1492 nodemask_t nodes;
1493 1493
1494 if (nmask != NULL && maxnode < MAX_NUMNODES) 1494 if (nmask != NULL && maxnode < nr_node_ids)
1495 return -EINVAL; 1495 return -EINVAL;
1496 1496
1497 err = do_get_mempolicy(&pval, &nodes, addr, flags); 1497 err = do_get_mempolicy(&pval, &nodes, addr, flags);
@@ -1527,7 +1527,7 @@ COMPAT_SYSCALL_DEFINE5(get_mempolicy, int __user *, policy,
1527 unsigned long nr_bits, alloc_size; 1527 unsigned long nr_bits, alloc_size;
1528 DECLARE_BITMAP(bm, MAX_NUMNODES); 1528 DECLARE_BITMAP(bm, MAX_NUMNODES);
1529 1529
1530 nr_bits = min_t(unsigned long, maxnode-1, MAX_NUMNODES); 1530 nr_bits = min_t(unsigned long, maxnode-1, nr_node_ids);
1531 alloc_size = ALIGN(nr_bits, BITS_PER_LONG) / 8; 1531 alloc_size = ALIGN(nr_bits, BITS_PER_LONG) / 8;
1532 1532
1533 if (nmask) 1533 if (nmask)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 46285d28e43b..0b9f577b1a2a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2170,6 +2170,18 @@ static inline void boost_watermark(struct zone *zone)
2170 2170
2171 max_boost = mult_frac(zone->_watermark[WMARK_HIGH], 2171 max_boost = mult_frac(zone->_watermark[WMARK_HIGH],
2172 watermark_boost_factor, 10000); 2172 watermark_boost_factor, 10000);
2173
2174 /*
2175 * high watermark may be uninitialised if fragmentation occurs
2176 * very early in boot so do not boost. We do not fall
2177 * through and boost by pageblock_nr_pages as failing
2178 * allocations that early means that reclaim is not going
2179 * to help and it may even be impossible to reclaim the
2180 * boosted watermark resulting in a hang.
2181 */
2182 if (!max_boost)
2183 return;
2184
2173 max_boost = max(pageblock_nr_pages, max_boost); 2185 max_boost = max(pageblock_nr_pages, max_boost);
2174 2186
2175 zone->watermark_boost = min(zone->watermark_boost + pageblock_nr_pages, 2187 zone->watermark_boost = min(zone->watermark_boost + pageblock_nr_pages,
@@ -4675,11 +4687,11 @@ refill:
4675 /* Even if we own the page, we do not use atomic_set(). 4687 /* Even if we own the page, we do not use atomic_set().
4676 * This would break get_page_unless_zero() users. 4688 * This would break get_page_unless_zero() users.
4677 */ 4689 */
4678 page_ref_add(page, size); 4690 page_ref_add(page, PAGE_FRAG_CACHE_MAX_SIZE);
4679 4691
4680 /* reset page count bias and offset to start of new frag */ 4692 /* reset page count bias and offset to start of new frag */
4681 nc->pfmemalloc = page_is_pfmemalloc(page); 4693 nc->pfmemalloc = page_is_pfmemalloc(page);
4682 nc->pagecnt_bias = size + 1; 4694 nc->pagecnt_bias = PAGE_FRAG_CACHE_MAX_SIZE + 1;
4683 nc->offset = size; 4695 nc->offset = size;
4684 } 4696 }
4685 4697
@@ -4695,10 +4707,10 @@ refill:
4695 size = nc->size; 4707 size = nc->size;
4696#endif 4708#endif
4697 /* OK, page count is 0, we can safely set it */ 4709 /* OK, page count is 0, we can safely set it */
4698 set_page_count(page, size + 1); 4710 set_page_count(page, PAGE_FRAG_CACHE_MAX_SIZE + 1);
4699 4711
4700 /* reset page count bias and offset to start of new frag */ 4712 /* reset page count bias and offset to start of new frag */
4701 nc->pagecnt_bias = size + 1; 4713 nc->pagecnt_bias = PAGE_FRAG_CACHE_MAX_SIZE + 1;
4702 offset = size - fragsz; 4714 offset = size - fragsz;
4703 } 4715 }
4704 4716
diff --git a/mm/shmem.c b/mm/shmem.c
index 6ece1e2fe76e..0905215fb016 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2854,10 +2854,14 @@ static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentr
2854 * No ordinary (disk based) filesystem counts links as inodes; 2854 * No ordinary (disk based) filesystem counts links as inodes;
2855 * but each new link needs a new dentry, pinning lowmem, and 2855 * but each new link needs a new dentry, pinning lowmem, and
2856 * tmpfs dentries cannot be pruned until they are unlinked. 2856 * tmpfs dentries cannot be pruned until they are unlinked.
2857 * But if an O_TMPFILE file is linked into the tmpfs, the
2858 * first link must skip that, to get the accounting right.
2857 */ 2859 */
2858 ret = shmem_reserve_inode(inode->i_sb); 2860 if (inode->i_nlink) {
2859 if (ret) 2861 ret = shmem_reserve_inode(inode->i_sb);
2860 goto out; 2862 if (ret)
2863 goto out;
2864 }
2861 2865
2862 dir->i_size += BOGO_DIRENT_SIZE; 2866 dir->i_size += BOGO_DIRENT_SIZE;
2863 inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode); 2867 inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode);
diff --git a/mm/slab.c b/mm/slab.c
index 78eb8c5bf4e4..91c1863df93d 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2359,7 +2359,7 @@ static void *alloc_slabmgmt(struct kmem_cache *cachep,
2359 void *freelist; 2359 void *freelist;
2360 void *addr = page_address(page); 2360 void *addr = page_address(page);
2361 2361
2362 page->s_mem = kasan_reset_tag(addr) + colour_off; 2362 page->s_mem = addr + colour_off;
2363 page->active = 0; 2363 page->active = 0;
2364 2364
2365 if (OBJFREELIST_SLAB(cachep)) 2365 if (OBJFREELIST_SLAB(cachep))
@@ -2368,6 +2368,7 @@ static void *alloc_slabmgmt(struct kmem_cache *cachep,
2368 /* Slab management obj is off-slab. */ 2368 /* Slab management obj is off-slab. */
2369 freelist = kmem_cache_alloc_node(cachep->freelist_cache, 2369 freelist = kmem_cache_alloc_node(cachep->freelist_cache,
2370 local_flags, nodeid); 2370 local_flags, nodeid);
2371 freelist = kasan_reset_tag(freelist);
2371 if (!freelist) 2372 if (!freelist)
2372 return NULL; 2373 return NULL;
2373 } else { 2374 } else {
@@ -2681,6 +2682,13 @@ static struct page *cache_grow_begin(struct kmem_cache *cachep,
2681 2682
2682 offset *= cachep->colour_off; 2683 offset *= cachep->colour_off;
2683 2684
2685 /*
2686 * Call kasan_poison_slab() before calling alloc_slabmgmt(), so
2687 * page_address() in the latter returns a non-tagged pointer,
2688 * as it should be for slab pages.
2689 */
2690 kasan_poison_slab(page);
2691
2684 /* Get slab management. */ 2692 /* Get slab management. */
2685 freelist = alloc_slabmgmt(cachep, page, offset, 2693 freelist = alloc_slabmgmt(cachep, page, offset,
2686 local_flags & ~GFP_CONSTRAINT_MASK, page_node); 2694 local_flags & ~GFP_CONSTRAINT_MASK, page_node);
@@ -2689,7 +2697,6 @@ static struct page *cache_grow_begin(struct kmem_cache *cachep,
2689 2697
2690 slab_map_pages(cachep, page, freelist); 2698 slab_map_pages(cachep, page, freelist);
2691 2699
2692 kasan_poison_slab(page);
2693 cache_init_objs(cachep, page); 2700 cache_init_objs(cachep, page);
2694 2701
2695 if (gfpflags_allow_blocking(local_flags)) 2702 if (gfpflags_allow_blocking(local_flags))
@@ -3540,7 +3547,6 @@ void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags)
3540{ 3547{
3541 void *ret = slab_alloc(cachep, flags, _RET_IP_); 3548 void *ret = slab_alloc(cachep, flags, _RET_IP_);
3542 3549
3543 ret = kasan_slab_alloc(cachep, ret, flags);
3544 trace_kmem_cache_alloc(_RET_IP_, ret, 3550 trace_kmem_cache_alloc(_RET_IP_, ret,
3545 cachep->object_size, cachep->size, flags); 3551 cachep->object_size, cachep->size, flags);
3546 3552
@@ -3630,7 +3636,6 @@ void *kmem_cache_alloc_node(struct kmem_cache *cachep, gfp_t flags, int nodeid)
3630{ 3636{
3631 void *ret = slab_alloc_node(cachep, flags, nodeid, _RET_IP_); 3637 void *ret = slab_alloc_node(cachep, flags, nodeid, _RET_IP_);
3632 3638
3633 ret = kasan_slab_alloc(cachep, ret, flags);
3634 trace_kmem_cache_alloc_node(_RET_IP_, ret, 3639 trace_kmem_cache_alloc_node(_RET_IP_, ret,
3635 cachep->object_size, cachep->size, 3640 cachep->object_size, cachep->size,
3636 flags, nodeid); 3641 flags, nodeid);
@@ -4408,6 +4413,8 @@ void __check_heap_object(const void *ptr, unsigned long n, struct page *page,
4408 unsigned int objnr; 4413 unsigned int objnr;
4409 unsigned long offset; 4414 unsigned long offset;
4410 4415
4416 ptr = kasan_reset_tag(ptr);
4417
4411 /* Find and validate object. */ 4418 /* Find and validate object. */
4412 cachep = page->slab_cache; 4419 cachep = page->slab_cache;
4413 objnr = obj_to_index(cachep, page, (void *)ptr); 4420 objnr = obj_to_index(cachep, page, (void *)ptr);
diff --git a/mm/slab.h b/mm/slab.h
index 4190c24ef0e9..384105318779 100644
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -437,11 +437,10 @@ static inline void slab_post_alloc_hook(struct kmem_cache *s, gfp_t flags,
437 437
438 flags &= gfp_allowed_mask; 438 flags &= gfp_allowed_mask;
439 for (i = 0; i < size; i++) { 439 for (i = 0; i < size; i++) {
440 void *object = p[i]; 440 p[i] = kasan_slab_alloc(s, p[i], flags);
441 441 /* As p[i] might get tagged, call kmemleak hook after KASAN. */
442 kmemleak_alloc_recursive(object, s->object_size, 1, 442 kmemleak_alloc_recursive(p[i], s->object_size, 1,
443 s->flags, flags); 443 s->flags, flags);
444 p[i] = kasan_slab_alloc(s, object, flags);
445 } 444 }
446 445
447 if (memcg_kmem_enabled()) 446 if (memcg_kmem_enabled())
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 81732d05e74a..f9d89c1b5977 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -1228,8 +1228,9 @@ void *kmalloc_order(size_t size, gfp_t flags, unsigned int order)
1228 flags |= __GFP_COMP; 1228 flags |= __GFP_COMP;
1229 page = alloc_pages(flags, order); 1229 page = alloc_pages(flags, order);
1230 ret = page ? page_address(page) : NULL; 1230 ret = page ? page_address(page) : NULL;
1231 kmemleak_alloc(ret, size, 1, flags);
1232 ret = kasan_kmalloc_large(ret, size, flags); 1231 ret = kasan_kmalloc_large(ret, size, flags);
1232 /* As ret might get tagged, call kmemleak hook after KASAN. */
1233 kmemleak_alloc(ret, size, 1, flags);
1233 return ret; 1234 return ret;
1234} 1235}
1235EXPORT_SYMBOL(kmalloc_order); 1236EXPORT_SYMBOL(kmalloc_order);
diff --git a/mm/slub.c b/mm/slub.c
index 1e3d0ec4e200..dc777761b6b7 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -249,7 +249,18 @@ static inline void *freelist_ptr(const struct kmem_cache *s, void *ptr,
249 unsigned long ptr_addr) 249 unsigned long ptr_addr)
250{ 250{
251#ifdef CONFIG_SLAB_FREELIST_HARDENED 251#ifdef CONFIG_SLAB_FREELIST_HARDENED
252 return (void *)((unsigned long)ptr ^ s->random ^ ptr_addr); 252 /*
253 * When CONFIG_KASAN_SW_TAGS is enabled, ptr_addr might be tagged.
254 * Normally, this doesn't cause any issues, as both set_freepointer()
255 * and get_freepointer() are called with a pointer with the same tag.
256 * However, there are some issues with CONFIG_SLUB_DEBUG code. For
257 * example, when __free_slub() iterates over objects in a cache, it
258 * passes untagged pointers to check_object(). check_object() in turns
259 * calls get_freepointer() with an untagged pointer, which causes the
260 * freepointer to be restored incorrectly.
261 */
262 return (void *)((unsigned long)ptr ^ s->random ^
263 (unsigned long)kasan_reset_tag((void *)ptr_addr));
253#else 264#else
254 return ptr; 265 return ptr;
255#endif 266#endif
@@ -303,15 +314,10 @@ static inline void set_freepointer(struct kmem_cache *s, void *object, void *fp)
303 __p < (__addr) + (__objects) * (__s)->size; \ 314 __p < (__addr) + (__objects) * (__s)->size; \
304 __p += (__s)->size) 315 __p += (__s)->size)
305 316
306#define for_each_object_idx(__p, __idx, __s, __addr, __objects) \
307 for (__p = fixup_red_left(__s, __addr), __idx = 1; \
308 __idx <= __objects; \
309 __p += (__s)->size, __idx++)
310
311/* Determine object index from a given position */ 317/* Determine object index from a given position */
312static inline unsigned int slab_index(void *p, struct kmem_cache *s, void *addr) 318static inline unsigned int slab_index(void *p, struct kmem_cache *s, void *addr)
313{ 319{
314 return (p - addr) / s->size; 320 return (kasan_reset_tag(p) - addr) / s->size;
315} 321}
316 322
317static inline unsigned int order_objects(unsigned int order, unsigned int size) 323static inline unsigned int order_objects(unsigned int order, unsigned int size)
@@ -507,6 +513,7 @@ static inline int check_valid_pointer(struct kmem_cache *s,
507 return 1; 513 return 1;
508 514
509 base = page_address(page); 515 base = page_address(page);
516 object = kasan_reset_tag(object);
510 object = restore_red_left(s, object); 517 object = restore_red_left(s, object);
511 if (object < base || object >= base + page->objects * s->size || 518 if (object < base || object >= base + page->objects * s->size ||
512 (object - base) % s->size) { 519 (object - base) % s->size) {
@@ -1075,6 +1082,16 @@ static void setup_object_debug(struct kmem_cache *s, struct page *page,
1075 init_tracking(s, object); 1082 init_tracking(s, object);
1076} 1083}
1077 1084
1085static void setup_page_debug(struct kmem_cache *s, void *addr, int order)
1086{
1087 if (!(s->flags & SLAB_POISON))
1088 return;
1089
1090 metadata_access_enable();
1091 memset(addr, POISON_INUSE, PAGE_SIZE << order);
1092 metadata_access_disable();
1093}
1094
1078static inline int alloc_consistency_checks(struct kmem_cache *s, 1095static inline int alloc_consistency_checks(struct kmem_cache *s,
1079 struct page *page, 1096 struct page *page,
1080 void *object, unsigned long addr) 1097 void *object, unsigned long addr)
@@ -1330,6 +1347,8 @@ slab_flags_t kmem_cache_flags(unsigned int object_size,
1330#else /* !CONFIG_SLUB_DEBUG */ 1347#else /* !CONFIG_SLUB_DEBUG */
1331static inline void setup_object_debug(struct kmem_cache *s, 1348static inline void setup_object_debug(struct kmem_cache *s,
1332 struct page *page, void *object) {} 1349 struct page *page, void *object) {}
1350static inline void setup_page_debug(struct kmem_cache *s,
1351 void *addr, int order) {}
1333 1352
1334static inline int alloc_debug_processing(struct kmem_cache *s, 1353static inline int alloc_debug_processing(struct kmem_cache *s,
1335 struct page *page, void *object, unsigned long addr) { return 0; } 1354 struct page *page, void *object, unsigned long addr) { return 0; }
@@ -1374,8 +1393,10 @@ static inline void dec_slabs_node(struct kmem_cache *s, int node,
1374 */ 1393 */
1375static inline void *kmalloc_large_node_hook(void *ptr, size_t size, gfp_t flags) 1394static inline void *kmalloc_large_node_hook(void *ptr, size_t size, gfp_t flags)
1376{ 1395{
1396 ptr = kasan_kmalloc_large(ptr, size, flags);
1397 /* As ptr might get tagged, call kmemleak hook after KASAN. */
1377 kmemleak_alloc(ptr, size, 1, flags); 1398 kmemleak_alloc(ptr, size, 1, flags);
1378 return kasan_kmalloc_large(ptr, size, flags); 1399 return ptr;
1379} 1400}
1380 1401
1381static __always_inline void kfree_hook(void *x) 1402static __always_inline void kfree_hook(void *x)
@@ -1641,27 +1662,25 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
1641 if (page_is_pfmemalloc(page)) 1662 if (page_is_pfmemalloc(page))
1642 SetPageSlabPfmemalloc(page); 1663 SetPageSlabPfmemalloc(page);
1643 1664
1665 kasan_poison_slab(page);
1666
1644 start = page_address(page); 1667 start = page_address(page);
1645 1668
1646 if (unlikely(s->flags & SLAB_POISON)) 1669 setup_page_debug(s, start, order);
1647 memset(start, POISON_INUSE, PAGE_SIZE << order);
1648
1649 kasan_poison_slab(page);
1650 1670
1651 shuffle = shuffle_freelist(s, page); 1671 shuffle = shuffle_freelist(s, page);
1652 1672
1653 if (!shuffle) { 1673 if (!shuffle) {
1654 for_each_object_idx(p, idx, s, start, page->objects) {
1655 if (likely(idx < page->objects)) {
1656 next = p + s->size;
1657 next = setup_object(s, page, next);
1658 set_freepointer(s, p, next);
1659 } else
1660 set_freepointer(s, p, NULL);
1661 }
1662 start = fixup_red_left(s, start); 1674 start = fixup_red_left(s, start);
1663 start = setup_object(s, page, start); 1675 start = setup_object(s, page, start);
1664 page->freelist = start; 1676 page->freelist = start;
1677 for (idx = 0, p = start; idx < page->objects - 1; idx++) {
1678 next = p + s->size;
1679 next = setup_object(s, page, next);
1680 set_freepointer(s, p, next);
1681 p = next;
1682 }
1683 set_freepointer(s, p, NULL);
1665 } 1684 }
1666 1685
1667 page->inuse = page->objects; 1686 page->inuse = page->objects;
diff --git a/mm/swap.c b/mm/swap.c
index 4929bc1be60e..4d7d37eb3c40 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -320,11 +320,6 @@ static inline void activate_page_drain(int cpu)
320{ 320{
321} 321}
322 322
323static bool need_activate_page_drain(int cpu)
324{
325 return false;
326}
327
328void activate_page(struct page *page) 323void activate_page(struct page *page)
329{ 324{
330 struct zone *zone = page_zone(page); 325 struct zone *zone = page_zone(page);
@@ -653,13 +648,15 @@ void lru_add_drain(void)
653 put_cpu(); 648 put_cpu();
654} 649}
655 650
651#ifdef CONFIG_SMP
652
653static DEFINE_PER_CPU(struct work_struct, lru_add_drain_work);
654
656static void lru_add_drain_per_cpu(struct work_struct *dummy) 655static void lru_add_drain_per_cpu(struct work_struct *dummy)
657{ 656{
658 lru_add_drain(); 657 lru_add_drain();
659} 658}
660 659
661static DEFINE_PER_CPU(struct work_struct, lru_add_drain_work);
662
663/* 660/*
664 * Doesn't need any cpu hotplug locking because we do rely on per-cpu 661 * Doesn't need any cpu hotplug locking because we do rely on per-cpu
665 * kworkers being shut down before our page_alloc_cpu_dead callback is 662 * kworkers being shut down before our page_alloc_cpu_dead callback is
@@ -702,6 +699,12 @@ void lru_add_drain_all(void)
702 699
703 mutex_unlock(&lock); 700 mutex_unlock(&lock);
704} 701}
702#else
703void lru_add_drain_all(void)
704{
705 lru_add_drain();
706}
707#endif
705 708
706/** 709/**
707 * release_pages - batched put_page() 710 * release_pages - batched put_page()
diff --git a/mm/util.c b/mm/util.c
index 1ea055138043..379319b1bcfd 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -150,7 +150,7 @@ void *memdup_user(const void __user *src, size_t len)
150{ 150{
151 void *p; 151 void *p;
152 152
153 p = kmalloc_track_caller(len, GFP_USER); 153 p = kmalloc_track_caller(len, GFP_USER | __GFP_NOWARN);
154 if (!p) 154 if (!p)
155 return ERR_PTR(-ENOMEM); 155 return ERR_PTR(-ENOMEM);
156 156
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 3661cdd927f1..7e71b0df1fbc 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -2058,6 +2058,8 @@ static int process_connect(struct ceph_connection *con)
2058 dout("process_connect on %p tag %d\n", con, (int)con->in_tag); 2058 dout("process_connect on %p tag %d\n", con, (int)con->in_tag);
2059 2059
2060 if (con->auth) { 2060 if (con->auth) {
2061 int len = le32_to_cpu(con->in_reply.authorizer_len);
2062
2061 /* 2063 /*
2062 * Any connection that defines ->get_authorizer() 2064 * Any connection that defines ->get_authorizer()
2063 * should also define ->add_authorizer_challenge() and 2065 * should also define ->add_authorizer_challenge() and
@@ -2067,8 +2069,7 @@ static int process_connect(struct ceph_connection *con)
2067 */ 2069 */
2068 if (con->in_reply.tag == CEPH_MSGR_TAG_CHALLENGE_AUTHORIZER) { 2070 if (con->in_reply.tag == CEPH_MSGR_TAG_CHALLENGE_AUTHORIZER) {
2069 ret = con->ops->add_authorizer_challenge( 2071 ret = con->ops->add_authorizer_challenge(
2070 con, con->auth->authorizer_reply_buf, 2072 con, con->auth->authorizer_reply_buf, len);
2071 le32_to_cpu(con->in_reply.authorizer_len));
2072 if (ret < 0) 2073 if (ret < 0)
2073 return ret; 2074 return ret;
2074 2075
@@ -2078,10 +2079,12 @@ static int process_connect(struct ceph_connection *con)
2078 return 0; 2079 return 0;
2079 } 2080 }
2080 2081
2081 ret = con->ops->verify_authorizer_reply(con); 2082 if (len) {
2082 if (ret < 0) { 2083 ret = con->ops->verify_authorizer_reply(con);
2083 con->error_msg = "bad authorize reply"; 2084 if (ret < 0) {
2084 return ret; 2085 con->error_msg = "bad authorize reply";
2086 return ret;
2087 }
2085 } 2088 }
2086 } 2089 }
2087 2090
diff --git a/net/core/dev.c b/net/core/dev.c
index 8e276e0192a1..5d03889502eb 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -8152,7 +8152,7 @@ static netdev_features_t netdev_sync_upper_features(struct net_device *lower,
8152 netdev_features_t feature; 8152 netdev_features_t feature;
8153 int feature_bit; 8153 int feature_bit;
8154 8154
8155 for_each_netdev_feature(&upper_disables, feature_bit) { 8155 for_each_netdev_feature(upper_disables, feature_bit) {
8156 feature = __NETIF_F_BIT(feature_bit); 8156 feature = __NETIF_F_BIT(feature_bit);
8157 if (!(upper->wanted_features & feature) 8157 if (!(upper->wanted_features & feature)
8158 && (features & feature)) { 8158 && (features & feature)) {
@@ -8172,7 +8172,7 @@ static void netdev_sync_lower_features(struct net_device *upper,
8172 netdev_features_t feature; 8172 netdev_features_t feature;
8173 int feature_bit; 8173 int feature_bit;
8174 8174
8175 for_each_netdev_feature(&upper_disables, feature_bit) { 8175 for_each_netdev_feature(upper_disables, feature_bit) {
8176 feature = __NETIF_F_BIT(feature_bit); 8176 feature = __NETIF_F_BIT(feature_bit);
8177 if (!(features & feature) && (lower->features & feature)) { 8177 if (!(features & feature) && (lower->features & feature)) {
8178 netdev_dbg(upper, "Disabling feature %pNF on lower dev %s.\n", 8178 netdev_dbg(upper, "Disabling feature %pNF on lower dev %s.\n",
diff --git a/net/core/filter.c b/net/core/filter.c
index 7a54dc11ac2d..f7d0004fc160 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -2789,8 +2789,7 @@ static int bpf_skb_proto_4_to_6(struct sk_buff *skb)
2789 u32 off = skb_mac_header_len(skb); 2789 u32 off = skb_mac_header_len(skb);
2790 int ret; 2790 int ret;
2791 2791
2792 /* SCTP uses GSO_BY_FRAGS, thus cannot adjust it. */ 2792 if (!skb_is_gso_tcp(skb))
2793 if (skb_is_gso(skb) && unlikely(skb_is_gso_sctp(skb)))
2794 return -ENOTSUPP; 2793 return -ENOTSUPP;
2795 2794
2796 ret = skb_cow(skb, len_diff); 2795 ret = skb_cow(skb, len_diff);
@@ -2831,8 +2830,7 @@ static int bpf_skb_proto_6_to_4(struct sk_buff *skb)
2831 u32 off = skb_mac_header_len(skb); 2830 u32 off = skb_mac_header_len(skb);
2832 int ret; 2831 int ret;
2833 2832
2834 /* SCTP uses GSO_BY_FRAGS, thus cannot adjust it. */ 2833 if (!skb_is_gso_tcp(skb))
2835 if (skb_is_gso(skb) && unlikely(skb_is_gso_sctp(skb)))
2836 return -ENOTSUPP; 2834 return -ENOTSUPP;
2837 2835
2838 ret = skb_unclone(skb, GFP_ATOMIC); 2836 ret = skb_unclone(skb, GFP_ATOMIC);
@@ -2957,8 +2955,7 @@ static int bpf_skb_net_grow(struct sk_buff *skb, u32 len_diff)
2957 u32 off = skb_mac_header_len(skb) + bpf_skb_net_base_len(skb); 2955 u32 off = skb_mac_header_len(skb) + bpf_skb_net_base_len(skb);
2958 int ret; 2956 int ret;
2959 2957
2960 /* SCTP uses GSO_BY_FRAGS, thus cannot adjust it. */ 2958 if (!skb_is_gso_tcp(skb))
2961 if (skb_is_gso(skb) && unlikely(skb_is_gso_sctp(skb)))
2962 return -ENOTSUPP; 2959 return -ENOTSUPP;
2963 2960
2964 ret = skb_cow(skb, len_diff); 2961 ret = skb_cow(skb, len_diff);
@@ -2987,8 +2984,7 @@ static int bpf_skb_net_shrink(struct sk_buff *skb, u32 len_diff)
2987 u32 off = skb_mac_header_len(skb) + bpf_skb_net_base_len(skb); 2984 u32 off = skb_mac_header_len(skb) + bpf_skb_net_base_len(skb);
2988 int ret; 2985 int ret;
2989 2986
2990 /* SCTP uses GSO_BY_FRAGS, thus cannot adjust it. */ 2987 if (!skb_is_gso_tcp(skb))
2991 if (skb_is_gso(skb) && unlikely(skb_is_gso_sctp(skb)))
2992 return -ENOTSUPP; 2988 return -ENOTSUPP;
2993 2989
2994 ret = skb_unclone(skb, GFP_ATOMIC); 2990 ret = skb_unclone(skb, GFP_ATOMIC);
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 26d848484912..2415d9cb9b89 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -356,6 +356,8 @@ static void *__netdev_alloc_frag(unsigned int fragsz, gfp_t gfp_mask)
356 */ 356 */
357void *netdev_alloc_frag(unsigned int fragsz) 357void *netdev_alloc_frag(unsigned int fragsz)
358{ 358{
359 fragsz = SKB_DATA_ALIGN(fragsz);
360
359 return __netdev_alloc_frag(fragsz, GFP_ATOMIC); 361 return __netdev_alloc_frag(fragsz, GFP_ATOMIC);
360} 362}
361EXPORT_SYMBOL(netdev_alloc_frag); 363EXPORT_SYMBOL(netdev_alloc_frag);
@@ -369,6 +371,8 @@ static void *__napi_alloc_frag(unsigned int fragsz, gfp_t gfp_mask)
369 371
370void *napi_alloc_frag(unsigned int fragsz) 372void *napi_alloc_frag(unsigned int fragsz)
371{ 373{
374 fragsz = SKB_DATA_ALIGN(fragsz);
375
372 return __napi_alloc_frag(fragsz, GFP_ATOMIC); 376 return __napi_alloc_frag(fragsz, GFP_ATOMIC);
373} 377}
374EXPORT_SYMBOL(napi_alloc_frag); 378EXPORT_SYMBOL(napi_alloc_frag);
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 2079145a3b7c..cf3c5095c10e 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2528,6 +2528,7 @@ void tcp_write_queue_purge(struct sock *sk)
2528 sk_mem_reclaim(sk); 2528 sk_mem_reclaim(sk);
2529 tcp_clear_all_retrans_hints(tcp_sk(sk)); 2529 tcp_clear_all_retrans_hints(tcp_sk(sk));
2530 tcp_sk(sk)->packets_out = 0; 2530 tcp_sk(sk)->packets_out = 0;
2531 inet_csk(sk)->icsk_backoff = 0;
2531} 2532}
2532 2533
2533int tcp_disconnect(struct sock *sk, int flags) 2534int tcp_disconnect(struct sock *sk, int flags)
@@ -2576,7 +2577,6 @@ int tcp_disconnect(struct sock *sk, int flags)
2576 tp->write_seq += tp->max_window + 2; 2577 tp->write_seq += tp->max_window + 2;
2577 if (tp->write_seq == 0) 2578 if (tp->write_seq == 0)
2578 tp->write_seq = 1; 2579 tp->write_seq = 1;
2579 icsk->icsk_backoff = 0;
2580 tp->snd_cwnd = 2; 2580 tp->snd_cwnd = 2;
2581 icsk->icsk_probes_out = 0; 2581 icsk->icsk_probes_out = 0;
2582 tp->snd_ssthresh = TCP_INFINITE_SSTHRESH; 2582 tp->snd_ssthresh = TCP_INFINITE_SSTHRESH;
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index efc6fef692ff..ec3cea9d6828 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -536,12 +536,15 @@ int tcp_v4_err(struct sk_buff *icmp_skb, u32 info)
536 if (sock_owned_by_user(sk)) 536 if (sock_owned_by_user(sk))
537 break; 537 break;
538 538
539 skb = tcp_rtx_queue_head(sk);
540 if (WARN_ON_ONCE(!skb))
541 break;
542
539 icsk->icsk_backoff--; 543 icsk->icsk_backoff--;
540 icsk->icsk_rto = tp->srtt_us ? __tcp_set_rto(tp) : 544 icsk->icsk_rto = tp->srtt_us ? __tcp_set_rto(tp) :
541 TCP_TIMEOUT_INIT; 545 TCP_TIMEOUT_INIT;
542 icsk->icsk_rto = inet_csk_rto_backoff(icsk, TCP_RTO_MAX); 546 icsk->icsk_rto = inet_csk_rto_backoff(icsk, TCP_RTO_MAX);
543 547
544 skb = tcp_rtx_queue_head(sk);
545 548
546 tcp_mstamp_refresh(tp); 549 tcp_mstamp_refresh(tp);
547 delta_us = (u32)(tp->tcp_mstamp - tcp_skb_timestamp_us(skb)); 550 delta_us = (u32)(tp->tcp_mstamp - tcp_skb_timestamp_us(skb));
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 801a9a0c217e..43890898b0b5 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -1719,6 +1719,24 @@ static int ip6erspan_tap_validate(struct nlattr *tb[], struct nlattr *data[],
1719 return 0; 1719 return 0;
1720} 1720}
1721 1721
1722static void ip6erspan_set_version(struct nlattr *data[],
1723 struct __ip6_tnl_parm *parms)
1724{
1725 parms->erspan_ver = 1;
1726 if (data[IFLA_GRE_ERSPAN_VER])
1727 parms->erspan_ver = nla_get_u8(data[IFLA_GRE_ERSPAN_VER]);
1728
1729 if (parms->erspan_ver == 1) {
1730 if (data[IFLA_GRE_ERSPAN_INDEX])
1731 parms->index = nla_get_u32(data[IFLA_GRE_ERSPAN_INDEX]);
1732 } else if (parms->erspan_ver == 2) {
1733 if (data[IFLA_GRE_ERSPAN_DIR])
1734 parms->dir = nla_get_u8(data[IFLA_GRE_ERSPAN_DIR]);
1735 if (data[IFLA_GRE_ERSPAN_HWID])
1736 parms->hwid = nla_get_u16(data[IFLA_GRE_ERSPAN_HWID]);
1737 }
1738}
1739
1722static void ip6gre_netlink_parms(struct nlattr *data[], 1740static void ip6gre_netlink_parms(struct nlattr *data[],
1723 struct __ip6_tnl_parm *parms) 1741 struct __ip6_tnl_parm *parms)
1724{ 1742{
@@ -1767,20 +1785,6 @@ static void ip6gre_netlink_parms(struct nlattr *data[],
1767 1785
1768 if (data[IFLA_GRE_COLLECT_METADATA]) 1786 if (data[IFLA_GRE_COLLECT_METADATA])
1769 parms->collect_md = true; 1787 parms->collect_md = true;
1770
1771 parms->erspan_ver = 1;
1772 if (data[IFLA_GRE_ERSPAN_VER])
1773 parms->erspan_ver = nla_get_u8(data[IFLA_GRE_ERSPAN_VER]);
1774
1775 if (parms->erspan_ver == 1) {
1776 if (data[IFLA_GRE_ERSPAN_INDEX])
1777 parms->index = nla_get_u32(data[IFLA_GRE_ERSPAN_INDEX]);
1778 } else if (parms->erspan_ver == 2) {
1779 if (data[IFLA_GRE_ERSPAN_DIR])
1780 parms->dir = nla_get_u8(data[IFLA_GRE_ERSPAN_DIR]);
1781 if (data[IFLA_GRE_ERSPAN_HWID])
1782 parms->hwid = nla_get_u16(data[IFLA_GRE_ERSPAN_HWID]);
1783 }
1784} 1788}
1785 1789
1786static int ip6gre_tap_init(struct net_device *dev) 1790static int ip6gre_tap_init(struct net_device *dev)
@@ -2203,6 +2207,7 @@ static int ip6erspan_newlink(struct net *src_net, struct net_device *dev,
2203 int err; 2207 int err;
2204 2208
2205 ip6gre_netlink_parms(data, &nt->parms); 2209 ip6gre_netlink_parms(data, &nt->parms);
2210 ip6erspan_set_version(data, &nt->parms);
2206 ign = net_generic(net, ip6gre_net_id); 2211 ign = net_generic(net, ip6gre_net_id);
2207 2212
2208 if (nt->parms.collect_md) { 2213 if (nt->parms.collect_md) {
@@ -2248,6 +2253,7 @@ static int ip6erspan_changelink(struct net_device *dev, struct nlattr *tb[],
2248 if (IS_ERR(t)) 2253 if (IS_ERR(t))
2249 return PTR_ERR(t); 2254 return PTR_ERR(t);
2250 2255
2256 ip6erspan_set_version(data, &p);
2251 ip6gre_tunnel_unlink_md(ign, t); 2257 ip6gre_tunnel_unlink_md(ign, t);
2252 ip6gre_tunnel_unlink(ign, t); 2258 ip6gre_tunnel_unlink(ign, t);
2253 ip6erspan_tnl_change(t, &p, !tb[IFLA_MTU]); 2259 ip6erspan_tnl_change(t, &p, !tb[IFLA_MTU]);
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 2493c74c2d37..96496b2c1670 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -941,6 +941,7 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
941 BSS_CHANGED_P2P_PS | 941 BSS_CHANGED_P2P_PS |
942 BSS_CHANGED_TXPOWER; 942 BSS_CHANGED_TXPOWER;
943 int err; 943 int err;
944 int prev_beacon_int;
944 945
945 old = sdata_dereference(sdata->u.ap.beacon, sdata); 946 old = sdata_dereference(sdata->u.ap.beacon, sdata);
946 if (old) 947 if (old)
@@ -963,6 +964,7 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
963 964
964 sdata->needed_rx_chains = sdata->local->rx_chains; 965 sdata->needed_rx_chains = sdata->local->rx_chains;
965 966
967 prev_beacon_int = sdata->vif.bss_conf.beacon_int;
966 sdata->vif.bss_conf.beacon_int = params->beacon_interval; 968 sdata->vif.bss_conf.beacon_int = params->beacon_interval;
967 969
968 if (params->he_cap) 970 if (params->he_cap)
@@ -974,8 +976,10 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
974 if (!err) 976 if (!err)
975 ieee80211_vif_copy_chanctx_to_vlans(sdata, false); 977 ieee80211_vif_copy_chanctx_to_vlans(sdata, false);
976 mutex_unlock(&local->mtx); 978 mutex_unlock(&local->mtx);
977 if (err) 979 if (err) {
980 sdata->vif.bss_conf.beacon_int = prev_beacon_int;
978 return err; 981 return err;
982 }
979 983
980 /* 984 /*
981 * Apply control port protocol, this allows us to 985 * Apply control port protocol, this allows us to
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
index cad6592c52a1..2ec7011a4d07 100644
--- a/net/mac80211/mesh.h
+++ b/net/mac80211/mesh.h
@@ -70,6 +70,7 @@ enum mesh_deferred_task_flags {
70 * @dst: mesh path destination mac address 70 * @dst: mesh path destination mac address
71 * @mpp: mesh proxy mac address 71 * @mpp: mesh proxy mac address
72 * @rhash: rhashtable list pointer 72 * @rhash: rhashtable list pointer
73 * @walk_list: linked list containing all mesh_path objects.
73 * @gate_list: list pointer for known gates list 74 * @gate_list: list pointer for known gates list
74 * @sdata: mesh subif 75 * @sdata: mesh subif
75 * @next_hop: mesh neighbor to which frames for this destination will be 76 * @next_hop: mesh neighbor to which frames for this destination will be
@@ -105,6 +106,7 @@ struct mesh_path {
105 u8 dst[ETH_ALEN]; 106 u8 dst[ETH_ALEN];
106 u8 mpp[ETH_ALEN]; /* used for MPP or MAP */ 107 u8 mpp[ETH_ALEN]; /* used for MPP or MAP */
107 struct rhash_head rhash; 108 struct rhash_head rhash;
109 struct hlist_node walk_list;
108 struct hlist_node gate_list; 110 struct hlist_node gate_list;
109 struct ieee80211_sub_if_data *sdata; 111 struct ieee80211_sub_if_data *sdata;
110 struct sta_info __rcu *next_hop; 112 struct sta_info __rcu *next_hop;
@@ -133,12 +135,16 @@ struct mesh_path {
133 * gate's mpath may or may not be resolved and active. 135 * gate's mpath may or may not be resolved and active.
134 * @gates_lock: protects updates to known_gates 136 * @gates_lock: protects updates to known_gates
135 * @rhead: the rhashtable containing struct mesh_paths, keyed by dest addr 137 * @rhead: the rhashtable containing struct mesh_paths, keyed by dest addr
138 * @walk_head: linked list containging all mesh_path objects
139 * @walk_lock: lock protecting walk_head
136 * @entries: number of entries in the table 140 * @entries: number of entries in the table
137 */ 141 */
138struct mesh_table { 142struct mesh_table {
139 struct hlist_head known_gates; 143 struct hlist_head known_gates;
140 spinlock_t gates_lock; 144 spinlock_t gates_lock;
141 struct rhashtable rhead; 145 struct rhashtable rhead;
146 struct hlist_head walk_head;
147 spinlock_t walk_lock;
142 atomic_t entries; /* Up to MAX_MESH_NEIGHBOURS */ 148 atomic_t entries; /* Up to MAX_MESH_NEIGHBOURS */
143}; 149};
144 150
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
index a5125624a76d..88a6d5e18ccc 100644
--- a/net/mac80211/mesh_pathtbl.c
+++ b/net/mac80211/mesh_pathtbl.c
@@ -59,8 +59,10 @@ static struct mesh_table *mesh_table_alloc(void)
59 return NULL; 59 return NULL;
60 60
61 INIT_HLIST_HEAD(&newtbl->known_gates); 61 INIT_HLIST_HEAD(&newtbl->known_gates);
62 INIT_HLIST_HEAD(&newtbl->walk_head);
62 atomic_set(&newtbl->entries, 0); 63 atomic_set(&newtbl->entries, 0);
63 spin_lock_init(&newtbl->gates_lock); 64 spin_lock_init(&newtbl->gates_lock);
65 spin_lock_init(&newtbl->walk_lock);
64 66
65 return newtbl; 67 return newtbl;
66} 68}
@@ -249,28 +251,15 @@ mpp_path_lookup(struct ieee80211_sub_if_data *sdata, const u8 *dst)
249static struct mesh_path * 251static struct mesh_path *
250__mesh_path_lookup_by_idx(struct mesh_table *tbl, int idx) 252__mesh_path_lookup_by_idx(struct mesh_table *tbl, int idx)
251{ 253{
252 int i = 0, ret; 254 int i = 0;
253 struct mesh_path *mpath = NULL; 255 struct mesh_path *mpath;
254 struct rhashtable_iter iter;
255
256 ret = rhashtable_walk_init(&tbl->rhead, &iter, GFP_ATOMIC);
257 if (ret)
258 return NULL;
259
260 rhashtable_walk_start(&iter);
261 256
262 while ((mpath = rhashtable_walk_next(&iter))) { 257 hlist_for_each_entry_rcu(mpath, &tbl->walk_head, walk_list) {
263 if (IS_ERR(mpath) && PTR_ERR(mpath) == -EAGAIN)
264 continue;
265 if (IS_ERR(mpath))
266 break;
267 if (i++ == idx) 258 if (i++ == idx)
268 break; 259 break;
269 } 260 }
270 rhashtable_walk_stop(&iter);
271 rhashtable_walk_exit(&iter);
272 261
273 if (IS_ERR(mpath) || !mpath) 262 if (!mpath)
274 return NULL; 263 return NULL;
275 264
276 if (mpath_expired(mpath)) { 265 if (mpath_expired(mpath)) {
@@ -432,6 +421,7 @@ struct mesh_path *mesh_path_add(struct ieee80211_sub_if_data *sdata,
432 return ERR_PTR(-ENOMEM); 421 return ERR_PTR(-ENOMEM);
433 422
434 tbl = sdata->u.mesh.mesh_paths; 423 tbl = sdata->u.mesh.mesh_paths;
424 spin_lock_bh(&tbl->walk_lock);
435 do { 425 do {
436 ret = rhashtable_lookup_insert_fast(&tbl->rhead, 426 ret = rhashtable_lookup_insert_fast(&tbl->rhead,
437 &new_mpath->rhash, 427 &new_mpath->rhash,
@@ -441,20 +431,20 @@ struct mesh_path *mesh_path_add(struct ieee80211_sub_if_data *sdata,
441 mpath = rhashtable_lookup_fast(&tbl->rhead, 431 mpath = rhashtable_lookup_fast(&tbl->rhead,
442 dst, 432 dst,
443 mesh_rht_params); 433 mesh_rht_params);
444 434 else if (!ret)
435 hlist_add_head(&new_mpath->walk_list, &tbl->walk_head);
445 } while (unlikely(ret == -EEXIST && !mpath)); 436 } while (unlikely(ret == -EEXIST && !mpath));
437 spin_unlock_bh(&tbl->walk_lock);
446 438
447 if (ret && ret != -EEXIST) 439 if (ret) {
448 return ERR_PTR(ret);
449
450 /* At this point either new_mpath was added, or we found a
451 * matching entry already in the table; in the latter case
452 * free the unnecessary new entry.
453 */
454 if (ret == -EEXIST) {
455 kfree(new_mpath); 440 kfree(new_mpath);
441
442 if (ret != -EEXIST)
443 return ERR_PTR(ret);
444
456 new_mpath = mpath; 445 new_mpath = mpath;
457 } 446 }
447
458 sdata->u.mesh.mesh_paths_generation++; 448 sdata->u.mesh.mesh_paths_generation++;
459 return new_mpath; 449 return new_mpath;
460} 450}
@@ -480,9 +470,17 @@ int mpp_path_add(struct ieee80211_sub_if_data *sdata,
480 470
481 memcpy(new_mpath->mpp, mpp, ETH_ALEN); 471 memcpy(new_mpath->mpp, mpp, ETH_ALEN);
482 tbl = sdata->u.mesh.mpp_paths; 472 tbl = sdata->u.mesh.mpp_paths;
473
474 spin_lock_bh(&tbl->walk_lock);
483 ret = rhashtable_lookup_insert_fast(&tbl->rhead, 475 ret = rhashtable_lookup_insert_fast(&tbl->rhead,
484 &new_mpath->rhash, 476 &new_mpath->rhash,
485 mesh_rht_params); 477 mesh_rht_params);
478 if (!ret)
479 hlist_add_head_rcu(&new_mpath->walk_list, &tbl->walk_head);
480 spin_unlock_bh(&tbl->walk_lock);
481
482 if (ret)
483 kfree(new_mpath);
486 484
487 sdata->u.mesh.mpp_paths_generation++; 485 sdata->u.mesh.mpp_paths_generation++;
488 return ret; 486 return ret;
@@ -503,20 +501,9 @@ void mesh_plink_broken(struct sta_info *sta)
503 struct mesh_table *tbl = sdata->u.mesh.mesh_paths; 501 struct mesh_table *tbl = sdata->u.mesh.mesh_paths;
504 static const u8 bcast[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; 502 static const u8 bcast[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
505 struct mesh_path *mpath; 503 struct mesh_path *mpath;
506 struct rhashtable_iter iter;
507 int ret;
508
509 ret = rhashtable_walk_init(&tbl->rhead, &iter, GFP_ATOMIC);
510 if (ret)
511 return;
512 504
513 rhashtable_walk_start(&iter); 505 rcu_read_lock();
514 506 hlist_for_each_entry_rcu(mpath, &tbl->walk_head, walk_list) {
515 while ((mpath = rhashtable_walk_next(&iter))) {
516 if (IS_ERR(mpath) && PTR_ERR(mpath) == -EAGAIN)
517 continue;
518 if (IS_ERR(mpath))
519 break;
520 if (rcu_access_pointer(mpath->next_hop) == sta && 507 if (rcu_access_pointer(mpath->next_hop) == sta &&
521 mpath->flags & MESH_PATH_ACTIVE && 508 mpath->flags & MESH_PATH_ACTIVE &&
522 !(mpath->flags & MESH_PATH_FIXED)) { 509 !(mpath->flags & MESH_PATH_FIXED)) {
@@ -530,8 +517,7 @@ void mesh_plink_broken(struct sta_info *sta)
530 WLAN_REASON_MESH_PATH_DEST_UNREACHABLE, bcast); 517 WLAN_REASON_MESH_PATH_DEST_UNREACHABLE, bcast);
531 } 518 }
532 } 519 }
533 rhashtable_walk_stop(&iter); 520 rcu_read_unlock();
534 rhashtable_walk_exit(&iter);
535} 521}
536 522
537static void mesh_path_free_rcu(struct mesh_table *tbl, 523static void mesh_path_free_rcu(struct mesh_table *tbl,
@@ -551,6 +537,7 @@ static void mesh_path_free_rcu(struct mesh_table *tbl,
551 537
552static void __mesh_path_del(struct mesh_table *tbl, struct mesh_path *mpath) 538static void __mesh_path_del(struct mesh_table *tbl, struct mesh_path *mpath)
553{ 539{
540 hlist_del_rcu(&mpath->walk_list);
554 rhashtable_remove_fast(&tbl->rhead, &mpath->rhash, mesh_rht_params); 541 rhashtable_remove_fast(&tbl->rhead, &mpath->rhash, mesh_rht_params);
555 mesh_path_free_rcu(tbl, mpath); 542 mesh_path_free_rcu(tbl, mpath);
556} 543}
@@ -571,27 +558,14 @@ void mesh_path_flush_by_nexthop(struct sta_info *sta)
571 struct ieee80211_sub_if_data *sdata = sta->sdata; 558 struct ieee80211_sub_if_data *sdata = sta->sdata;
572 struct mesh_table *tbl = sdata->u.mesh.mesh_paths; 559 struct mesh_table *tbl = sdata->u.mesh.mesh_paths;
573 struct mesh_path *mpath; 560 struct mesh_path *mpath;
574 struct rhashtable_iter iter; 561 struct hlist_node *n;
575 int ret;
576
577 ret = rhashtable_walk_init(&tbl->rhead, &iter, GFP_ATOMIC);
578 if (ret)
579 return;
580
581 rhashtable_walk_start(&iter);
582
583 while ((mpath = rhashtable_walk_next(&iter))) {
584 if (IS_ERR(mpath) && PTR_ERR(mpath) == -EAGAIN)
585 continue;
586 if (IS_ERR(mpath))
587 break;
588 562
563 spin_lock_bh(&tbl->walk_lock);
564 hlist_for_each_entry_safe(mpath, n, &tbl->walk_head, walk_list) {
589 if (rcu_access_pointer(mpath->next_hop) == sta) 565 if (rcu_access_pointer(mpath->next_hop) == sta)
590 __mesh_path_del(tbl, mpath); 566 __mesh_path_del(tbl, mpath);
591 } 567 }
592 568 spin_unlock_bh(&tbl->walk_lock);
593 rhashtable_walk_stop(&iter);
594 rhashtable_walk_exit(&iter);
595} 569}
596 570
597static void mpp_flush_by_proxy(struct ieee80211_sub_if_data *sdata, 571static void mpp_flush_by_proxy(struct ieee80211_sub_if_data *sdata,
@@ -599,51 +573,26 @@ static void mpp_flush_by_proxy(struct ieee80211_sub_if_data *sdata,
599{ 573{
600 struct mesh_table *tbl = sdata->u.mesh.mpp_paths; 574 struct mesh_table *tbl = sdata->u.mesh.mpp_paths;
601 struct mesh_path *mpath; 575 struct mesh_path *mpath;
602 struct rhashtable_iter iter; 576 struct hlist_node *n;
603 int ret;
604
605 ret = rhashtable_walk_init(&tbl->rhead, &iter, GFP_ATOMIC);
606 if (ret)
607 return;
608
609 rhashtable_walk_start(&iter);
610
611 while ((mpath = rhashtable_walk_next(&iter))) {
612 if (IS_ERR(mpath) && PTR_ERR(mpath) == -EAGAIN)
613 continue;
614 if (IS_ERR(mpath))
615 break;
616 577
578 spin_lock_bh(&tbl->walk_lock);
579 hlist_for_each_entry_safe(mpath, n, &tbl->walk_head, walk_list) {
617 if (ether_addr_equal(mpath->mpp, proxy)) 580 if (ether_addr_equal(mpath->mpp, proxy))
618 __mesh_path_del(tbl, mpath); 581 __mesh_path_del(tbl, mpath);
619 } 582 }
620 583 spin_unlock_bh(&tbl->walk_lock);
621 rhashtable_walk_stop(&iter);
622 rhashtable_walk_exit(&iter);
623} 584}
624 585
625static void table_flush_by_iface(struct mesh_table *tbl) 586static void table_flush_by_iface(struct mesh_table *tbl)
626{ 587{
627 struct mesh_path *mpath; 588 struct mesh_path *mpath;
628 struct rhashtable_iter iter; 589 struct hlist_node *n;
629 int ret;
630
631 ret = rhashtable_walk_init(&tbl->rhead, &iter, GFP_ATOMIC);
632 if (ret)
633 return;
634
635 rhashtable_walk_start(&iter);
636 590
637 while ((mpath = rhashtable_walk_next(&iter))) { 591 spin_lock_bh(&tbl->walk_lock);
638 if (IS_ERR(mpath) && PTR_ERR(mpath) == -EAGAIN) 592 hlist_for_each_entry_safe(mpath, n, &tbl->walk_head, walk_list) {
639 continue;
640 if (IS_ERR(mpath))
641 break;
642 __mesh_path_del(tbl, mpath); 593 __mesh_path_del(tbl, mpath);
643 } 594 }
644 595 spin_unlock_bh(&tbl->walk_lock);
645 rhashtable_walk_stop(&iter);
646 rhashtable_walk_exit(&iter);
647} 596}
648 597
649/** 598/**
@@ -675,15 +624,15 @@ static int table_path_del(struct mesh_table *tbl,
675{ 624{
676 struct mesh_path *mpath; 625 struct mesh_path *mpath;
677 626
678 rcu_read_lock(); 627 spin_lock_bh(&tbl->walk_lock);
679 mpath = rhashtable_lookup_fast(&tbl->rhead, addr, mesh_rht_params); 628 mpath = rhashtable_lookup_fast(&tbl->rhead, addr, mesh_rht_params);
680 if (!mpath) { 629 if (!mpath) {
681 rcu_read_unlock(); 630 spin_unlock_bh(&tbl->walk_lock);
682 return -ENXIO; 631 return -ENXIO;
683 } 632 }
684 633
685 __mesh_path_del(tbl, mpath); 634 __mesh_path_del(tbl, mpath);
686 rcu_read_unlock(); 635 spin_unlock_bh(&tbl->walk_lock);
687 return 0; 636 return 0;
688} 637}
689 638
@@ -854,28 +803,16 @@ void mesh_path_tbl_expire(struct ieee80211_sub_if_data *sdata,
854 struct mesh_table *tbl) 803 struct mesh_table *tbl)
855{ 804{
856 struct mesh_path *mpath; 805 struct mesh_path *mpath;
857 struct rhashtable_iter iter; 806 struct hlist_node *n;
858 int ret;
859 807
860 ret = rhashtable_walk_init(&tbl->rhead, &iter, GFP_KERNEL); 808 spin_lock_bh(&tbl->walk_lock);
861 if (ret) 809 hlist_for_each_entry_safe(mpath, n, &tbl->walk_head, walk_list) {
862 return;
863
864 rhashtable_walk_start(&iter);
865
866 while ((mpath = rhashtable_walk_next(&iter))) {
867 if (IS_ERR(mpath) && PTR_ERR(mpath) == -EAGAIN)
868 continue;
869 if (IS_ERR(mpath))
870 break;
871 if ((!(mpath->flags & MESH_PATH_RESOLVING)) && 810 if ((!(mpath->flags & MESH_PATH_RESOLVING)) &&
872 (!(mpath->flags & MESH_PATH_FIXED)) && 811 (!(mpath->flags & MESH_PATH_FIXED)) &&
873 time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE)) 812 time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE))
874 __mesh_path_del(tbl, mpath); 813 __mesh_path_del(tbl, mpath);
875 } 814 }
876 815 spin_unlock_bh(&tbl->walk_lock);
877 rhashtable_walk_stop(&iter);
878 rhashtable_walk_exit(&iter);
879} 816}
880 817
881void mesh_path_expire(struct ieee80211_sub_if_data *sdata) 818void mesh_path_expire(struct ieee80211_sub_if_data *sdata)
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 86afacb07e5f..ac8d848d7624 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -896,12 +896,13 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest,
896{ 896{
897 struct ip_vs_dest *dest; 897 struct ip_vs_dest *dest;
898 unsigned int atype, i; 898 unsigned int atype, i;
899 int ret = 0;
900 899
901 EnterFunction(2); 900 EnterFunction(2);
902 901
903#ifdef CONFIG_IP_VS_IPV6 902#ifdef CONFIG_IP_VS_IPV6
904 if (udest->af == AF_INET6) { 903 if (udest->af == AF_INET6) {
904 int ret;
905
905 atype = ipv6_addr_type(&udest->addr.in6); 906 atype = ipv6_addr_type(&udest->addr.in6);
906 if ((!(atype & IPV6_ADDR_UNICAST) || 907 if ((!(atype & IPV6_ADDR_UNICAST) ||
907 atype & IPV6_ADDR_LINKLOCAL) && 908 atype & IPV6_ADDR_LINKLOCAL) &&
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 5a92f23f179f..4893f248dfdc 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -313,6 +313,9 @@ static int nft_delrule_by_chain(struct nft_ctx *ctx)
313 int err; 313 int err;
314 314
315 list_for_each_entry(rule, &ctx->chain->rules, list) { 315 list_for_each_entry(rule, &ctx->chain->rules, list) {
316 if (!nft_is_active_next(ctx->net, rule))
317 continue;
318
316 err = nft_delrule(ctx, rule); 319 err = nft_delrule(ctx, rule);
317 if (err < 0) 320 if (err < 0)
318 return err; 321 return err;
diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c
index d4de871e7d4d..37e1fe180769 100644
--- a/net/xdp/xdp_umem.c
+++ b/net/xdp/xdp_umem.c
@@ -125,9 +125,10 @@ int xdp_umem_assign_dev(struct xdp_umem *umem, struct net_device *dev,
125 return 0; 125 return 0;
126 126
127err_unreg_umem: 127err_unreg_umem:
128 xdp_clear_umem_at_qid(dev, queue_id);
129 if (!force_zc) 128 if (!force_zc)
130 err = 0; /* fallback to copy mode */ 129 err = 0; /* fallback to copy mode */
130 if (err)
131 xdp_clear_umem_at_qid(dev, queue_id);
131out_rtnl_unlock: 132out_rtnl_unlock:
132 rtnl_unlock(); 133 rtnl_unlock();
133 return err; 134 return err;
@@ -259,10 +260,10 @@ static int xdp_umem_pin_pages(struct xdp_umem *umem)
259 if (!umem->pgs) 260 if (!umem->pgs)
260 return -ENOMEM; 261 return -ENOMEM;
261 262
262 down_write(&current->mm->mmap_sem); 263 down_read(&current->mm->mmap_sem);
263 npgs = get_user_pages(umem->address, umem->npgs, 264 npgs = get_user_pages_longterm(umem->address, umem->npgs,
264 gup_flags, &umem->pgs[0], NULL); 265 gup_flags, &umem->pgs[0], NULL);
265 up_write(&current->mm->mmap_sem); 266 up_read(&current->mm->mmap_sem);
266 267
267 if (npgs != umem->npgs) { 268 if (npgs != umem->npgs) {
268 if (npgs >= 0) { 269 if (npgs >= 0) {
diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
index a03268454a27..45f3b528dc09 100644
--- a/net/xdp/xsk.c
+++ b/net/xdp/xsk.c
@@ -669,6 +669,8 @@ static int xsk_mmap(struct file *file, struct socket *sock,
669 if (!umem) 669 if (!umem)
670 return -EINVAL; 670 return -EINVAL;
671 671
672 /* Matches the smp_wmb() in XDP_UMEM_REG */
673 smp_rmb();
672 if (offset == XDP_UMEM_PGOFF_FILL_RING) 674 if (offset == XDP_UMEM_PGOFF_FILL_RING)
673 q = READ_ONCE(umem->fq); 675 q = READ_ONCE(umem->fq);
674 else if (offset == XDP_UMEM_PGOFF_COMPLETION_RING) 676 else if (offset == XDP_UMEM_PGOFF_COMPLETION_RING)
@@ -678,6 +680,8 @@ static int xsk_mmap(struct file *file, struct socket *sock,
678 if (!q) 680 if (!q)
679 return -EINVAL; 681 return -EINVAL;
680 682
683 /* Matches the smp_wmb() in xsk_init_queue */
684 smp_rmb();
681 qpg = virt_to_head_page(q->ring); 685 qpg = virt_to_head_page(q->ring);
682 if (size > (PAGE_SIZE << compound_order(qpg))) 686 if (size > (PAGE_SIZE << compound_order(qpg)))
683 return -EINVAL; 687 return -EINVAL;
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index 77cebad0474e..f75e7bda4889 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -118,8 +118,8 @@ static int read_symbol(FILE *in, struct sym_entry *s)
118 fprintf(stderr, "Read error or end of file.\n"); 118 fprintf(stderr, "Read error or end of file.\n");
119 return -1; 119 return -1;
120 } 120 }
121 if (strlen(sym) > KSYM_NAME_LEN) { 121 if (strlen(sym) >= KSYM_NAME_LEN) {
122 fprintf(stderr, "Symbol %s too long for kallsyms (%zu vs %d).\n" 122 fprintf(stderr, "Symbol %s too long for kallsyms (%zu >= %d).\n"
123 "Please increase KSYM_NAME_LEN both in kernel and kallsyms.c\n", 123 "Please increase KSYM_NAME_LEN both in kernel and kallsyms.c\n",
124 sym, strlen(sym), KSYM_NAME_LEN); 124 sym, strlen(sym), KSYM_NAME_LEN);
125 return -1; 125 return -1;
diff --git a/security/keys/internal.h b/security/keys/internal.h
index 479909b858c7..8f533c81aa8d 100644
--- a/security/keys/internal.h
+++ b/security/keys/internal.h
@@ -186,20 +186,9 @@ static inline int key_permission(const key_ref_t key_ref, unsigned perm)
186 return key_task_permission(key_ref, current_cred(), perm); 186 return key_task_permission(key_ref, current_cred(), perm);
187} 187}
188 188
189/*
190 * Authorisation record for request_key().
191 */
192struct request_key_auth {
193 struct key *target_key;
194 struct key *dest_keyring;
195 const struct cred *cred;
196 void *callout_info;
197 size_t callout_len;
198 pid_t pid;
199} __randomize_layout;
200
201extern struct key_type key_type_request_key_auth; 189extern struct key_type key_type_request_key_auth;
202extern struct key *request_key_auth_new(struct key *target, 190extern struct key *request_key_auth_new(struct key *target,
191 const char *op,
203 const void *callout_info, 192 const void *callout_info,
204 size_t callout_len, 193 size_t callout_len,
205 struct key *dest_keyring); 194 struct key *dest_keyring);
diff --git a/security/keys/key.c b/security/keys/key.c
index 44a80d6741a1..696f1c092c50 100644
--- a/security/keys/key.c
+++ b/security/keys/key.c
@@ -265,8 +265,8 @@ struct key *key_alloc(struct key_type *type, const char *desc,
265 265
266 spin_lock(&user->lock); 266 spin_lock(&user->lock);
267 if (!(flags & KEY_ALLOC_QUOTA_OVERRUN)) { 267 if (!(flags & KEY_ALLOC_QUOTA_OVERRUN)) {
268 if (user->qnkeys + 1 >= maxkeys || 268 if (user->qnkeys + 1 > maxkeys ||
269 user->qnbytes + quotalen >= maxbytes || 269 user->qnbytes + quotalen > maxbytes ||
270 user->qnbytes + quotalen < user->qnbytes) 270 user->qnbytes + quotalen < user->qnbytes)
271 goto no_quota; 271 goto no_quota;
272 } 272 }
@@ -297,6 +297,7 @@ struct key *key_alloc(struct key_type *type, const char *desc,
297 key->gid = gid; 297 key->gid = gid;
298 key->perm = perm; 298 key->perm = perm;
299 key->restrict_link = restrict_link; 299 key->restrict_link = restrict_link;
300 key->last_used_at = ktime_get_real_seconds();
300 301
301 if (!(flags & KEY_ALLOC_NOT_IN_QUOTA)) 302 if (!(flags & KEY_ALLOC_NOT_IN_QUOTA))
302 key->flags |= 1 << KEY_FLAG_IN_QUOTA; 303 key->flags |= 1 << KEY_FLAG_IN_QUOTA;
diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index e8093d025966..7bbe03593e58 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -25,6 +25,7 @@
25#include <linux/security.h> 25#include <linux/security.h>
26#include <linux/uio.h> 26#include <linux/uio.h>
27#include <linux/uaccess.h> 27#include <linux/uaccess.h>
28#include <keys/request_key_auth-type.h>
28#include "internal.h" 29#include "internal.h"
29 30
30#define KEY_MAX_DESC_SIZE 4096 31#define KEY_MAX_DESC_SIZE 4096
diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
index 02c77e928f68..0e0b9ccad2f8 100644
--- a/security/keys/process_keys.c
+++ b/security/keys/process_keys.c
@@ -19,6 +19,7 @@
19#include <linux/security.h> 19#include <linux/security.h>
20#include <linux/user_namespace.h> 20#include <linux/user_namespace.h>
21#include <linux/uaccess.h> 21#include <linux/uaccess.h>
22#include <keys/request_key_auth-type.h>
22#include "internal.h" 23#include "internal.h"
23 24
24/* Session keyring create vs join semaphore */ 25/* Session keyring create vs join semaphore */
diff --git a/security/keys/request_key.c b/security/keys/request_key.c
index 301f0e300dbd..3f56a312dd35 100644
--- a/security/keys/request_key.c
+++ b/security/keys/request_key.c
@@ -18,31 +18,30 @@
18#include <linux/keyctl.h> 18#include <linux/keyctl.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include "internal.h" 20#include "internal.h"
21#include <keys/request_key_auth-type.h>
21 22
22#define key_negative_timeout 60 /* default timeout on a negative key's existence */ 23#define key_negative_timeout 60 /* default timeout on a negative key's existence */
23 24
24/** 25/**
25 * complete_request_key - Complete the construction of a key. 26 * complete_request_key - Complete the construction of a key.
26 * @cons: The key construction record. 27 * @auth_key: The authorisation key.
27 * @error: The success or failute of the construction. 28 * @error: The success or failute of the construction.
28 * 29 *
29 * Complete the attempt to construct a key. The key will be negated 30 * Complete the attempt to construct a key. The key will be negated
30 * if an error is indicated. The authorisation key will be revoked 31 * if an error is indicated. The authorisation key will be revoked
31 * unconditionally. 32 * unconditionally.
32 */ 33 */
33void complete_request_key(struct key_construction *cons, int error) 34void complete_request_key(struct key *authkey, int error)
34{ 35{
35 kenter("{%d,%d},%d", cons->key->serial, cons->authkey->serial, error); 36 struct request_key_auth *rka = get_request_key_auth(authkey);
37 struct key *key = rka->target_key;
38
39 kenter("%d{%d},%d", authkey->serial, key->serial, error);
36 40
37 if (error < 0) 41 if (error < 0)
38 key_negate_and_link(cons->key, key_negative_timeout, NULL, 42 key_negate_and_link(key, key_negative_timeout, NULL, authkey);
39 cons->authkey);
40 else 43 else
41 key_revoke(cons->authkey); 44 key_revoke(authkey);
42
43 key_put(cons->key);
44 key_put(cons->authkey);
45 kfree(cons);
46} 45}
47EXPORT_SYMBOL(complete_request_key); 46EXPORT_SYMBOL(complete_request_key);
48 47
@@ -91,21 +90,19 @@ static int call_usermodehelper_keys(const char *path, char **argv, char **envp,
91 * Request userspace finish the construction of a key 90 * Request userspace finish the construction of a key
92 * - execute "/sbin/request-key <op> <key> <uid> <gid> <keyring> <keyring> <keyring>" 91 * - execute "/sbin/request-key <op> <key> <uid> <gid> <keyring> <keyring> <keyring>"
93 */ 92 */
94static int call_sbin_request_key(struct key_construction *cons, 93static int call_sbin_request_key(struct key *authkey, void *aux)
95 const char *op,
96 void *aux)
97{ 94{
98 static char const request_key[] = "/sbin/request-key"; 95 static char const request_key[] = "/sbin/request-key";
96 struct request_key_auth *rka = get_request_key_auth(authkey);
99 const struct cred *cred = current_cred(); 97 const struct cred *cred = current_cred();
100 key_serial_t prkey, sskey; 98 key_serial_t prkey, sskey;
101 struct key *key = cons->key, *authkey = cons->authkey, *keyring, 99 struct key *key = rka->target_key, *keyring, *session;
102 *session;
103 char *argv[9], *envp[3], uid_str[12], gid_str[12]; 100 char *argv[9], *envp[3], uid_str[12], gid_str[12];
104 char key_str[12], keyring_str[3][12]; 101 char key_str[12], keyring_str[3][12];
105 char desc[20]; 102 char desc[20];
106 int ret, i; 103 int ret, i;
107 104
108 kenter("{%d},{%d},%s", key->serial, authkey->serial, op); 105 kenter("{%d},{%d},%s", key->serial, authkey->serial, rka->op);
109 106
110 ret = install_user_keyrings(); 107 ret = install_user_keyrings();
111 if (ret < 0) 108 if (ret < 0)
@@ -163,7 +160,7 @@ static int call_sbin_request_key(struct key_construction *cons,
163 /* set up the argument list */ 160 /* set up the argument list */
164 i = 0; 161 i = 0;
165 argv[i++] = (char *)request_key; 162 argv[i++] = (char *)request_key;
166 argv[i++] = (char *) op; 163 argv[i++] = (char *)rka->op;
167 argv[i++] = key_str; 164 argv[i++] = key_str;
168 argv[i++] = uid_str; 165 argv[i++] = uid_str;
169 argv[i++] = gid_str; 166 argv[i++] = gid_str;
@@ -191,7 +188,7 @@ error_link:
191 key_put(keyring); 188 key_put(keyring);
192 189
193error_alloc: 190error_alloc:
194 complete_request_key(cons, ret); 191 complete_request_key(authkey, ret);
195 kleave(" = %d", ret); 192 kleave(" = %d", ret);
196 return ret; 193 return ret;
197} 194}
@@ -205,42 +202,31 @@ static int construct_key(struct key *key, const void *callout_info,
205 size_t callout_len, void *aux, 202 size_t callout_len, void *aux,
206 struct key *dest_keyring) 203 struct key *dest_keyring)
207{ 204{
208 struct key_construction *cons;
209 request_key_actor_t actor; 205 request_key_actor_t actor;
210 struct key *authkey; 206 struct key *authkey;
211 int ret; 207 int ret;
212 208
213 kenter("%d,%p,%zu,%p", key->serial, callout_info, callout_len, aux); 209 kenter("%d,%p,%zu,%p", key->serial, callout_info, callout_len, aux);
214 210
215 cons = kmalloc(sizeof(*cons), GFP_KERNEL);
216 if (!cons)
217 return -ENOMEM;
218
219 /* allocate an authorisation key */ 211 /* allocate an authorisation key */
220 authkey = request_key_auth_new(key, callout_info, callout_len, 212 authkey = request_key_auth_new(key, "create", callout_info, callout_len,
221 dest_keyring); 213 dest_keyring);
222 if (IS_ERR(authkey)) { 214 if (IS_ERR(authkey))
223 kfree(cons); 215 return PTR_ERR(authkey);
224 ret = PTR_ERR(authkey);
225 authkey = NULL;
226 } else {
227 cons->authkey = key_get(authkey);
228 cons->key = key_get(key);
229 216
230 /* make the call */ 217 /* Make the call */
231 actor = call_sbin_request_key; 218 actor = call_sbin_request_key;
232 if (key->type->request_key) 219 if (key->type->request_key)
233 actor = key->type->request_key; 220 actor = key->type->request_key;
234 221
235 ret = actor(cons, "create", aux); 222 ret = actor(authkey, aux);
236 223
237 /* check that the actor called complete_request_key() prior to 224 /* check that the actor called complete_request_key() prior to
238 * returning an error */ 225 * returning an error */
239 WARN_ON(ret < 0 && 226 WARN_ON(ret < 0 &&
240 !test_bit(KEY_FLAG_REVOKED, &authkey->flags)); 227 !test_bit(KEY_FLAG_REVOKED, &authkey->flags));
241 key_put(authkey);
242 }
243 228
229 key_put(authkey);
244 kleave(" = %d", ret); 230 kleave(" = %d", ret);
245 return ret; 231 return ret;
246} 232}
@@ -275,7 +261,7 @@ static int construct_get_dest_keyring(struct key **_dest_keyring)
275 if (cred->request_key_auth) { 261 if (cred->request_key_auth) {
276 authkey = cred->request_key_auth; 262 authkey = cred->request_key_auth;
277 down_read(&authkey->sem); 263 down_read(&authkey->sem);
278 rka = authkey->payload.data[0]; 264 rka = get_request_key_auth(authkey);
279 if (!test_bit(KEY_FLAG_REVOKED, 265 if (!test_bit(KEY_FLAG_REVOKED,
280 &authkey->flags)) 266 &authkey->flags))
281 dest_keyring = 267 dest_keyring =
diff --git a/security/keys/request_key_auth.c b/security/keys/request_key_auth.c
index 87ea2f54dedc..afc304e8b61e 100644
--- a/security/keys/request_key_auth.c
+++ b/security/keys/request_key_auth.c
@@ -17,7 +17,7 @@
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/uaccess.h> 18#include <linux/uaccess.h>
19#include "internal.h" 19#include "internal.h"
20#include <keys/user-type.h> 20#include <keys/request_key_auth-type.h>
21 21
22static int request_key_auth_preparse(struct key_preparsed_payload *); 22static int request_key_auth_preparse(struct key_preparsed_payload *);
23static void request_key_auth_free_preparse(struct key_preparsed_payload *); 23static void request_key_auth_free_preparse(struct key_preparsed_payload *);
@@ -68,7 +68,7 @@ static int request_key_auth_instantiate(struct key *key,
68static void request_key_auth_describe(const struct key *key, 68static void request_key_auth_describe(const struct key *key,
69 struct seq_file *m) 69 struct seq_file *m)
70{ 70{
71 struct request_key_auth *rka = key->payload.data[0]; 71 struct request_key_auth *rka = get_request_key_auth(key);
72 72
73 seq_puts(m, "key:"); 73 seq_puts(m, "key:");
74 seq_puts(m, key->description); 74 seq_puts(m, key->description);
@@ -83,7 +83,7 @@ static void request_key_auth_describe(const struct key *key,
83static long request_key_auth_read(const struct key *key, 83static long request_key_auth_read(const struct key *key,
84 char __user *buffer, size_t buflen) 84 char __user *buffer, size_t buflen)
85{ 85{
86 struct request_key_auth *rka = key->payload.data[0]; 86 struct request_key_auth *rka = get_request_key_auth(key);
87 size_t datalen; 87 size_t datalen;
88 long ret; 88 long ret;
89 89
@@ -109,7 +109,7 @@ static long request_key_auth_read(const struct key *key,
109 */ 109 */
110static void request_key_auth_revoke(struct key *key) 110static void request_key_auth_revoke(struct key *key)
111{ 111{
112 struct request_key_auth *rka = key->payload.data[0]; 112 struct request_key_auth *rka = get_request_key_auth(key);
113 113
114 kenter("{%d}", key->serial); 114 kenter("{%d}", key->serial);
115 115
@@ -136,7 +136,7 @@ static void free_request_key_auth(struct request_key_auth *rka)
136 */ 136 */
137static void request_key_auth_destroy(struct key *key) 137static void request_key_auth_destroy(struct key *key)
138{ 138{
139 struct request_key_auth *rka = key->payload.data[0]; 139 struct request_key_auth *rka = get_request_key_auth(key);
140 140
141 kenter("{%d}", key->serial); 141 kenter("{%d}", key->serial);
142 142
@@ -147,8 +147,9 @@ static void request_key_auth_destroy(struct key *key)
147 * Create an authorisation token for /sbin/request-key or whoever to gain 147 * Create an authorisation token for /sbin/request-key or whoever to gain
148 * access to the caller's security data. 148 * access to the caller's security data.
149 */ 149 */
150struct key *request_key_auth_new(struct key *target, const void *callout_info, 150struct key *request_key_auth_new(struct key *target, const char *op,
151 size_t callout_len, struct key *dest_keyring) 151 const void *callout_info, size_t callout_len,
152 struct key *dest_keyring)
152{ 153{
153 struct request_key_auth *rka, *irka; 154 struct request_key_auth *rka, *irka;
154 const struct cred *cred = current->cred; 155 const struct cred *cred = current->cred;
@@ -166,6 +167,7 @@ struct key *request_key_auth_new(struct key *target, const void *callout_info,
166 if (!rka->callout_info) 167 if (!rka->callout_info)
167 goto error_free_rka; 168 goto error_free_rka;
168 rka->callout_len = callout_len; 169 rka->callout_len = callout_len;
170 strlcpy(rka->op, op, sizeof(rka->op));
169 171
170 /* see if the calling process is already servicing the key request of 172 /* see if the calling process is already servicing the key request of
171 * another process */ 173 * another process */
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 6df758adff84..1ffa36e987b4 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1855,6 +1855,8 @@ enum {
1855 ALC887_FIXUP_BASS_CHMAP, 1855 ALC887_FIXUP_BASS_CHMAP,
1856 ALC1220_FIXUP_GB_DUAL_CODECS, 1856 ALC1220_FIXUP_GB_DUAL_CODECS,
1857 ALC1220_FIXUP_CLEVO_P950, 1857 ALC1220_FIXUP_CLEVO_P950,
1858 ALC1220_FIXUP_SYSTEM76_ORYP5,
1859 ALC1220_FIXUP_SYSTEM76_ORYP5_PINS,
1858}; 1860};
1859 1861
1860static void alc889_fixup_coef(struct hda_codec *codec, 1862static void alc889_fixup_coef(struct hda_codec *codec,
@@ -2056,6 +2058,17 @@ static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2056 snd_hda_override_conn_list(codec, 0x1b, 1, conn1); 2058 snd_hda_override_conn_list(codec, 0x1b, 1, conn1);
2057} 2059}
2058 2060
2061static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2062 const struct hda_fixup *fix, int action);
2063
2064static void alc1220_fixup_system76_oryp5(struct hda_codec *codec,
2065 const struct hda_fixup *fix,
2066 int action)
2067{
2068 alc1220_fixup_clevo_p950(codec, fix, action);
2069 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2070}
2071
2059static const struct hda_fixup alc882_fixups[] = { 2072static const struct hda_fixup alc882_fixups[] = {
2060 [ALC882_FIXUP_ABIT_AW9D_MAX] = { 2073 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
2061 .type = HDA_FIXUP_PINS, 2074 .type = HDA_FIXUP_PINS,
@@ -2300,6 +2313,19 @@ static const struct hda_fixup alc882_fixups[] = {
2300 .type = HDA_FIXUP_FUNC, 2313 .type = HDA_FIXUP_FUNC,
2301 .v.func = alc1220_fixup_clevo_p950, 2314 .v.func = alc1220_fixup_clevo_p950,
2302 }, 2315 },
2316 [ALC1220_FIXUP_SYSTEM76_ORYP5] = {
2317 .type = HDA_FIXUP_FUNC,
2318 .v.func = alc1220_fixup_system76_oryp5,
2319 },
2320 [ALC1220_FIXUP_SYSTEM76_ORYP5_PINS] = {
2321 .type = HDA_FIXUP_PINS,
2322 .v.pins = (const struct hda_pintbl[]) {
2323 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2324 {}
2325 },
2326 .chained = true,
2327 .chain_id = ALC1220_FIXUP_SYSTEM76_ORYP5,
2328 },
2303}; 2329};
2304 2330
2305static const struct snd_pci_quirk alc882_fixup_tbl[] = { 2331static const struct snd_pci_quirk alc882_fixup_tbl[] = {
@@ -2376,6 +2402,8 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2376 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950), 2402 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2377 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950), 2403 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2378 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950), 2404 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2405 SND_PCI_QUIRK(0x1558, 0x96e1, "System76 Oryx Pro (oryp5)", ALC1220_FIXUP_SYSTEM76_ORYP5_PINS),
2406 SND_PCI_QUIRK(0x1558, 0x97e1, "System76 Oryx Pro (oryp5)", ALC1220_FIXUP_SYSTEM76_ORYP5_PINS),
2379 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD), 2407 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2380 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD), 2408 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
2381 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530), 2409 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
@@ -5632,6 +5660,7 @@ enum {
5632 ALC294_FIXUP_ASUS_SPK, 5660 ALC294_FIXUP_ASUS_SPK,
5633 ALC225_FIXUP_HEADSET_JACK, 5661 ALC225_FIXUP_HEADSET_JACK,
5634 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE, 5662 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
5663 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
5635}; 5664};
5636 5665
5637static const struct hda_fixup alc269_fixups[] = { 5666static const struct hda_fixup alc269_fixups[] = {
@@ -6587,6 +6616,17 @@ static const struct hda_fixup alc269_fixups[] = {
6587 .chained = true, 6616 .chained = true,
6588 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC 6617 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6589 }, 6618 },
6619 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
6620 .type = HDA_FIXUP_VERBS,
6621 .v.verbs = (const struct hda_verb[]) {
6622 /* Disable PCBEEP-IN passthrough */
6623 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
6624 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
6625 { }
6626 },
6627 .chained = true,
6628 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
6629 },
6590}; 6630};
6591 6631
6592static const struct snd_pci_quirk alc269_fixup_tbl[] = { 6632static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -7272,7 +7312,7 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
7272 {0x12, 0x90a60130}, 7312 {0x12, 0x90a60130},
7273 {0x19, 0x03a11020}, 7313 {0x19, 0x03a11020},
7274 {0x21, 0x0321101f}), 7314 {0x21, 0x0321101f}),
7275 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_HEADPHONE_NOISE, 7315 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
7276 {0x12, 0x90a60130}, 7316 {0x12, 0x90a60130},
7277 {0x14, 0x90170110}, 7317 {0x14, 0x90170110},
7278 {0x19, 0x04a11040}, 7318 {0x19, 0x04a11040},
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 37e001cf9cd1..3fe34417ec89 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -462,7 +462,7 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv)
462 conf_idx = 0; 462 conf_idx = 0;
463 node = of_get_child_by_name(top, PREFIX "dai-link"); 463 node = of_get_child_by_name(top, PREFIX "dai-link");
464 if (!node) { 464 if (!node) {
465 node = dev->of_node; 465 node = of_node_get(top);
466 loop = 0; 466 loop = 0;
467 } 467 }
468 468
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index ce00fe2f6aae..d4bde4834ce5 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -604,6 +604,7 @@ static int i2s_set_fmt(struct snd_soc_dai *dai,
604 unsigned int fmt) 604 unsigned int fmt)
605{ 605{
606 struct i2s_dai *i2s = to_info(dai); 606 struct i2s_dai *i2s = to_info(dai);
607 struct i2s_dai *other = get_other_dai(i2s);
607 int lrp_shift, sdf_shift, sdf_mask, lrp_rlow, mod_slave; 608 int lrp_shift, sdf_shift, sdf_mask, lrp_rlow, mod_slave;
608 u32 mod, tmp = 0; 609 u32 mod, tmp = 0;
609 unsigned long flags; 610 unsigned long flags;
@@ -661,7 +662,8 @@ static int i2s_set_fmt(struct snd_soc_dai *dai,
661 * CLK_I2S_RCLK_SRC clock is not exposed so we ensure any 662 * CLK_I2S_RCLK_SRC clock is not exposed so we ensure any
662 * clock configuration assigned in DT is not overwritten. 663 * clock configuration assigned in DT is not overwritten.
663 */ 664 */
664 if (i2s->rclk_srcrate == 0 && i2s->clk_data.clks == NULL) 665 if (i2s->rclk_srcrate == 0 && i2s->clk_data.clks == NULL &&
666 other->clk_data.clks == NULL)
665 i2s_set_sysclk(dai, SAMSUNG_I2S_RCLKSRC_0, 667 i2s_set_sysclk(dai, SAMSUNG_I2S_RCLKSRC_0,
666 0, SND_SOC_CLOCK_IN); 668 0, SND_SOC_CLOCK_IN);
667 break; 669 break;
@@ -699,6 +701,7 @@ static int i2s_hw_params(struct snd_pcm_substream *substream,
699 struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) 701 struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
700{ 702{
701 struct i2s_dai *i2s = to_info(dai); 703 struct i2s_dai *i2s = to_info(dai);
704 struct i2s_dai *other = get_other_dai(i2s);
702 u32 mod, mask = 0, val = 0; 705 u32 mod, mask = 0, val = 0;
703 struct clk *rclksrc; 706 struct clk *rclksrc;
704 unsigned long flags; 707 unsigned long flags;
@@ -784,6 +787,9 @@ static int i2s_hw_params(struct snd_pcm_substream *substream,
784 i2s->frmclk = params_rate(params); 787 i2s->frmclk = params_rate(params);
785 788
786 rclksrc = i2s->clk_table[CLK_I2S_RCLK_SRC]; 789 rclksrc = i2s->clk_table[CLK_I2S_RCLK_SRC];
790 if (!rclksrc || IS_ERR(rclksrc))
791 rclksrc = other->clk_table[CLK_I2S_RCLK_SRC];
792
787 if (rclksrc && !IS_ERR(rclksrc)) 793 if (rclksrc && !IS_ERR(rclksrc))
788 i2s->rclk_srcrate = clk_get_rate(rclksrc); 794 i2s->rclk_srcrate = clk_get_rate(rclksrc);
789 795
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index fc79ec6927e3..731b963b6995 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -2487,6 +2487,7 @@ int snd_soc_tplg_component_load(struct snd_soc_component *comp,
2487 struct snd_soc_tplg_ops *ops, const struct firmware *fw, u32 id) 2487 struct snd_soc_tplg_ops *ops, const struct firmware *fw, u32 id)
2488{ 2488{
2489 struct soc_tplg tplg; 2489 struct soc_tplg tplg;
2490 int ret;
2490 2491
2491 /* setup parsing context */ 2492 /* setup parsing context */
2492 memset(&tplg, 0, sizeof(tplg)); 2493 memset(&tplg, 0, sizeof(tplg));
@@ -2500,7 +2501,12 @@ int snd_soc_tplg_component_load(struct snd_soc_component *comp,
2500 tplg.bytes_ext_ops = ops->bytes_ext_ops; 2501 tplg.bytes_ext_ops = ops->bytes_ext_ops;
2501 tplg.bytes_ext_ops_count = ops->bytes_ext_ops_count; 2502 tplg.bytes_ext_ops_count = ops->bytes_ext_ops_count;
2502 2503
2503 return soc_tplg_load(&tplg); 2504 ret = soc_tplg_load(&tplg);
2505 /* free the created components if fail to load topology */
2506 if (ret)
2507 snd_soc_tplg_component_remove(comp, SND_SOC_TPLG_INDEX_ALL);
2508
2509 return ret;
2504} 2510}
2505EXPORT_SYMBOL_GPL(snd_soc_tplg_component_load); 2511EXPORT_SYMBOL_GPL(snd_soc_tplg_component_load);
2506 2512