linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.4 01/19] ARM: dts: am33xx: add aliases for mmc interfaces
@ 2021-03-29 22:22 Sasha Levin
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 02/19] bus: ti-sysc: Fix warning on unbind if reset is not deasserted Sasha Levin
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: Sasha Levin @ 2021-03-29 22:22 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Mans Rullgard, Tony Lindgren, Sasha Levin, linux-omap, devicetree

From: Mans Rullgard <mans@mansr.com>

[ Upstream commit 9bbce32a20d6a72c767a7f85fd6127babd1410ac ]

Without DT aliases, the numbering of mmc interfaces is unpredictable.
Adding them makes it possible to refer to devices consistently.  The
popular suggestion to use UUIDs obviously doesn't work with a blank
device fresh from the factory.

See commit fa2d0aa96941 ("mmc: core: Allow setting slot index via
device tree alias") for more discussion.

Signed-off-by: Mans Rullgard <mans@mansr.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/boot/dts/am33xx.dtsi | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index fb6b8aa12cc5..77fa7c0f2104 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -40,6 +40,9 @@ aliases {
 		ethernet1 = &cpsw_emac1;
 		spi0 = &spi0;
 		spi1 = &spi1;
+		mmc0 = &mmc1;
+		mmc1 = &mmc2;
+		mmc2 = &mmc3;
 	};
 
 	cpus {
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH AUTOSEL 5.4 02/19] bus: ti-sysc: Fix warning on unbind if reset is not deasserted
  2021-03-29 22:22 [PATCH AUTOSEL 5.4 01/19] ARM: dts: am33xx: add aliases for mmc interfaces Sasha Levin
@ 2021-03-29 22:22 ` Sasha Levin
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 03/19] platform/x86: intel-hid: Support Lenovo ThinkPad X1 Tablet Gen 2 Sasha Levin
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2021-03-29 22:22 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Tony Lindgren, Sasha Levin, linux-omap

From: Tony Lindgren <tony@atomide.com>

[ Upstream commit a7b5d7c4969aba8d1f04c29048906abaa71fb6a9 ]

We currently get thefollowing on driver unbind if a reset is configured
and asserted:

WARNING: CPU: 0 PID: 993 at drivers/reset/core.c:432 reset_control_assert
...
(reset_control_assert) from [<c0fecda8>] (sysc_remove+0x190/0x1e4)
(sysc_remove) from [<c0a2bb58>] (platform_remove+0x24/0x3c)
(platform_remove) from [<c0a292fc>] (__device_release_driver+0x154/0x214)
(__device_release_driver) from [<c0a2a210>] (device_driver_detach+0x3c/0x8c)
(device_driver_detach) from [<c0a27d64>] (unbind_store+0x60/0xd4)
(unbind_store) from [<c0546bec>] (kernfs_fop_write_iter+0x10c/0x1cc)

Let's fix it by checking the reset status.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/bus/ti-sysc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
index 3934ce3385ac..f9ff6d433dfe 100644
--- a/drivers/bus/ti-sysc.c
+++ b/drivers/bus/ti-sysc.c
@@ -2685,7 +2685,9 @@ static int sysc_remove(struct platform_device *pdev)
 
 	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
-	reset_control_assert(ddata->rsts);
+
+	if (!reset_control_status(ddata->rsts))
+		reset_control_assert(ddata->rsts);
 
 unprepare:
 	sysc_unprepare(ddata);
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH AUTOSEL 5.4 03/19] platform/x86: intel-hid: Support Lenovo ThinkPad X1 Tablet Gen 2
  2021-03-29 22:22 [PATCH AUTOSEL 5.4 01/19] ARM: dts: am33xx: add aliases for mmc interfaces Sasha Levin
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 02/19] bus: ti-sysc: Fix warning on unbind if reset is not deasserted Sasha Levin
@ 2021-03-29 22:22 ` Sasha Levin
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 04/19] bpf, x86: Use kvmalloc_array instead kmalloc_array in bpf_jit_comp Sasha Levin
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2021-03-29 22:22 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Alban Bedel, Alexander Kobel, Hans de Goede, Sasha Levin,
	platform-driver-x86

From: Alban Bedel <albeu@free.fr>

[ Upstream commit 56678a5f44ef5f0ad9a67194bbee2280c6286534 ]

Like a few other system the Lenovo ThinkPad X1 Tablet Gen 2 miss the
HEBC method, which prevent the power button from working. Add a quirk
to enable the button array on this system family and fix the power
button.

Signed-off-by: Alban Bedel <albeu@free.fr>
Tested-by: Alexander Kobel <a-kobel@a-kobel.de>
Link: https://lore.kernel.org/r/20210222141559.3775-1-albeu@free.fr
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/platform/x86/intel-hid.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/platform/x86/intel-hid.c b/drivers/platform/x86/intel-hid.c
index ad1399dcb21f..164bebbfea21 100644
--- a/drivers/platform/x86/intel-hid.c
+++ b/drivers/platform/x86/intel-hid.c
@@ -84,6 +84,13 @@ static const struct dmi_system_id button_array_table[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "HP Spectre x2 Detachable"),
 		},
 	},
