]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.14
authorSasha Levin <sashal@kernel.org>
Fri, 17 Jul 2020 12:56:00 +0000 (08:56 -0400)
committerSasha Levin <sashal@kernel.org>
Fri, 17 Jul 2020 12:56:00 +0000 (08:56 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.14/arm64-alternatives-use-subsections-for-replacement-s.patch [new file with mode: 0644]
queue-4.14/drm-exynos-fix-ref-count-leak-in-mic_pre_enable.patch [new file with mode: 0644]
queue-4.14/gfs2-read-only-mounts-should-grab-the-sd_freeze_gl-g.patch [new file with mode: 0644]
queue-4.14/i2c-eg20t-load-module-automatically-if-id-matches.patch [new file with mode: 0644]
queue-4.14/series
queue-4.14/tpm_tis-extra-chip-ops-check-on-error-path-in-tpm_ti.patch [new file with mode: 0644]

diff --git a/queue-4.14/arm64-alternatives-use-subsections-for-replacement-s.patch b/queue-4.14/arm64-alternatives-use-subsections-for-replacement-s.patch
new file mode 100644 (file)
index 0000000..17fce91
--- /dev/null
@@ -0,0 +1,136 @@
+From b7e094f1a03f17428c94f8898711f1f39586a7f8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 30 Jun 2020 10:19:21 +0200
+Subject: arm64/alternatives: use subsections for replacement sequences
+
+From: Ard Biesheuvel <ardb@kernel.org>
+
+[ Upstream commit f7b93d42945cc71e1346dd5ae07c59061d56745e ]
+
+When building very large kernels, the logic that emits replacement
+sequences for alternatives fails when relative branches are present
+in the code that is emitted into the .altinstr_replacement section
+and patched in at the original site and fixed up. The reason is that
+the linker will insert veneers if relative branches go out of range,
+and due to the relative distance of the .altinstr_replacement from
+the .text section where its branch targets usually live, veneers
+may be emitted at the end of the .altinstr_replacement section, with
+the relative branches in the sequence pointed at the veneers instead
+of the actual target.
+
+The alternatives patching logic will attempt to fix up the branch to
+point to its original target, which will be the veneer in this case,
+but given that the patch site is likely to be far away as well, it
+will be out of range and so patching will fail. There are other cases
+where these veneers are problematic, e.g., when the target of the
+branch is in .text while the patch site is in .init.text, in which
+case putting the replacement sequence inside .text may not help either.
+
+So let's use subsections to emit the replacement code as closely as
+possible to the patch site, to ensure that veneers are only likely to
+be emitted if they are required at the patch site as well, in which
+case they will be in range for the replacement sequence both before
+and after it is transported to the patch site.
+
+This will prevent alternative sequences in non-init code from being
+released from memory after boot, but this is tolerable given that the
+entire section is only 512 KB on an allyesconfig build (which weighs in
+at 500+ MB for the entire Image). Also, note that modules today carry
+the replacement sequences in non-init sections as well, and any of
+those that target init code will be emitted into init sections after
+this change.
+
+This fixes an early crash when booting an allyesconfig kernel on a
+system where any of the alternatives sequences containing relative
+branches are activated at boot (e.g., ARM64_HAS_PAN on TX2)
+
+Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
+Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
+Cc: James Morse <james.morse@arm.com>
+Cc: Andre Przywara <andre.przywara@arm.com>
+Cc: Dave P Martin <dave.martin@arm.com>
+Link: https://lore.kernel.org/r/20200630081921.13443-1-ardb@kernel.org
+Signed-off-by: Will Deacon <will@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/include/asm/alternative.h | 16 ++++++++--------
+ arch/arm64/kernel/vmlinux.lds.S      |  3 ---
+ 2 files changed, 8 insertions(+), 11 deletions(-)
+
+diff --git a/arch/arm64/include/asm/alternative.h b/arch/arm64/include/asm/alternative.h
+index 4ed869845a23b..1824768fb1ee9 100644
+--- a/arch/arm64/include/asm/alternative.h
++++ b/arch/arm64/include/asm/alternative.h
+@@ -68,11 +68,11 @@ void apply_alternatives(void *start, size_t length);
+       ".pushsection .altinstructions,\"a\"\n"                         \
+       ALTINSTR_ENTRY(feature)                                         \
+       ".popsection\n"                                                 \
+-      ".pushsection .altinstr_replacement, \"a\"\n"                   \
++      ".subsection 1\n"                                               \
+       "663:\n\t"                                                      \
+       newinstr "\n"                                                   \
+       "664:\n\t"                                                      \
+-      ".popsection\n\t"                                               \
++      ".previous\n\t"                                                 \
+       ".org   . - (664b-663b) + (662b-661b)\n\t"                      \
+       ".org   . - (662b-661b) + (664b-663b)\n"                        \
+       ".endif\n"
+@@ -112,9 +112,9 @@ void apply_alternatives(void *start, size_t length);
+ 662:  .pushsection .altinstructions, "a"
+       altinstruction_entry 661b, 663f, \cap, 662b-661b, 664f-663f
+       .popsection
+-      .pushsection .altinstr_replacement, "ax"
++      .subsection 1
+ 663:  \insn2
+-664:  .popsection
++664:  .previous
+       .org    . - (664b-663b) + (662b-661b)
+       .org    . - (662b-661b) + (664b-663b)
+       .endif
+@@ -155,7 +155,7 @@ void apply_alternatives(void *start, size_t length);
+       .pushsection .altinstructions, "a"
+       altinstruction_entry 663f, 661f, \cap, 664f-663f, 662f-661f
+       .popsection
+-      .pushsection .altinstr_replacement, "ax"
++      .subsection 1
+       .align 2        /* So GAS knows label 661 is suitably aligned */
+ 661:
+ .endm
+@@ -174,9 +174,9 @@ void apply_alternatives(void *start, size_t length);
+ .macro alternative_else
+ 662:
+       .if .Lasm_alt_mode==0
+-      .pushsection .altinstr_replacement, "ax"
++      .subsection 1
+       .else
+-      .popsection
++      .previous
+       .endif
+ 663:
+ .endm
+@@ -187,7 +187,7 @@ void apply_alternatives(void *start, size_t length);
+ .macro alternative_endif
+ 664:
+       .if .Lasm_alt_mode==0
+-      .popsection
++      .previous
+       .endif
+       .org    . - (664b-663b) + (662b-661b)
+       .org    . - (662b-661b) + (664b-663b)
+diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S
+index 6edfdf5b061d6..c4e55176f4b6d 100644
+--- a/arch/arm64/kernel/vmlinux.lds.S
++++ b/arch/arm64/kernel/vmlinux.lds.S
+@@ -154,9 +154,6 @@ SECTIONS
+               *(.altinstructions)
+               __alt_instructions_end = .;
+       }
+-      .altinstr_replacement : {
+-              *(.altinstr_replacement)
+-      }
+       . = ALIGN(PAGE_SIZE);
+       __inittext_end = .;
+-- 
+2.25.1
+
diff --git a/queue-4.14/drm-exynos-fix-ref-count-leak-in-mic_pre_enable.patch b/queue-4.14/drm-exynos-fix-ref-count-leak-in-mic_pre_enable.patch
new file mode 100644 (file)
index 0000000..2278df5
--- /dev/null
@@ -0,0 +1,39 @@
+From 7406f0edab19d530aacaf5fcc41f85024cbd3dc9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 15 Jun 2020 00:49:28 -0500
+Subject: drm/exynos: fix ref count leak in mic_pre_enable
+
+From: Navid Emamdoost <navid.emamdoost@gmail.com>
+
+[ Upstream commit d4f5a095daf0d25f0b385e1ef26338608433a4c5 ]
+
+in mic_pre_enable, pm_runtime_get_sync is called which
+increments the counter even in case of failure, leading to incorrect
+ref count. In case of failure, decrement the ref count before returning.
+
+Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
+Signed-off-by: Inki Dae <inki.dae@samsung.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/exynos/exynos_drm_mic.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/exynos/exynos_drm_mic.c b/drivers/gpu/drm/exynos/exynos_drm_mic.c
+index ba4a32b132baa..59ce068b152f5 100644
+--- a/drivers/gpu/drm/exynos/exynos_drm_mic.c
++++ b/drivers/gpu/drm/exynos/exynos_drm_mic.c
+@@ -267,8 +267,10 @@ static void mic_pre_enable(struct drm_bridge *bridge)
+               goto unlock;
+       ret = pm_runtime_get_sync(mic->dev);
+-      if (ret < 0)
++      if (ret < 0) {
++              pm_runtime_put_noidle(mic->dev);
+               goto unlock;
++      }
+       mic_set_path(mic, 1);
+-- 
+2.25.1
+
diff --git a/queue-4.14/gfs2-read-only-mounts-should-grab-the-sd_freeze_gl-g.patch b/queue-4.14/gfs2-read-only-mounts-should-grab-the-sd_freeze_gl-g.patch
new file mode 100644 (file)
index 0000000..a233481
--- /dev/null
@@ -0,0 +1,51 @@
+From 80cbd4bb73f76b39aa7a32069b6839dfc8b95415 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 25 Jun 2020 13:30:18 -0500
+Subject: gfs2: read-only mounts should grab the sd_freeze_gl glock
+
+From: Bob Peterson <rpeterso@redhat.com>
+
+[ Upstream commit b780cc615ba4795a7ef0e93b19424828a5ad456a ]
+
+Before this patch, only read-write mounts would grab the freeze
+glock in read-only mode, as part of gfs2_make_fs_rw. So the freeze
+glock was never initialized. That meant requests to freeze, which
+request the glock in EX, were granted without any state transition.
+That meant you could mount a gfs2 file system, which is currently
+frozen on a different cluster node, in read-only mode.
+
+This patch makes read-only mounts lock the freeze glock in SH mode,
+which will block for file systems that are frozen on another node.
+
+Signed-off-by: Bob Peterson <rpeterso@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/gfs2/ops_fstype.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
+index 7ed0359ebac61..2de67588ac2d8 100644
+--- a/fs/gfs2/ops_fstype.c
++++ b/fs/gfs2/ops_fstype.c
+@@ -1179,7 +1179,17 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
+               goto fail_per_node;
+       }
+-      if (!sb_rdonly(sb)) {
++      if (sb_rdonly(sb)) {
++              struct gfs2_holder freeze_gh;
++
++              error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_SHARED,
++                                         GL_EXACT, &freeze_gh);
++              if (error) {
++                      fs_err(sdp, "can't make FS RO: %d\n", error);
++                      goto fail_per_node;
++              }
++              gfs2_glock_dq_uninit(&freeze_gh);
++      } else {
+               error = gfs2_make_fs_rw(sdp);
+               if (error) {
+                       fs_err(sdp, "can't make FS RW: %d\n", error);
+-- 
+2.25.1
+
diff --git a/queue-4.14/i2c-eg20t-load-module-automatically-if-id-matches.patch b/queue-4.14/i2c-eg20t-load-module-automatically-if-id-matches.patch
new file mode 100644 (file)
index 0000000..47ed19e
--- /dev/null
@@ -0,0 +1,35 @@
+From 11e7d3d94b6429dae48e3c510fe94fdaf9642d64 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 2 Jul 2020 13:15:27 +0300
+Subject: i2c: eg20t: Load module automatically if ID matches
+
+From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+
+[ Upstream commit 5f90786b31fb7d1e199a8999d46c4e3aea672e11 ]
+
+The driver can't be loaded automatically because it misses
+module alias to be provided. Add corresponding MODULE_DEVICE_TABLE()
+call to the driver.
+
+Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Signed-off-by: Wolfram Sang <wsa@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/i2c/busses/i2c-eg20t.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
+index bdeab0174fec2..0b6567d1aa390 100644
+--- a/drivers/i2c/busses/i2c-eg20t.c
++++ b/drivers/i2c/busses/i2c-eg20t.c
+@@ -189,6 +189,7 @@ static const struct pci_device_id pch_pcidev_id[] = {
+       { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7831_I2C), 1, },
+       {0,}
+ };
++MODULE_DEVICE_TABLE(pci, pch_pcidev_id);
+ static irqreturn_t pch_i2c_handler(int irq, void *pData);
+-- 
+2.25.1
+
index 9538e25ee5b77ade32bcfbb80eb8142aac8be2df..981f21ba06245b20888434fd9b6e34fcb45e27ab 100644 (file)
@@ -52,3 +52,8 @@ tcp-make-sure-listeners-don-t-initialize-congestion-control-state.patch
 tcp-md5-do-not-send-silly-options-in-syncookies.patch
 cgroup-fix-cgroup_sk_alloc-for-sk_clone_lock.patch
 cgroup-fix-sock_cgroup_data-on-big-endian.patch
+drm-exynos-fix-ref-count-leak-in-mic_pre_enable.patch
+arm64-alternatives-use-subsections-for-replacement-s.patch
+tpm_tis-extra-chip-ops-check-on-error-path-in-tpm_ti.patch
+gfs2-read-only-mounts-should-grab-the-sd_freeze_gl-g.patch
+i2c-eg20t-load-module-automatically-if-id-matches.patch
diff --git a/queue-4.14/tpm_tis-extra-chip-ops-check-on-error-path-in-tpm_ti.patch b/queue-4.14/tpm_tis-extra-chip-ops-check-on-error-path-in-tpm_ti.patch
new file mode 100644 (file)
index 0000000..27c6473
--- /dev/null
@@ -0,0 +1,42 @@
+From 05342f5db75740e77592eaba67e59e86f03db5a4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 13 Jun 2020 17:18:33 +0300
+Subject: tpm_tis: extra chip->ops check on error path in tpm_tis_core_init
+
+From: Vasily Averin <vvs@virtuozzo.com>
+
+[ Upstream commit ccf6fb858e17a8f8a914a1c6444d277cfedfeae6 ]
+
+Found by smatch:
+drivers/char/tpm/tpm_tis_core.c:1088 tpm_tis_core_init() warn:
+ variable dereferenced before check 'chip->ops' (see line 979)
+
+'chip->ops' is assigned in the beginning of function
+in tpmm_chip_alloc->tpm_chip_alloc
+and is used before first possible goto to error path.
+
+Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
+Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
+Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
+Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/char/tpm/tpm_tis_core.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
+index 9b1116501f209..c028ffd953326 100644
+--- a/drivers/char/tpm/tpm_tis_core.c
++++ b/drivers/char/tpm/tpm_tis_core.c
+@@ -897,7 +897,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
+       return 0;
+ out_err:
+-      if ((chip->ops != NULL) && (chip->ops->clk_enable != NULL))
++      if (chip->ops->clk_enable != NULL)
+               chip->ops->clk_enable(chip, false);
+       tpm_tis_remove(chip);
+-- 
+2.25.1
+