]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
fixes for 4.14
authorSasha Levin <sashal@kernel.org>
Wed, 11 Sep 2019 09:26:12 +0000 (05:26 -0400)
committerSasha Levin <sashal@kernel.org>
Wed, 11 Sep 2019 09:26:12 +0000 (05:26 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.14/arm64-dts-rockchip-enable-usb-host-regulators-at-boo.patch [new file with mode: 0644]
queue-4.14/clk-s2mps11-add-used-attribute-to-s2mps11_dt_match.patch [new file with mode: 0644]
queue-4.14/hv_sock-fix-hang-when-a-connection-is-closed.patch [new file with mode: 0644]
queue-4.14/kernel-module-fix-mem-leak-in-module_add_modinfo_att.patch [new file with mode: 0644]
queue-4.14/powerpc-64-mark-start_here_multiplatform-as-__ref.patch [new file with mode: 0644]
queue-4.14/scripts-decode_stacktrace-match-basepath-using-shell.patch [new file with mode: 0644]
queue-4.14/series

diff --git a/queue-4.14/arm64-dts-rockchip-enable-usb-host-regulators-at-boo.patch b/queue-4.14/arm64-dts-rockchip-enable-usb-host-regulators-at-boo.patch
new file mode 100644 (file)
index 0000000..8ebe918
--- /dev/null
@@ -0,0 +1,43 @@
+From 00767119ec315a6094ec517fbd455d468db0c515 Mon Sep 17 00:00:00 2001
+From: Dmitry Voytik <voytikd@gmail.com>
+Date: Tue, 22 Jan 2019 23:38:48 +0100
+Subject: arm64: dts: rockchip: enable usb-host regulators at boot on
+ rk3328-rock64
+
+[ Upstream commit 26e2d7b03ea7ff254bf78305aa44dda62e70b78e ]
+
+After commit ef05bcb60c1a, boot from USB drives is broken.
+Fix this problem by enabling usb-host regulators during boot time.
+
+Fixes: ef05bcb60c1a ("arm64: dts: rockchip: fix vcc_host1_5v pin assign on rk3328-rock64")
+Cc: stable@vger.kernel.org
+Signed-off-by: Dmitry Voytik <voytikd@gmail.com>
+Signed-off-by: Heiko Stuebner <heiko@sntech.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/boot/dts/rockchip/rk3328-rock64.dts | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
+index e720f40bbd5d7..3f8f528099a80 100644
+--- a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
++++ b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
+@@ -77,6 +77,7 @@
+               pinctrl-0 = <&usb30_host_drv>;
+               regulator-name = "vcc_host_5v";
+               regulator-always-on;
++              regulator-boot-on;
+               vin-supply = <&vcc_sys>;
+       };
+@@ -87,6 +88,7 @@
+               pinctrl-0 = <&usb20_host_drv>;
+               regulator-name = "vcc_host1_5v";
+               regulator-always-on;
++              regulator-boot-on;
+               vin-supply = <&vcc_sys>;
+       };
+-- 
+2.20.1
+
diff --git a/queue-4.14/clk-s2mps11-add-used-attribute-to-s2mps11_dt_match.patch b/queue-4.14/clk-s2mps11-add-used-attribute-to-s2mps11_dt_match.patch
new file mode 100644 (file)
index 0000000..cd15206
--- /dev/null
@@ -0,0 +1,62 @@
+From dae4575894573ea5d0600f2e69940d9dd3d70a85 Mon Sep 17 00:00:00 2001
+From: Nathan Chancellor <natechancellor@gmail.com>
+Date: Thu, 18 Oct 2018 12:13:40 -0700
+Subject: clk: s2mps11: Add used attribute to s2mps11_dt_match
+
+[ Upstream commit 9c940bbe2bb47e03ca5e937d30b6a50bf9c0e671 ]
+
+Clang warns after commit 8985167ecf57 ("clk: s2mps11: Fix matching when
+built as module and DT node contains compatible"):
+
+drivers/clk/clk-s2mps11.c:242:34: warning: variable 's2mps11_dt_match'
+is not needed and will not be emitted [-Wunneeded-internal-declaration]
+static const struct of_device_id s2mps11_dt_match[] = {
+                                 ^
+1 warning generated.
+
+This warning happens when a variable is used in some construct that
+doesn't require a reference to that variable to be emitted in the symbol
+table; in this case, it's MODULE_DEVICE_TABLE, which only needs to hold
+the data of the variable, not the variable itself.
+
+$ nm -S drivers/clk/clk-s2mps11.o | rg s2mps11_dt_match
+00000078 000003d4 R __mod_of__s2mps11_dt_match_device_table
+
+Normally, with device ID table variables, it means that the variable
+just needs to be tied to the device declaration at the bottom of the
+file, like s2mps11_clk_id:
+
+$ nm -S drivers/clk/clk-s2mps11.o | rg s2mps11_clk_id
+00000000 00000078 R __mod_platform__s2mps11_clk_id_device_table
+00000000 00000078 r s2mps11_clk_id
+
+However, because the comment above this deliberately doesn't want this
+variable added to .of_match_table, we need to mark s2mps11_dt_match as
+__used to silence this warning. This makes it clear to Clang that the
+variable is used for something, even if a reference to it isn't being
+emitted.
+
+Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
+Fixes: 8985167ecf57 ("clk: s2mps11: Fix matching when built as module and DT node contains compatible")
+Signed-off-by: Stephen Boyd <sboyd@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/clk/clk-s2mps11.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
+index 14071a57c9262..f5d74e8db4327 100644
+--- a/drivers/clk/clk-s2mps11.c
++++ b/drivers/clk/clk-s2mps11.c
+@@ -255,7 +255,7 @@ MODULE_DEVICE_TABLE(platform, s2mps11_clk_id);
+  * This requires of_device_id table.  In the same time this will not change the
+  * actual *device* matching so do not add .of_match_table.
+  */
+-static const struct of_device_id s2mps11_dt_match[] = {
++static const struct of_device_id s2mps11_dt_match[] __used = {
+       {
+               .compatible = "samsung,s2mps11-clk",
+               .data = (void *)S2MPS11X,
+-- 
+2.20.1
+
diff --git a/queue-4.14/hv_sock-fix-hang-when-a-connection-is-closed.patch b/queue-4.14/hv_sock-fix-hang-when-a-connection-is-closed.patch
new file mode 100644 (file)
index 0000000..ee77b0e
--- /dev/null
@@ -0,0 +1,69 @@
+From e0c3437cde7770fccadc7933c1483c68a15deff7 Mon Sep 17 00:00:00 2001
+From: Dexuan Cui <decui@microsoft.com>
+Date: Wed, 31 Jul 2019 01:25:45 +0000
+Subject: hv_sock: Fix hang when a connection is closed
+
+[ Upstream commit 685703b497bacea8765bb409d6b73455b73c540e ]
+
+There is a race condition for an established connection that is being closed
+by the guest: the refcnt is 4 at the end of hvs_release() (Note: here the
+'remove_sock' is false):
+
+1 for the initial value;
+1 for the sk being in the bound list;
+1 for the sk being in the connected list;
+1 for the delayed close_work.
+
+After hvs_release() finishes, __vsock_release() -> sock_put(sk) *may*
+decrease the refcnt to 3.
+
+Concurrently, hvs_close_connection() runs in another thread:
+  calls vsock_remove_sock() to decrease the refcnt by 2;
+  call sock_put() to decrease the refcnt to 0, and free the sk;
+  next, the "release_sock(sk)" may hang due to use-after-free.
+
+In the above, after hvs_release() finishes, if hvs_close_connection() runs
+faster than "__vsock_release() -> sock_put(sk)", then there is not any issue,
+because at the beginning of hvs_close_connection(), the refcnt is still 4.
+
+The issue can be resolved if an extra reference is taken when the
+connection is established.
+
+Fixes: a9eeb998c28d ("hv_sock: Add support for delayed close")
+Signed-off-by: Dexuan Cui <decui@microsoft.com>
+Reviewed-by: Sunil Muthuswamy <sunilmut@microsoft.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/vmw_vsock/hyperv_transport.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/net/vmw_vsock/hyperv_transport.c b/net/vmw_vsock/hyperv_transport.c
+index 52ac3e49c7efd..ec72a5edaa1b8 100644
+--- a/net/vmw_vsock/hyperv_transport.c
++++ b/net/vmw_vsock/hyperv_transport.c
+@@ -320,6 +320,11 @@ static void hvs_close_connection(struct vmbus_channel *chan)
+       lock_sock(sk);
+       hvs_do_close_lock_held(vsock_sk(sk), true);
+       release_sock(sk);
++
++      /* Release the refcnt for the channel that's opened in
++       * hvs_open_connection().
++       */
++      sock_put(sk);
+ }
+ static void hvs_open_connection(struct vmbus_channel *chan)
+@@ -389,6 +394,9 @@ static void hvs_open_connection(struct vmbus_channel *chan)
+       }
+       set_per_channel_state(chan, conn_from_host ? new : sk);
++
++      /* This reference will be dropped by hvs_close_connection(). */
++      sock_hold(conn_from_host ? new : sk);
+       vmbus_set_chn_rescind_callback(chan, hvs_close_connection);
+       /* Set the pending send size to max packet size to always get
+-- 
+2.20.1
+
diff --git a/queue-4.14/kernel-module-fix-mem-leak-in-module_add_modinfo_att.patch b/queue-4.14/kernel-module-fix-mem-leak-in-module_add_modinfo_att.patch
new file mode 100644 (file)
index 0000000..39cceb3
--- /dev/null
@@ -0,0 +1,100 @@
+From 6138be946c9176852c94404488ce297f0186390b Mon Sep 17 00:00:00 2001
+From: YueHaibing <yuehaibing@huawei.com>
+Date: Tue, 11 Jun 2019 23:00:07 +0800
+Subject: kernel/module: Fix mem leak in module_add_modinfo_attrs
+
+[ Upstream commit bc6f2a757d525e001268c3658bd88822e768f8db ]
+
+In module_add_modinfo_attrs if sysfs_create_file
+fails, we forget to free allocated modinfo_attrs
+and roll back the sysfs files.
+
+Fixes: 03e88ae1b13d ("[PATCH] fix module sysfs files reference counting")
+Reviewed-by: Miroslav Benes <mbenes@suse.cz>
+Signed-off-by: YueHaibing <yuehaibing@huawei.com>
+Signed-off-by: Jessica Yu <jeyu@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/module.c | 22 +++++++++++++++++-----
+ 1 file changed, 17 insertions(+), 5 deletions(-)
+
+diff --git a/kernel/module.c b/kernel/module.c
+index 4b372c14d9a1f..4685675912414 100644
+--- a/kernel/module.c
++++ b/kernel/module.c
+@@ -1695,6 +1695,8 @@ static int add_usage_links(struct module *mod)
+       return ret;
+ }
++static void module_remove_modinfo_attrs(struct module *mod, int end);
++
+ static int module_add_modinfo_attrs(struct module *mod)
+ {
+       struct module_attribute *attr;
+@@ -1709,24 +1711,34 @@ static int module_add_modinfo_attrs(struct module *mod)
+               return -ENOMEM;
+       temp_attr = mod->modinfo_attrs;
+-      for (i = 0; (attr = modinfo_attrs[i]) && !error; i++) {
++      for (i = 0; (attr = modinfo_attrs[i]); i++) {
+               if (!attr->test || attr->test(mod)) {
+                       memcpy(temp_attr, attr, sizeof(*temp_attr));
+                       sysfs_attr_init(&temp_attr->attr);
+                       error = sysfs_create_file(&mod->mkobj.kobj,
+                                       &temp_attr->attr);
++                      if (error)
++                              goto error_out;
+                       ++temp_attr;
+               }
+       }
++
++      return 0;
++
++error_out:
++      if (i > 0)
++              module_remove_modinfo_attrs(mod, --i);
+       return error;
+ }
+-static void module_remove_modinfo_attrs(struct module *mod)
++static void module_remove_modinfo_attrs(struct module *mod, int end)
+ {
+       struct module_attribute *attr;
+       int i;
+       for (i = 0; (attr = &mod->modinfo_attrs[i]); i++) {
++              if (end >= 0 && i > end)
++                      break;
+               /* pick a field to test for end of list */
+               if (!attr->attr.name)
+                       break;
+@@ -1814,7 +1826,7 @@ static int mod_sysfs_setup(struct module *mod,
+       return 0;
+ out_unreg_modinfo_attrs:
+-      module_remove_modinfo_attrs(mod);
++      module_remove_modinfo_attrs(mod, -1);
+ out_unreg_param:
+       module_param_sysfs_remove(mod);
+ out_unreg_holders:
+@@ -1850,7 +1862,7 @@ static void mod_sysfs_fini(struct module *mod)
+ {
+ }
+-static void module_remove_modinfo_attrs(struct module *mod)
++static void module_remove_modinfo_attrs(struct module *mod, int end)
+ {
+ }
+@@ -1866,7 +1878,7 @@ static void init_param_lock(struct module *mod)
+ static void mod_sysfs_teardown(struct module *mod)
+ {
+       del_usage_links(mod);
+-      module_remove_modinfo_attrs(mod);
++      module_remove_modinfo_attrs(mod, -1);
+       module_param_sysfs_remove(mod);
+       kobject_put(mod->mkobj.drivers_dir);
+       kobject_put(mod->holders_dir);
+-- 
+2.20.1
+
diff --git a/queue-4.14/powerpc-64-mark-start_here_multiplatform-as-__ref.patch b/queue-4.14/powerpc-64-mark-start_here_multiplatform-as-__ref.patch
new file mode 100644 (file)
index 0000000..32bdf6a
--- /dev/null
@@ -0,0 +1,47 @@
+From 3ad8ccc974d7172acaa3b678ff2c3f626387f20a Mon Sep 17 00:00:00 2001
+From: Christophe Leroy <christophe.leroy@c-s.fr>
+Date: Fri, 10 May 2019 06:31:28 +0000
+Subject: powerpc/64: mark start_here_multiplatform as __ref
+
+[ Upstream commit 9c4e4c90ec24652921e31e9551fcaedc26eec86d ]
+
+Otherwise, the following warning is encountered:
+
+WARNING: vmlinux.o(.text+0x3dc6): Section mismatch in reference from the variable start_here_multiplatform to the function .init.text:.early_setup()
+The function start_here_multiplatform() references
+the function __init .early_setup().
+This is often because start_here_multiplatform lacks a __init
+annotation or the annotation of .early_setup is wrong.
+
+Fixes: 56c46bba9bbf ("powerpc/64: Fix booting large kernels with STRICT_KERNEL_RWX")
+Cc: Russell Currey <ruscur@russell.cc>
+Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/powerpc/kernel/head_64.S | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
+index 4f2e18266e34a..8c04c51a6e148 100644
+--- a/arch/powerpc/kernel/head_64.S
++++ b/arch/powerpc/kernel/head_64.S
+@@ -897,6 +897,7 @@ p_toc:     .8byte  __toc_start + 0x8000 - 0b
+ /*
+  * This is where the main kernel code starts.
+  */
++__REF
+ start_here_multiplatform:
+       /* set up the TOC */
+       bl      relative_toc
+@@ -972,6 +973,7 @@ start_here_multiplatform:
+       RFI
+       b       .       /* prevent speculative execution */
++      .previous
+       /* This is where all platforms converge execution */
+ start_here_common:
+-- 
+2.20.1
+
diff --git a/queue-4.14/scripts-decode_stacktrace-match-basepath-using-shell.patch b/queue-4.14/scripts-decode_stacktrace-match-basepath-using-shell.patch
new file mode 100644 (file)
index 0000000..e8c1e0e
--- /dev/null
@@ -0,0 +1,38 @@
+From 8d54cb50683c4a8164fbd2d5e052557eb4a86c88 Mon Sep 17 00:00:00 2001
+From: Nicolas Boichat <drinkcat@chromium.org>
+Date: Thu, 11 Jul 2019 20:52:27 -0700
+Subject: scripts/decode_stacktrace: match basepath using shell prefix
+ operator, not regex
+
+[ Upstream commit 31013836a71e07751a6827f9d2ad41ef502ddaff ]
+
+The basepath may contain special characters, which would confuse the regex
+matcher.  ${var#prefix} does the right thing.
+
+Link: http://lkml.kernel.org/r/20190518055946.181563-1-drinkcat@chromium.org
+Fixes: 67a28de47faa8358 ("scripts/decode_stacktrace: only strip base path when a prefix of the path")
+Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
+Reviewed-by: Stephen Boyd <swboyd@chromium.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ scripts/decode_stacktrace.sh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh
+index c4a9ddb174bc5..5aa75a0a1cede 100755
+--- a/scripts/decode_stacktrace.sh
++++ b/scripts/decode_stacktrace.sh
+@@ -78,7 +78,7 @@ parse_symbol() {
+       fi
+       # Strip out the base of the path
+-      code=${code//^$basepath/""}
++      code=${code#$basepath/}
+       # In the case of inlines, move everything to same line
+       code=${code//$'\n'/' '}
+-- 
+2.20.1
+
index 878924c2d551c34cd31fb80ce20e78a14aedb1df..9ba0139ebe311ec4e61bc56c7f87a89e3c02ca6c 100644 (file)
@@ -11,3 +11,9 @@ pci-dra7xx-fix-legacy-intd-irq-handling.patch
 vhost-test-fix-build-for-vhost-test.patch
 batman-adv-fix-uninit-value-in-batadv_netlink_get_ifindex.patch
 batman-adv-only-read-ogm-tvlv_len-after-buffer-len-check.patch
+hv_sock-fix-hang-when-a-connection-is-closed.patch
+powerpc-64-mark-start_here_multiplatform-as-__ref.patch
+arm64-dts-rockchip-enable-usb-host-regulators-at-boo.patch
+scripts-decode_stacktrace-match-basepath-using-shell.patch
+clk-s2mps11-add-used-attribute-to-s2mps11_dt_match.patch
+kernel-module-fix-mem-leak-in-module_add_modinfo_att.patch