+	{
+		.ident = "Lenovo ThinkPad X1 Tablet Gen 2",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+			DMI_MATCH(DMI_PRODUCT_FAMILY, "ThinkPad X1 Tablet Gen 2"),
+		},
+	},
 	{ }
 };
 
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH AUTOSEL 5.4 04/19] bpf, x86: Use kvmalloc_array instead kmalloc_array in bpf_jit_comp
  2021-03-29 22:22 [PATCH AUTOSEL 5.4 01/19] ARM: dts: am33xx: add aliases for mmc interfaces Sasha Levin
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 02/19] bus: ti-sysc: Fix warning on unbind if reset is not deasserted Sasha Levin
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 03/19] platform/x86: intel-hid: Support Lenovo ThinkPad X1 Tablet Gen 2 Sasha Levin
@ 2021-03-29 22:22 ` Sasha Levin
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 05/19] net/mlx5e: Enforce minimum value check for ICOSQ size Sasha Levin
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2021-03-29 22:22 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Yonghong Song, Alexei Starovoitov, Daniel Borkmann, Sasha Levin,
	netdev, bpf

From: Yonghong Song <yhs@fb.com>

[ Upstream commit de920fc64cbaa031f947e9be964bda05fd090380 ]

x86 bpf_jit_comp.c used kmalloc_array to store jited addresses
for each bpf insn. With a large bpf program, we have see the
following allocation failures in our production server:

    page allocation failure: order:5, mode:0x40cc0(GFP_KERNEL|__GFP_COMP),
                             nodemask=(null),cpuset=/,mems_allowed=0"
    Call Trace:
    dump_stack+0x50/0x70
    warn_alloc.cold.120+0x72/0xd2
    ? __alloc_pages_direct_compact+0x157/0x160
    __alloc_pages_slowpath+0xcdb/0xd00
    ? get_page_from_freelist+0xe44/0x1600
    ? vunmap_page_range+0x1ba/0x340
    __alloc_pages_nodemask+0x2c9/0x320
    kmalloc_order+0x18/0x80
    kmalloc_order_trace+0x1d/0xa0
    bpf_int_jit_compile+0x1e2/0x484
    ? kmalloc_order_trace+0x1d/0xa0
    bpf_prog_select_runtime+0xc3/0x150
    bpf_prog_load+0x480/0x720
    ? __mod_memcg_lruvec_state+0x21/0x100
    __do_sys_bpf+0xc31/0x2040
    ? close_pdeo+0x86/0xe0
    do_syscall_64+0x42/0x110
    entry_SYSCALL_64_after_hwframe+0x44/0xa9
    RIP: 0033:0x7f2f300f7fa9
    Code: Bad RIP value.

Dumped assembly:

    ffffffff810b6d70 <bpf_int_jit_compile>:
    ; {
    ffffffff810b6d70: e8 eb a5 b4 00        callq   0xffffffff81c01360 <__fentry__>
    ffffffff810b6d75: 41 57                 pushq   %r15
    ...
    ffffffff810b6f39: e9 72 fe ff ff        jmp     0xffffffff810b6db0 <bpf_int_jit_compile+0x40>
    ;       addrs = kmalloc_array(prog->len + 1, sizeof(*addrs), GFP_KERNEL);
    ffffffff810b6f3e: 8b 45 0c              movl    12(%rbp), %eax
    ;       return __kmalloc(bytes, flags);
    ffffffff810b6f41: be c0 0c 00 00        movl    $3264, %esi
    ;       addrs = kmalloc_array(prog->len + 1, sizeof(*addrs), GFP_KERNEL);
    ffffffff810b6f46: 8d 78 01              leal    1(%rax), %edi
    ;       if (unlikely(check_mul_overflow(n, size, &bytes)))
    ffffffff810b6f49: 48 c1 e7 02           shlq    $2, %rdi
    ;       return __kmalloc(bytes, flags);
    ffffffff810b6f4d: e8 8e 0c 1d 00        callq   0xffffffff81287be0 <__kmalloc>
    ;       if (!addrs) {
    ffffffff810b6f52: 48 85 c0              testq   %rax, %rax

Change kmalloc_array() to kvmalloc_array() to avoid potential
allocation error for big bpf programs.

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20210309015647.3657852-1-yhs@fb.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/x86/net/bpf_jit_comp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
index 18936533666e..44c7d7aef8c1 100644
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
@@ -1118,7 +1118,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
 		extra_pass = true;
 		goto skip_init_addrs;
 	}
-	addrs = kmalloc_array(prog->len + 1, sizeof(*addrs), GFP_KERNEL);
+	addrs = kvmalloc_array(prog->len + 1, sizeof(*addrs), GFP_KERNEL);
 	if (!addrs) {
 		prog = orig_prog;
 		goto out_addrs;
@@ -1195,7 +1195,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
 		if (image)
 			bpf_prog_fill_jited_linfo(prog, addrs + 1);
 out_addrs:
-		kfree(addrs);
+		kvfree(addrs);
 		kfree(jit_data);
 		prog->aux->jit_data = NULL;
 	}
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH AUTOSEL 5.4 05/19] net/mlx5e: Enforce minimum value check for ICOSQ size
  2021-03-29 22:22 [PATCH AUTOSEL 5.4 01/19] ARM: dts: am33xx: add aliases for mmc interfaces Sasha Levin
                   ` (2 preceding siblings ...)
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 04/19] bpf, x86: Use kvmalloc_array instead kmalloc_array in bpf_jit_comp Sasha Levin
@ 2021-03-29 22:22 ` Sasha Levin
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 06/19] net: pxa168_eth: Fix a potential data race in pxa168_eth_remove Sasha Levin
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2021-03-29 22:22 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Tariq Toukan, Maxim Mikityanskiy, Saeed Mahameed, Sasha Levin,
	netdev, linux-rdma

From: Tariq Toukan <tariqt@nvidia.com>

[ Upstream commit 5115daa675ccf70497fe56e8916cf738d8212c10 ]

The ICOSQ size should not go below MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE.
Enforce this where it's missing.

Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Maxim Mikityanskiy <maximmi@mellanox.com>
Reviewed-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 8b8581f71e79..36b9a364ef26 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -2365,8 +2365,9 @@ static u8 mlx5e_build_icosq_log_wq_sz(struct mlx5e_params *params,
 {
 	switch (params->rq_wq_type) {
 	case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
-		return order_base_2(MLX5E_UMR_WQEBBS) +
-			mlx5e_get_rq_log_wq_sz(rqp->rqc);
+		return max_t(u8, MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE,
+			     order_base_2(MLX5E_UMR_WQEBBS) +
+			     mlx5e_get_rq_log_wq_sz(rqp->rqc));
 	default: /* MLX5_WQ_TYPE_CYCLIC */
 		return MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE;
 	}
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH AUTOSEL 5.4 06/19] net: pxa168_eth: Fix a potential data race in pxa168_eth_remove
  2021-03-29 22:22 [PATCH AUTOSEL 5.4 01/19] ARM: dts: am33xx: add aliases for mmc interfaces Sasha Levin
                   ` (3 preceding siblings ...)
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 05/19] net/mlx5e: Enforce minimum value check for ICOSQ size Sasha Levin
@ 2021-03-29 22:22 ` Sasha Levin
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 07/19] mISDN: fix crash in fritzpci Sasha Levin
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2021-03-29 22:22 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Pavel Andrianov, David S . Miller, Sasha Levin, netdev

From: Pavel Andrianov <andrianov@ispras.ru>

[ Upstream commit 0571a753cb07982cc82f4a5115e0b321da89e1f3 ]

pxa168_eth_remove() firstly calls unregister_netdev(),
then cancels a timeout work. unregister_netdev() shuts down a device
interface and removes it from the kernel tables. If the timeout occurs
in parallel, the timeout work (pxa168_eth_tx_timeout_task) performs stop
and open of the device. It may lead to an inconsistent state and memory
leaks.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Pavel Andrianov <andrianov@ispras.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/marvell/pxa168_eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index 51b77c2de400..235bbb2940a8 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -1554,8 +1554,8 @@ static int pxa168_eth_remove(struct platform_device *pdev)
 
 	mdiobus_unregister(pep->smi_bus);
 	mdiobus_free(pep->smi_bus);
-	unregister_netdev(dev);
 	cancel_work_sync(&pep->tx_timeout_task);
+	unregister_netdev(dev);
 	free_netdev(dev);
 	return 0;
 }
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH AUTOSEL 5.4 07/19] mISDN: fix crash in fritzpci
  2021-03-29 22:22 [PATCH AUTOSEL 5.4 01/19] ARM: dts: am33xx: add aliases for mmc interfaces Sasha Levin
                   ` (4 preceding siblings ...)
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 06/19] net: pxa168_eth: Fix a potential data race in pxa168_eth_remove Sasha Levin
@ 2021-03-29 22:22 ` Sasha Levin
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 08/19] mac80211: fix double free in ibss_leave Sasha Levin
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2021-03-29 22:22 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Tong Zhang, David S . Miller, Sasha Levin, netdev

From: Tong Zhang <ztong0001@gmail.com>

[ Upstream commit a9f81244d2e33e6dfcef120fefd30c96b3f7cdb0 ]

setup_fritz() in avmfritz.c might fail with -EIO and in this case the
isac.type and isac.write_reg is not initialized and remains 0(NULL).
A subsequent call to isac_release() will dereference isac->write_reg and
crash.

[    1.737444] BUG: kernel NULL pointer dereference, address: 0000000000000000
[    1.737809] #PF: supervisor instruction fetch in kernel mode
[    1.738106] #PF: error_code(0x0010) - not-present page
[    1.738378] PGD 0 P4D 0
[    1.738515] Oops: 0010 [#1] SMP NOPTI
[    1.738711] CPU: 0 PID: 180 Comm: systemd-udevd Not tainted 5.12.0-rc2+ #78
[    1.739077] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-48-gd9c812dda519-p
rebuilt.qemu.org 04/01/2014
[    1.739664] RIP: 0010:0x0
[    1.739807] Code: Unable to access opcode bytes at RIP 0xffffffffffffffd6.
[    1.740200] RSP: 0018:ffffc9000027ba10 EFLAGS: 00010202
[    1.740478] RAX: 0000000000000000 RBX: ffff888102f41840 RCX: 0000000000000027
[    1.740853] RDX: 00000000000000ff RSI: 0000000000000020 RDI: ffff888102f41800
[    1.741226] RBP: ffffc9000027ba20 R08: ffff88817bc18440 R09: ffffc9000027b808
[    1.741600] R10: 0000000000000001 R11: 0000000000000001 R12: ffff888102f41840
[    1.741976] R13: 00000000fffffffb R14: ffff888102f41800 R15: ffff8881008b0000
[    1.742351] FS:  00007fda3a38a8c0(0000) GS:ffff88817bc00000(0000) knlGS:0000000000000000
[    1.742774] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    1.743076] CR2: ffffffffffffffd6 CR3: 00000001021ec000 CR4: 00000000000006f0
[    1.743452] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[    1.743828] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[    1.744206] Call Trace:
[    1.744339]  isac_release+0xcc/0xe0 [mISDNipac]
[    1.744582]  fritzpci_probe.cold+0x282/0x739 [avmfritz]
[    1.744861]  local_pci_probe+0x48/0x80
[    1.745063]  pci_device_probe+0x10f/0x1c0
[    1.745278]  really_probe+0xfb/0x420
[    1.745471]  driver_probe_device+0xe9/0x160
[    1.745693]  device_driver_attach+0x5d/0x70
[    1.745917]  __driver_attach+0x8f/0x150
[    1.746123]  ? device_driver_attach+0x70/0x70
[    1.746354]  bus_for_each_dev+0x7e/0xc0
[    1.746560]  driver_attach+0x1e/0x20
[    1.746751]  bus_add_driver+0x152/0x1f0
[    1.746957]  driver_register+0x74/0xd0
[    1.747157]  ? 0xffffffffc00d8000
[    1.747334]  __pci_register_driver+0x54/0x60
[    1.747562]  AVM_init+0x36/0x1000 [avmfritz]
[    1.747791]  do_one_initcall+0x48/0x1d0
[    1.747997]  ? __cond_resched+0x19/0x30
[    1.748206]  ? kmem_cache_alloc_trace+0x390/0x440
[    1.748458]  ? do_init_module+0x28/0x250
[    1.748669]  do_init_module+0x62/0x250
[    1.748870]  load_module+0x23ee/0x26a0
[    1.749073]  __do_sys_finit_module+0xc2/0x120
[    1.749307]  ? __do_sys_finit_module+0xc2/0x120
[    1.749549]  __x64_sys_finit_module+0x1a/0x20
[    1.749782]  do_syscall_64+0x38/0x90

Signed-off-by: Tong Zhang <ztong0001@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/isdn/hardware/mISDN/mISDNipac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/isdn/hardware/mISDN/mISDNipac.c b/drivers/isdn/hardware/mISDN/mISDNipac.c
index bca880213e91..51e3d45daaa7 100644
--- a/drivers/isdn/hardware/mISDN/mISDNipac.c
+++ b/drivers/isdn/hardware/mISDN/mISDNipac.c
@@ -694,7 +694,7 @@ isac_release(struct isac_hw *isac)
 {
 	if (isac->type & IPAC_TYPE_ISACX)
 		WriteISAC(isac, ISACX_MASK, 0xff);
-	else
+	else if (isac->type != 0)
 		WriteISAC(isac, ISAC_MASK, 0xff);
 	if (isac->dch.timer.function != NULL) {
 		del_timer(&isac->dch.timer);
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH AUTOSEL 5.4 08/19] mac80211: fix double free in ibss_leave
  2021-03-29 22:22 [PATCH AUTOSEL 5.4 01/19] ARM: dts: am33xx: add aliases for mmc interfaces Sasha Levin
                   ` (5 preceding siblings ...)
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 07/19] mISDN: fix crash in fritzpci Sasha Levin
@ 2021-03-29 22:22 ` Sasha Levin
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 09/19] mac80211: choose first enabled channel for monitor Sasha Levin
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2021-03-29 22:22 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Markus Theil, syzbot+93976391bf299d425f44, Johannes Berg,
	Sasha Levin, linux-wireless, netdev

From: Markus Theil <markus.theil@tu-ilmenau.de>

[ Upstream commit 3bd801b14e0c5d29eeddc7336558beb3344efaa3 ]

Clear beacon ie pointer and ie length after free
in order to prevent double free.

==================================================================
BUG: KASAN: double-free or invalid-free \
in ieee80211_ibss_leave+0x83/0xe0 net/mac80211/ibss.c:1876

CPU: 0 PID: 8472 Comm: syz-executor100 Not tainted 5.11.0-rc6-syzkaller #0
Call Trace:
 __dump_stack lib/dump_stack.c:79 [inline]
 dump_stack+0x107/0x163 lib/dump_stack.c:120
 print_address_description.constprop.0.cold+0x5b/0x2c6 mm/kasan/report.c:230
 kasan_report_invalid_free+0x51/0x80 mm/kasan/report.c:355
 ____kasan_slab_free+0xcc/0xe0 mm/kasan/common.c:341
 kasan_slab_free include/linux/kasan.h:192 [inline]
 __cache_free mm/slab.c:3424 [inline]
 kfree+0xed/0x270 mm/slab.c:3760
 ieee80211_ibss_leave+0x83/0xe0 net/mac80211/ibss.c:1876
 rdev_leave_ibss net/wireless/rdev-ops.h:545 [inline]
 __cfg80211_leave_ibss+0x19a/0x4c0 net/wireless/ibss.c:212
 __cfg80211_leave+0x327/0x430 net/wireless/core.c:1172
 cfg80211_leave net/wireless/core.c:1221 [inline]
 cfg80211_netdev_notifier_call+0x9e8/0x12c0 net/wireless/core.c:1335
 notifier_call_chain+0xb5/0x200 kernel/notifier.c:83
 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:2040
 call_netdevice_notifiers_extack net/core/dev.c:2052 [inline]
 call_netdevice_notifiers net/core/dev.c:2066 [inline]
 __dev_close_many+0xee/0x2e0 net/core/dev.c:1586
 __dev_close net/core/dev.c:1624 [inline]
 __dev_change_flags+0x2cb/0x730 net/core/dev.c:8476
 dev_change_flags+0x8a/0x160 net/core/dev.c:8549
 dev_ifsioc+0x210/0xa70 net/core/dev_ioctl.c:265
 dev_ioctl+0x1b1/0xc40 net/core/dev_ioctl.c:511
 sock_do_ioctl+0x148/0x2d0 net/socket.c:1060
 sock_ioctl+0x477/0x6a0 net/socket.c:1177
 vfs_ioctl fs/ioctl.c:48 [inline]
 __do_sys_ioctl fs/ioctl.c:753 [inline]
 __se_sys_ioctl fs/ioctl.c:739 [inline]
 __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:739
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Reported-by: syzbot+93976391bf299d425f44@syzkaller.appspotmail.com
Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
Link: https://lore.kernel.org/r/20210213133653.367130-1-markus.theil@tu-ilmenau.de
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/mac80211/ibss.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 0a6ff01c68a9..0e26c83b6b41 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -1868,6 +1868,8 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata)
 
 	/* remove beacon */
 	kfree(sdata->u.ibss.ie);
+	sdata->u.ibss.ie = NULL;
+	sdata->u.ibss.ie_len = 0;
 
 	/* on the next join, re-program HT parameters */
 	memset(&ifibss->ht_capa, 0, sizeof(ifibss->ht_capa));
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH AUTOSEL 5.4 09/19] mac80211: choose first enabled channel for monitor
  2021-03-29 22:22 [PATCH AUTOSEL 5.4 01/19] ARM: dts: am33xx: add aliases for mmc interfaces Sasha Levin
                   ` (6 preceding siblings ...)
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 08/19] mac80211: fix double free in ibss_leave Sasha Levin
@ 2021-03-29 22:22 ` Sasha Levin
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 10/19] drm/msm/adreno: a5xx_power: Don't apply A540 lm_setup to other GPUs Sasha Levin
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2021-03-29 22:22 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Karthikeyan Kathirvel, Johannes Berg, Sasha Levin,
	linux-wireless, netdev

From: Karthikeyan Kathirvel <kathirve@codeaurora.org>

[ Upstream commit 041c881a0ba8a75f71118bd9766b78f04beed469 ]

Even if the first channel from sband channel list is invalid
or disabled mac80211 ends up choosing it as the default channel
for monitor interfaces, making them not usable.

Fix this by assigning the first available valid or enabled
channel instead.

Signed-off-by: Karthikeyan Kathirvel <kathirve@codeaurora.org>
Link: https://lore.kernel.org/r/1615440547-7661-1-git-send-email-kathirve@codeaurora.org
[reword commit message, comment, code cleanups]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/mac80211/main.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 3e8561c3b0e7..5b3189a37680 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -954,8 +954,19 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
 			continue;
 
 		if (!dflt_chandef.chan) {
+			/*
+			 * Assign the first enabled channel to dflt_chandef
+			 * from the list of channels
+			 */
+			for (i = 0; i < sband->n_channels; i++)
+				if (!(sband->channels[i].flags &
+						IEEE80211_CHAN_DISABLED))
+					break;
+			/* if none found then use the first anyway */
+			if (i == sband->n_channels)
+				i = 0;
 			cfg80211_chandef_create(&dflt_chandef,
-						&sband->channels[0],
+						&sband->channels[i],
 						NL80211_CHAN_NO_HT);
 			/* init channel we're on */
 			if (!local->use_chanctx && !local->_oper_chandef.chan) {
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH AUTOSEL 5.4 10/19] drm/msm/adreno: a5xx_power: Don't apply A540 lm_setup to other GPUs
  2021-03-29 22:22 [PATCH AUTOSEL 5.4 01/19] ARM: dts: am33xx: add aliases for mmc interfaces Sasha Levin
                   ` (7 preceding siblings ...)
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 09/19] mac80211: choose first enabled channel for monitor Sasha Levin
@ 2021-03-29 22:22 ` Sasha Levin
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 11/19] drm/msm: Ratelimit invalid-fence message Sasha Levin
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2021-03-29 22:22 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Konrad Dybcio, Rob Clark, Sasha Levin, linux-arm-msm, dri-devel,
	freedreno

From: Konrad Dybcio <konrad.dybcio@somainline.org>

[ Upstream commit 4a9d36b0610aa7034340e976652e5b43320dd7c5 ]

While passing the A530-specific lm_setup func to A530 and A540
to !A530 was fine back when only these two were supported, it
certainly is not a good idea to send A540 specifics to smaller
GPUs like A508 and friends.

Signed-off-by: Konrad Dybcio <konrad.dybcio@somainline.org>
Signed-off-by: Rob Clark <robdclark@chromium.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/msm/adreno/a5xx_power.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_power.c b/drivers/gpu/drm/msm/adreno/a5xx_power.c
index a3a06db675ba..ee3ff32da004 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_power.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_power.c
@@ -300,7 +300,7 @@ int a5xx_power_init(struct msm_gpu *gpu)
 	/* Set up the limits management */
 	if (adreno_is_a530(adreno_gpu))
 		a530_lm_setup(gpu);
-	else
+	else if (adreno_is_a540(adreno_gpu))
 		a540_lm_setup(gpu);
 
 	/* Set up SP/TP power collpase */
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH AUTOSEL 5.4 11/19] drm/msm: Ratelimit invalid-fence message
  2021-03-29 22:22 [PATCH AUTOSEL 5.4 01/19] ARM: dts: am33xx: add aliases for mmc interfaces Sasha Levin
                   ` (8 preceding siblings ...)
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 10/19] drm/msm/adreno: a5xx_power: Don't apply A540 lm_setup to other GPUs Sasha Levin
@ 2021-03-29 22:22 ` Sasha Levin
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 12/19] netfilter: conntrack: Fix gre tunneling over ipv6 Sasha Levin
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2021-03-29 22:22 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Rob Clark, Douglas Anderson, Sasha Levin, linux-arm-msm,
	dri-devel, freedreno

From: Rob Clark <robdclark@chromium.org>

[ Upstream commit 7ad48d27a2846bfda29214fb454d001c3e02b9e7 ]

We have seen a couple cases where low memory situations cause something
bad to happen, followed by a flood of these messages obscuring the root
cause.  Lets ratelimit the dmesg spam so that next time it happens we
don't lose the kernel traces leading up to this.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/msm/msm_fence.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/msm_fence.c b/drivers/gpu/drm/msm/msm_fence.c
index ad2703698b05..cd59a5918038 100644
--- a/drivers/gpu/drm/msm/msm_fence.c
+++ b/drivers/gpu/drm/msm/msm_fence.c
@@ -45,7 +45,7 @@ int msm_wait_fence(struct msm_fence_context *fctx, uint32_t fence,
 	int ret;
 
 	if (fence > fctx->last_fence) {
-		DRM_ERROR("%s: waiting on invalid fence: %u (of %u)\n",
+		DRM_ERROR_RATELIMITED("%s: waiting on invalid fence: %u (of %u)\n",
 				fctx->name, fence, fctx->last_fence);
 		return -EINVAL;
 	}
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH AUTOSEL 5.4 12/19] netfilter: conntrack: Fix gre tunneling over ipv6
  2021-03-29 22:22 [PATCH AUTOSEL 5.4 01/19] ARM: dts: am33xx: add aliases for mmc interfaces Sasha Levin
                   ` (9 preceding siblings ...)
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 11/19] drm/msm: Ratelimit invalid-fence message Sasha Levin
@ 2021-03-29 22:22 ` Sasha Levin
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 13/19] platform/x86: thinkpad_acpi: Allow the FnLock LED to change state Sasha Levin
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2021-03-29 22:22 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Ludovic Senecaux, Florian Westphal, Pablo Neira Ayuso,
	Sasha Levin, netfilter-devel, coreteam, netdev

From: Ludovic Senecaux <linuxludo@free.fr>

[ Upstream commit 8b2030b4305951f44afef80225f1475618e25a73 ]

This fix permits gre connections to be tracked within ip6tables rules

Signed-off-by: Ludovic Senecaux <linuxludo@free.fr>
Acked-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/netfilter/nf_conntrack_proto_gre.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/net/netfilter/nf_conntrack_proto_gre.c b/net/netfilter/nf_conntrack_proto_gre.c
index 5b05487a60d2..db11e403d818 100644
--- a/net/netfilter/nf_conntrack_proto_gre.c
+++ b/net/netfilter/nf_conntrack_proto_gre.c
@@ -218,9 +218,6 @@ int nf_conntrack_gre_packet(struct nf_conn *ct,
 			    enum ip_conntrack_info ctinfo,
 			    const struct nf_hook_state *state)
 {
-	if (state->pf != NFPROTO_IPV4)
-		return -NF_ACCEPT;
-
 	if (!nf_ct_is_confirmed(ct)) {
 		unsigned int *timeouts = nf_ct_timeout_lookup(ct);
 
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH AUTOSEL 5.4 13/19] platform/x86: thinkpad_acpi: Allow the FnLock LED to change state
  2021-03-29 22:22 [PATCH AUTOSEL 5.4 01/19] ARM: dts: am33xx: add aliases for mmc interfaces Sasha Levin
                   ` (10 preceding siblings ...)
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 12/19] netfilter: conntrack: Fix gre tunneling over ipv6 Sasha Levin
@ 2021-03-29 22:22 ` Sasha Levin
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 14/19] x86/build: Turn off -fcf-protection for realmode targets Sasha Levin
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2021-03-29 22:22 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Esteve Varela Colominas, Hans de Goede, Sasha Levin,
	ibm-acpi-devel, platform-driver-x86

From: Esteve Varela Colominas <esteve.varela@gmail.com>

[ Upstream commit 3d677f12ea3a2097a16ded570623567403dea959 ]

On many recent ThinkPad laptops, there's a new LED next to the ESC key,
that indicates the FnLock status.
When the Fn+ESC combo is pressed, FnLock is toggled, which causes the
Media Key functionality to change, making it so that the media keys
either perform their media key function, or function as an F-key by
default. The Fn key can be used the access the alternate function at any
time.

With the current linux kernel, the LED doens't change state if you press
the Fn+ESC key combo. However, the media key functionality *does*
change. This is annoying, since the LED will stay on if it was on during
bootup, and it makes it hard to keep track what the current state of the
FnLock is.

This patch calls an ACPI function, that gets the current media key
state, when the Fn+ESC key combo is pressed. Through testing it was
discovered that this function causes the LED to update correctly to
reflect the current state when this function is called.

The relevant ACPI calls are the following:
\_SB_.PCI0.LPC0.EC0_.HKEY.GMKS: Get media key state, returns 0x603 if the FnLock mode is enabled, and 0x602 if it's disabled.
\_SB_.PCI0.LPC0.EC0_.HKEY.SMKS: Set media key state, sending a 1 will enable FnLock mode, and a 0 will disable it.

Relevant discussion:
https://bugzilla.kernel.org/show_bug.cgi?id=207841
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1881015

Signed-off-by: Esteve Varela Colominas <esteve.varela@gmail.com>
Link: https://lore.kernel.org/r/20210315195823.23212-1-esteve.varela@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/platform/x86/thinkpad_acpi.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 8c54d3707fba..e8257de495fd 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -4089,13 +4089,19 @@ static bool hotkey_notify_6xxx(const u32 hkey,
 
 	case TP_HKEY_EV_KEY_NUMLOCK:
 	case TP_HKEY_EV_KEY_FN:
-	case TP_HKEY_EV_KEY_FN_ESC:
 		/* key press events, we just ignore them as long as the EC
 		 * is still reporting them in the normal keyboard stream */
 		*send_acpi_ev = false;
 		*ignore_acpi_ev = true;
 		return true;
 
+	case TP_HKEY_EV_KEY_FN_ESC:
+		/* Get the media key status to foce the status LED to update */
+		acpi_evalf(hkey_handle, NULL, "GMKS", "v");
+		*send_acpi_ev = false;
+		*ignore_acpi_ev = true;
+		return true;
+
 	case TP_HKEY_EV_TABLET_CHANGED:
 		tpacpi_input_send_tabletsw();
 		hotkey_tablet_mode_notify_change();
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH AUTOSEL 5.4 14/19] x86/build: Turn off -fcf-protection for realmode targets
  2021-03-29 22:22 [PATCH AUTOSEL 5.4 01/19] ARM: dts: am33xx: add aliases for mmc interfaces Sasha Levin
                   ` (11 preceding siblings ...)
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 13/19] platform/x86: thinkpad_acpi: Allow the FnLock LED to change state Sasha Levin
@ 2021-03-29 22:22 ` Sasha Levin
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 15/19] scsi: target: pscsi: Clean up after failure in pscsi_map_sg() Sasha Levin
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2021-03-29 22:22 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Arnd Bergmann, Ingo Molnar, Sasha Levin

From: Arnd Bergmann <arnd@arndb.de>

[ Upstream commit 9fcb51c14da2953de585c5c6e50697b8a6e91a7b ]

The new Ubuntu GCC packages turn on -fcf-protection globally,
which causes a build failure in the x86 realmode code:

  cc1: error: ‘-fcf-protection’ is not compatible with this target

Turn it off explicitly on compilers that understand this option.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20210323124846.1584944-1-arnd@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/x86/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 8ca3cf7c5ec9..59942e349e5f 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -34,7 +34,7 @@ M16_CFLAGS	 := $(call cc-option, -m16, $(CODE16GCC_CFLAGS))
 REALMODE_CFLAGS	:= $(M16_CFLAGS) -g -Os -DDISABLE_BRANCH_PROFILING \
 		   -Wall -Wstrict-prototypes -march=i386 -mregparm=3 \
 		   -fno-strict-aliasing -fomit-frame-pointer -fno-pic \
-		   -mno-mmx -mno-sse
+		   -mno-mmx -mno-sse $(call cc-option,-fcf-protection=none)
 
 REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), -ffreestanding)
 REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), -fno-stack-protector)
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH AUTOSEL 5.4 15/19] scsi: target: pscsi: Clean up after failure in pscsi_map_sg()
  2021-03-29 22:22 [PATCH AUTOSEL 5.4 01/19] ARM: dts: am33xx: add aliases for mmc interfaces Sasha Levin
                   ` (12 preceding siblings ...)
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 14/19] x86/build: Turn off -fcf-protection for realmode targets Sasha Levin
@ 2021-03-29 22:22 ` Sasha Levin
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 16/19] ia64: mca: allocate early mca with GFP_ATOMIC Sasha Levin
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2021-03-29 22:22 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Martin Wilck, Christoph Hellwig, Lee Duncan, Martin K . Petersen,
	Sasha Levin, linux-scsi, target-devel

From: Martin Wilck <mwilck@suse.com>

[ Upstream commit 36fa766faa0c822c860e636fe82b1affcd022974 ]

If pscsi_map_sg() fails, make sure to drop references to already allocated
bios.

Link: https://lore.kernel.org/r/20210323212431.15306-2-mwilck@suse.com
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/target/target_core_pscsi.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
index c9d92b3e777d..5a047ce77bc0 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -939,6 +939,14 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
 
 	return 0;
 fail:
+	if (bio)
+		bio_put(bio);
+	while (req->bio) {
+		bio = req->bio;
+		req->bio = bio->bi_next;
+		bio_put(bio);
+	}
+	req->biotail = NULL;
 	return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
 }
 
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH AUTOSEL 5.4 16/19] ia64: mca: allocate early mca with GFP_ATOMIC
  2021-03-29 22:22 [PATCH AUTOSEL 5.4 01/19] ARM: dts: am33xx: add aliases for mmc interfaces Sasha Levin
                   ` (13 preceding siblings ...)
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 15/19] scsi: target: pscsi: Clean up after failure in pscsi_map_sg() Sasha Levin
@ 2021-03-29 22:22 ` Sasha Levin
  2021-03-29 22:23 ` [PATCH AUTOSEL 5.4 17/19] ia64: fix format strings for err_inject Sasha Levin
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2021-03-29 22:22 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Sergei Trofimovich, Andrew Morton, Linus Torvalds, Sasha Levin,
	linux-ia64

From: Sergei Trofimovich <slyfox@gentoo.org>

[ Upstream commit f2a419cf495f95cac49ea289318b833477e1a0e2 ]

The sleep warning happens at early boot right at secondary CPU
activation bootup:

    smp: Bringing up secondary CPUs ...
    BUG: sleeping function called from invalid context at mm/page_alloc.c:4942
    in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 0, name: swapper/1
    CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.12.0-rc2-00007-g79e228d0b611-dirty #99
    ..
    Call Trace:
      show_stack+0x90/0xc0
      dump_stack+0x150/0x1c0
      ___might_sleep+0x1c0/0x2a0
      __might_sleep+0xa0/0x160
      __alloc_pages_nodemask+0x1a0/0x600
      alloc_page_interleave+0x30/0x1c0
      alloc_pages_current+0x2c0/0x340
      __get_free_pages+0x30/0xa0
      ia64_mca_cpu_init+0x2d0/0x3a0
      cpu_init+0x8b0/0x1440
      start_secondary+0x60/0x700
      start_ap+0x750/0x780
    Fixed BSP b0 value from CPU 1

As I understand interrupts are not enabled yet and system has a lot of
memory.  There is little chance to sleep and switch to GFP_ATOMIC should
be a no-op.

Link: https://lkml.kernel.org/r/20210315085045.204414-1-slyfox@gentoo.org
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.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>
---
 arch/ia64/kernel/mca.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index bf2cb9294795..d96c68122eae 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -1851,7 +1851,7 @@ ia64_mca_cpu_init(void *cpu_data)
 			data = mca_bootmem();
 			first_time = 0;
 		} else
-			data = (void *)__get_free_pages(GFP_KERNEL,
+			data = (void *)__get_free_pages(GFP_ATOMIC,
 							get_order(sz));
 		if (!data)
 			panic("Could not allocate MCA memory for cpu %d\n",
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH AUTOSEL 5.4 17/19] ia64: fix format strings for err_inject
  2021-03-29 22:22 [PATCH AUTOSEL 5.4 01/19] ARM: dts: am33xx: add aliases for mmc interfaces Sasha Levin
                   ` (14 preceding siblings ...)
  2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 16/19] ia64: mca: allocate early mca with GFP_ATOMIC Sasha Levin
@ 2021-03-29 22:23 ` Sasha Levin
  2021-03-29 22:23 ` [PATCH AUTOSEL 5.4 18/19] cifs: revalidate mapping when we open files for SMB1 POSIX Sasha Levin
  2021-03-29 22:23 ` [PATCH AUTOSEL 5.4 19/19] cifs: Silently ignore unknown oplock break handle Sasha Levin
  17 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2021-03-29 22:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Sergei Trofimovich, Andrew Morton, Linus Torvalds, Sasha Levin,
	linux-ia64

From: Sergei Trofimovich <slyfox@gentoo.org>

[ Upstream commit 95d44a470a6814207d52dd6312203b0f4ef12710 ]

Fix warning with %lx / u64 mismatch:

  arch/ia64/kernel/err_inject.c: In function 'show_resources':
  arch/ia64/kernel/err_inject.c:62:22: warning:
    format '%lx' expects argument of type 'long unsigned int',
    but argument 3 has type 'u64' {aka 'long long unsigned int'}
     62 |  return sprintf(buf, "%lx", name[cpu]);   \
        |                      ^~~~~~~

Link: https://lkml.kernel.org/r/20210313104312.1548232-1-slyfox@gentoo.org
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.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>
---
 arch/ia64/kernel/err_inject.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c
index 8b5b8e6bc9d9..dd5bfed52031 100644
--- a/arch/ia64/kernel/err_inject.c
+++ b/arch/ia64/kernel/err_inject.c
@@ -59,7 +59,7 @@ show_##name(struct device *dev, struct device_attribute *attr,	\
 		char *buf)						\
 {									\
 	u32 cpu=dev->id;						\
-	return sprintf(buf, "%lx\n", name[cpu]);			\
+	return sprintf(buf, "%llx\n", name[cpu]);			\
 }
 
 #define store(name)							\
@@ -86,9 +86,9 @@ store_call_start(struct device *dev, struct device_attribute *attr,
 
 #ifdef ERR_INJ_DEBUG
 	printk(KERN_DEBUG "pal_mc_err_inject for cpu%d:\n", cpu);
-	printk(KERN_DEBUG "err_type_info=%lx,\n", err_type_info[cpu]);
-	printk(KERN_DEBUG "err_struct_info=%lx,\n", err_struct_info[cpu]);
-	printk(KERN_DEBUG "err_data_buffer=%lx, %lx, %lx.\n",
+	printk(KERN_DEBUG "err_type_info=%llx,\n", err_type_info[cpu]);
+	printk(KERN_DEBUG "err_struct_info=%llx,\n", err_struct_info[cpu]);
+	printk(KERN_DEBUG "err_data_buffer=%llx, %llx, %llx.\n",
 			  err_data_buffer[cpu].data1,
 			  err_data_buffer[cpu].data2,
 			  err_data_buffer[cpu].data3);
@@ -117,8 +117,8 @@ store_call_start(struct device *dev, struct device_attribute *attr,
 
 #ifdef ERR_INJ_DEBUG
 	printk(KERN_DEBUG "Returns: status=%d,\n", (int)status[cpu]);
-	printk(KERN_DEBUG "capabilities=%lx,\n", capabilities[cpu]);
-	printk(KERN_DEBUG "resources=%lx\n", resources[cpu]);
+	printk(KERN_DEBUG "capabilities=%llx,\n", capabilities[cpu]);
+	printk(KERN_DEBUG "resources=%llx\n", resources[cpu]);
 #endif
 	return size;
 }
@@ -131,7 +131,7 @@ show_virtual_to_phys(struct device *dev, struct device_attribute *attr,
 			char *buf)
 {
 	unsigned int cpu=dev->id;
-	return sprintf(buf, "%lx\n", phys_addr[cpu]);
+	return sprintf(buf, "%llx\n", phys_addr[cpu]);
 }
 
 static ssize_t
@@ -145,7 +145,7 @@ store_virtual_to_phys(struct device *dev, struct device_attribute *attr,
 	ret = get_user_pages_fast(virt_addr, 1, FOLL_WRITE, NULL);
 	if (ret<=0) {
 #ifdef ERR_INJ_DEBUG
-		printk("Virtual address %lx is not existing.\n",virt_addr);
+		printk("Virtual address %llx is not existing.\n", virt_addr);
 #endif
 		return -EINVAL;
 	}
@@ -163,7 +163,7 @@ show_err_data_buffer(struct device *dev,
 {
 	unsigned int cpu=dev->id;
 
-	return sprintf(buf, "%lx, %lx, %lx\n",
+	return sprintf(buf, "%llx, %llx, %llx\n",
 			err_data_buffer[cpu].data1,
 			err_data_buffer[cpu].data2,
 			err_data_buffer[cpu].data3);
@@ -178,13 +178,13 @@ store_err_data_buffer(struct device *dev,
 	int ret;
 
 #ifdef ERR_INJ_DEBUG
-	printk("write err_data_buffer=[%lx,%lx,%lx] on cpu%d\n",
+	printk("write err_data_buffer=[%llx,%llx,%llx] on cpu%d\n",
 		 err_data_buffer[cpu].data1,
 		 err_data_buffer[cpu].data2,
 		 err_data_buffer[cpu].data3,
 		 cpu);
 #endif
-	ret=sscanf(buf, "%lx, %lx, %lx",
+	ret = sscanf(buf, "%llx, %llx, %llx",
 			&err_data_buffer[cpu].data1,
 			&err_data_buffer[cpu].data2,
 			&err_data_buffer[cpu].data3);
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH AUTOSEL 5.4 18/19] cifs: revalidate mapping when we open files for SMB1 POSIX
  2021-03-29 22:22 [PATCH AUTOSEL 5.4 01/19] ARM: dts: am33xx: add aliases for mmc interfaces Sasha Levin
                   ` (15 preceding siblings ...)
  2021-03-29 22:23 ` [PATCH AUTOSEL 5.4 17/19] ia64: fix format strings for err_inject Sasha Levin
@ 2021-03-29 22:23 ` Sasha Levin
  2021-03-29 22:23 ` [PATCH AUTOSEL 5.4 19/19] cifs: Silently ignore unknown oplock break handle Sasha Levin
  17 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2021-03-29 22:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Ronnie Sahlberg, Paulo Alcantara, Steve French, Sasha Levin,
	linux-cifs, samba-technical

From: Ronnie Sahlberg <lsahlber@redhat.com>

[ Upstream commit cee8f4f6fcabfdf229542926128e9874d19016d5 ]

RHBZ: 1933527

Under SMB1 + POSIX, if an inode is reused on a server after we have read and
cached a part of a file, when we then open the new file with the
re-cycled inode there is a chance that we may serve the old data out of cache
to the application.
This only happens for SMB1 (deprecated) and when posix are used.
The simplest solution to avoid this race is to force a revalidate
on smb1-posix open.

Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/cifs/file.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 31d578739341..1aac8d38f887 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -164,6 +164,7 @@ int cifs_posix_open(char *full_path, struct inode **pinode,
 			goto posix_open_ret;
 		}
 	} else {
+		cifs_revalidate_mapping(*pinode);
 		cifs_fattr_to_inode(*pinode, &fattr);
 	}
 
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH AUTOSEL 5.4 19/19] cifs: Silently ignore unknown oplock break handle
  2021-03-29 22:22 [PATCH AUTOSEL 5.4 01/19] ARM: dts: am33xx: add aliases for mmc interfaces Sasha Levin
                   ` (16 preceding siblings ...)
  2021-03-29 22:23 ` [PATCH AUTOSEL 5.4 18/19] cifs: revalidate mapping when we open files for SMB1 POSIX Sasha Levin
@ 2021-03-29 22:23 ` Sasha Levin
  17 siblings, 0 replies; 19+ messages in thread
From: Sasha Levin @ 2021-03-29 22:23 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Vincent Whitchurch, Tom Talpey, Paulo Alcantara, Steve French,
	Sasha Levin, linux-cifs, samba-technical

From: Vincent Whitchurch <vincent.whitchurch@axis.com>

[ Upstream commit 219481a8f90ec3a5eed9638fb35609e4b1aeece7 ]

Make SMB2 not print out an error when an oplock break is received for an
unknown handle, similar to SMB1.  The debug message which is printed for
these unknown handles may also be misleading, so fix that too.

The SMB2 lease break path is not affected by this patch.

Without this, a program which writes to a file from one thread, and
opens, reads, and writes the same file from another thread triggers the
below errors several times a minute when run against a Samba server
configured with "smb2 leases = no".

 CIFS: VFS: \\192.168.0.1 No task to wake, unknown frame received! NumMids 2
 00000000: 424d53fe 00000040 00000000 00000012  .SMB@...........
 00000010: 00000001 00000000 ffffffff ffffffff  ................
 00000020: 00000000 00000000 00000000 00000000  ................
 00000030: 00000000 00000000 00000000 00000000  ................

Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
Reviewed-by: Tom Talpey <tom@talpey.com>
Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/cifs/smb2misc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
index 7d875a47d022..7177720e822e 100644
--- a/fs/cifs/smb2misc.c
+++ b/fs/cifs/smb2misc.c
@@ -738,8 +738,8 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server)
 		}
 	}
 	spin_unlock(&cifs_tcp_ses_lock);
-	cifs_dbg(FYI, "Can not process oplock break for non-existent connection\n");
-	return false;
+	cifs_dbg(FYI, "No file id matched, oplock break ignored\n");
+	return true;
 }
 
 void
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2021-03-29 22:33 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29 22:22 [PATCH AUTOSEL 5.4 01/19] ARM: dts: am33xx: add aliases for mmc interfaces Sasha Levin
2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 02/19] bus: ti-sysc: Fix warning on unbind if reset is not deasserted Sasha Levin
2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 03/19] platform/x86: intel-hid: Support Lenovo ThinkPad X1 Tablet Gen 2 Sasha Levin
2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 04/19] bpf, x86: Use kvmalloc_array instead kmalloc_array in bpf_jit_comp Sasha Levin
2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 05/19] net/mlx5e: Enforce minimum value check for ICOSQ size Sasha Levin
2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 06/19] net: pxa168_eth: Fix a potential data race in pxa168_eth_remove Sasha Levin
2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 07/19] mISDN: fix crash in fritzpci Sasha Levin
2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 08/19] mac80211: fix double free in ibss_leave Sasha Levin
2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 09/19] mac80211: choose first enabled channel for monitor Sasha Levin
2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 10/19] drm/msm/adreno: a5xx_power: Don't apply A540 lm_setup to other GPUs Sasha Levin
2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 11/19] drm/msm: Ratelimit invalid-fence message Sasha Levin
2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 12/19] netfilter: conntrack: Fix gre tunneling over ipv6 Sasha Levin
2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 13/19] platform/x86: thinkpad_acpi: Allow the FnLock LED to change state Sasha Levin
2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 14/19] x86/build: Turn off -fcf-protection for realmode targets Sasha Levin
2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 15/19] scsi: target: pscsi: Clean up after failure in pscsi_map_sg() Sasha Levin
2021-03-29 22:22 ` [PATCH AUTOSEL 5.4 16/19] ia64: mca: allocate early mca with GFP_ATOMIC Sasha Levin
2021-03-29 22:23 ` [PATCH AUTOSEL 5.4 17/19] ia64: fix format strings for err_inject Sasha Levin
2021-03-29 22:23 ` [PATCH AUTOSEL 5.4 18/19] cifs: revalidate mapping when we open files for SMB1 POSIX Sasha Levin
2021-03-29 22:23 ` [PATCH AUTOSEL 5.4 19/19] cifs: Silently ignore unknown oplock break handle Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).