[PATCH 5.6 057/177] gfs2: move privileged user check to gfs2_quota_lock_check

2020-06-01 Thread Greg Kroah-Hartman
From: Bob Peterson 

[ Upstream commit 4ed0c30811cb4d30ef89850b787a53a84d5d2bcb ]

Before this patch, function gfs2_quota_lock checked if it was called
from a privileged user, and if so, it bypassed the quota check:
superuser can operate outside the quotas.
That's the wrong place for the check because the lock/unlock functions
are separate from the lock_check function, and you can do lock and
unlock without actually checking the quotas.

This patch moves the check to gfs2_quota_lock_check.

Signed-off-by: Bob Peterson 
Signed-off-by: Andreas Gruenbacher 
Signed-off-by: Sasha Levin 
---
 fs/gfs2/quota.c | 3 +--
 fs/gfs2/quota.h | 3 ++-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index e9f93045eb01..832d44782f74 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -1040,8 +1040,7 @@ int gfs2_quota_lock(struct gfs2_inode *ip, kuid_t uid, 
kgid_t gid)
u32 x;
int error = 0;
 
-   if (capable(CAP_SYS_RESOURCE) ||
-   sdp->sd_args.ar_quota != GFS2_QUOTA_ON)
+   if (sdp->sd_args.ar_quota != GFS2_QUOTA_ON)
return 0;
 
error = gfs2_quota_hold(ip, uid, gid);
diff --git a/fs/gfs2/quota.h b/fs/gfs2/quota.h
index 765627d9a91e..fe68a91dc16f 100644
--- a/fs/gfs2/quota.h
+++ b/fs/gfs2/quota.h
@@ -44,7 +44,8 @@ static inline int gfs2_quota_lock_check(struct gfs2_inode *ip,
int ret;
 
ap->allowed = UINT_MAX; /* Assume we are permitted a whole lot */
-   if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF)
+   if (capable(CAP_SYS_RESOURCE) ||
+   sdp->sd_args.ar_quota == GFS2_QUOTA_OFF)
return 0;
ret = gfs2_quota_lock(ip, NO_UID_QUOTA_CHANGE, NO_GID_QUOTA_CHANGE);
if (ret)
-- 
2.25.1





[PATCH 5.6 065/177] usb: phy: twl6030-usb: Fix a resource leak in an error handling path in twl6030_usb_probe()

2020-06-01 Thread Greg Kroah-Hartman
From: Christophe JAILLET 

[ Upstream commit f058764d19000d98aef72010468db1f69faf9fa0 ]

A call to 'regulator_get()' is hidden in 'twl6030_usb_ldo_init()'. A
corresponding put must be performed in the error handling path, as
already done in the remove function.

While at it, also move a 'free_irq()' call in the error handling path in
order to be consistent.

Reviewed-by: Dan Carpenter 
Signed-off-by: Christophe JAILLET 
Signed-off-by: Felipe Balbi 
Signed-off-by: Sasha Levin 
---
 drivers/usb/phy/phy-twl6030-usb.c | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/phy/phy-twl6030-usb.c 
b/drivers/usb/phy/phy-twl6030-usb.c
index bfebf1f2e991..9a7e655d5280 100644
--- a/drivers/usb/phy/phy-twl6030-usb.c
+++ b/drivers/usb/phy/phy-twl6030-usb.c
@@ -377,7 +377,7 @@ static int twl6030_usb_probe(struct platform_device *pdev)
if (status < 0) {
dev_err(&pdev->dev, "can't get IRQ %d, err %d\n",
twl->irq1, status);
-   return status;
+   goto err_put_regulator;
}
 
status = request_threaded_irq(twl->irq2, NULL, twl6030_usb_irq,
@@ -386,8 +386,7 @@ static int twl6030_usb_probe(struct platform_device *pdev)
if (status < 0) {
dev_err(&pdev->dev, "can't get IRQ %d, err %d\n",
twl->irq2, status);
-   free_irq(twl->irq1, twl);
-   return status;
+   goto err_free_irq1;
}
 
twl->asleep = 0;
@@ -396,6 +395,13 @@ static int twl6030_usb_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "Initialized TWL6030 USB module\n");
 
return 0;
+
+err_free_irq1:
+   free_irq(twl->irq1, twl);
+err_put_regulator:
+   regulator_put(twl->usb3v3);
+
+   return status;
 }
 
 static int twl6030_usb_remove(struct platform_device *pdev)
-- 
2.25.1





[PATCH 5.6 051/177] gpio: tegra: mask GPIO IRQs during IRQ shutdown

2020-06-01 Thread Greg Kroah-Hartman
From: Stephen Warren 

[ Upstream commit 0cf253eed5d2bdf7bb3152457b38f39b012955f7 ]

The driver currently leaves GPIO IRQs unmasked even when the GPIO IRQ
client has released the GPIO IRQ. This allows the HW to raise IRQs, and
SW to process them, after shutdown. Fix this by masking the IRQ when it's
shut down. This is usually taken care of by the irqchip core, but since
this driver has a custom irq_shutdown implementation, it must do this
explicitly itself.

Signed-off-by: Stephen Warren 
Link: https://lore.kernel.org/r/20200427232605.11608-1-swar...@wwwdotorg.org
Signed-off-by: Linus Walleij 
Signed-off-by: Sasha Levin 
---
 drivers/gpio/gpio-tegra.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index acb99eff9939..86568154cdb3 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -368,6 +368,7 @@ static void tegra_gpio_irq_shutdown(struct irq_data *d)
struct tegra_gpio_info *tgi = bank->tgi;
unsigned int gpio = d->hwirq;
 
+   tegra_gpio_irq_mask(d);
gpiochip_unlock_as_irq(&tgi->gc, gpio);
 }
 
-- 
2.25.1





[PATCH 5.6 061/177] drm/amd/powerplay: perform PG ungate prior to CG ungate

2020-06-01 Thread Greg Kroah-Hartman
From: Evan Quan 

[ Upstream commit f4fcfa4282c1a1bf51475ebb0ffda623eebf1191 ]

Since gfxoff should be disabled first before trying to access those
GC registers.

Signed-off-by: Evan Quan 
Reviewed-by: Alex Deucher 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 6 +++---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c| 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c 
b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index e4e5a53b2b4e..8e2acb4df860 100644
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
@@ -319,12 +319,12 @@ static void pp_dpm_en_umd_pstate(struct pp_hwmgr  *hwmgr,
if (*level & profile_mode_mask) {
hwmgr->saved_dpm_level = hwmgr->dpm_level;
hwmgr->en_umd_pstate = true;
-   amdgpu_device_ip_set_clockgating_state(hwmgr->adev,
-   AMD_IP_BLOCK_TYPE_GFX,
-   AMD_CG_STATE_UNGATE);
amdgpu_device_ip_set_powergating_state(hwmgr->adev,
AMD_IP_BLOCK_TYPE_GFX,
AMD_PG_STATE_UNGATE);
+   amdgpu_device_ip_set_clockgating_state(hwmgr->adev,
+   AMD_IP_BLOCK_TYPE_GFX,
+   AMD_CG_STATE_UNGATE);
}
} else {
/* exit umd pstate, restore level, enable gfx cg*/
diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c 
b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 96e81c7bc266..e2565967db07 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -1675,12 +1675,12 @@ static int smu_enable_umd_pstate(void *handle,
if (*level & profile_mode_mask) {
smu_dpm_ctx->saved_dpm_level = smu_dpm_ctx->dpm_level;
smu_dpm_ctx->enable_umd_pstate = true;
-   amdgpu_device_ip_set_clockgating_state(smu->adev,
-  
AMD_IP_BLOCK_TYPE_GFX,
-  
AMD_CG_STATE_UNGATE);
amdgpu_device_ip_set_powergating_state(smu->adev,
   
AMD_IP_BLOCK_TYPE_GFX,
   
AMD_PG_STATE_UNGATE);
+   amdgpu_device_ip_set_clockgating_state(smu->adev,
+  
AMD_IP_BLOCK_TYPE_GFX,
+  
AMD_CG_STATE_UNGATE);
}
} else {
/* exit umd pstate, restore level, enable gfx cg*/
-- 
2.25.1





[PATCH 5.6 062/177] drm/amdgpu: Use GEM obj reference for KFD BOs

2020-06-01 Thread Greg Kroah-Hartman
From: Felix Kuehling 

[ Upstream commit 39b3128d7ffd44e400e581e6f49e88cb42bef9a1 ]

Releasing the AMDGPU BO ref directly leads to problems when BOs were
exported as DMA bufs. Releasing the GEM reference makes sure that the
AMDGPU/TTM BO is not freed too early.

Also take a GEM reference when importing BOs from DMABufs to keep
references to imported BOs balances properly.

Signed-off-by: Felix Kuehling 
Tested-by: Alex Sierra 
Acked-by: Christian König 
Reviewed-by: Alex Sierra 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index fa8ac9d19a7a..6326c1792270 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -1304,7 +1304,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu(
}
 
/* Free the BO*/
-   amdgpu_bo_unref(&mem->bo);
+   drm_gem_object_put_unlocked(&mem->bo->tbo.base);
mutex_destroy(&mem->lock);
kfree(mem);
 
@@ -1647,7 +1647,8 @@ int amdgpu_amdkfd_gpuvm_import_dmabuf(struct kgd_dev *kgd,
 ALLOC_MEM_FLAGS_VRAM : ALLOC_MEM_FLAGS_GTT) |
ALLOC_MEM_FLAGS_WRITABLE | ALLOC_MEM_FLAGS_EXECUTABLE;
 
-   (*mem)->bo = amdgpu_bo_ref(bo);
+   drm_gem_object_get(&bo->tbo.base);
+   (*mem)->bo = bo;
(*mem)->va = va;
(*mem)->domain = (bo->preferred_domains & AMDGPU_GEM_DOMAIN_VRAM) ?
AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT;
-- 
2.25.1





[PATCH 5.6 050/177] ARM: dts: rockchip: fix pinctrl sub nodename for spi in rk322x.dtsi

2020-06-01 Thread Greg Kroah-Hartman
From: Johan Jonker 

[ Upstream commit 855bdca1781c79eb661f89c8944c4a719ce720e8 ]

A test with the command below gives these errors:

arch/arm/boot/dts/rk3229-evb.dt.yaml: spi-0:
'#address-cells' is a required property
arch/arm/boot/dts/rk3229-evb.dt.yaml: spi-1:
'#address-cells' is a required property
arch/arm/boot/dts/rk3229-xms6.dt.yaml: spi-0:
'#address-cells' is a required property
arch/arm/boot/dts/rk3229-xms6.dt.yaml: spi-1:
'#address-cells' is a required property

The $nodename pattern for spi nodes is
"^spi(@.*|-[0-9a-f])*$". To prevent warnings rename
'spi-0' and 'spi-1' pinctrl sub nodenames to
'spi0' and 'spi1' in 'rk322x.dtsi'.

make ARCH=arm dtbs_check
DT_SCHEMA_FILES=Documentation/devicetree/bindings/spi/spi-controller.yaml

Signed-off-by: Johan Jonker 
Link: https://lore.kernel.org/r/20200424123923.8192-1-jbx6...@gmail.com
Signed-off-by: Heiko Stuebner 
Signed-off-by: Sasha Levin 
---
 arch/arm/boot/dts/rk322x.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/rk322x.dtsi b/arch/arm/boot/dts/rk322x.dtsi
index 729119952c68..a83f65486ad4 100644
--- a/arch/arm/boot/dts/rk322x.dtsi
+++ b/arch/arm/boot/dts/rk322x.dtsi
@@ -1033,7 +1033,7 @@
};
};
 
-   spi-0 {
+   spi0 {
spi0_clk: spi0-clk {
rockchip,pins = <0 RK_PB1 2 &pcfg_pull_up>;
};
@@ -1051,7 +1051,7 @@
};
};
 
-   spi-1 {
+   spi1 {
spi1_clk: spi1-clk {
rockchip,pins = <0 RK_PC7 2 &pcfg_pull_up>;
};
-- 
2.25.1





[PATCH 5.6 069/177] IB/i40iw: Remove bogus call to netdev_master_upper_dev_get()

2020-06-01 Thread Greg Kroah-Hartman
From: Denis V. Lunev 

[ Upstream commit 856ec7f64688387b100b7083cdf480ce3ac41227 ]

Local variable netdev is not used in these calls.

It should be noted, that this change is required to work in bonded mode.
Otherwise we would get the following assert:

 "RTNL: assertion failed at net/core/dev.c (5665)"

With the calltrace as follows:
dump_stack+0x19/0x1b
netdev_master_upper_dev_get+0x61/0x70
i40iw_addr_resolve_neigh+0x1e8/0x220
i40iw_make_cm_node+0x296/0x700
? i40iw_find_listener.isra.10+0xcc/0x110
i40iw_receive_ilq+0x3d4/0x810
i40iw_puda_poll_completion+0x341/0x420
i40iw_process_ceq+0xa5/0x280
i40iw_ceq_dpc+0x1e/0x40
tasklet_action+0x83/0x140
__do_softirq+0x125/0x2bb
call_softirq+0x1c/0x30
do_softirq+0x65/0xa0
irq_exit+0x105/0x110
do_IRQ+0x56/0xf0
common_interrupt+0x16a/0x16a
? cpuidle_enter_state+0x57/0xd0
cpuidle_idle_call+0xde/0x230
arch_cpu_idle+0xe/0xc0
cpu_startup_entry+0x14a/0x1e0
start_secondary+0x1f7/0x270
start_cpu+0x5/0x14

Link: https://lore.kernel.org/r/20200428131511.11049-1-...@openvz.org
Signed-off-by: Denis V. Lunev 
Acked-by: Shiraz Saleem 
Signed-off-by: Jason Gunthorpe 
Signed-off-by: Sasha Levin 
---
 drivers/infiniband/hw/i40iw/i40iw_cm.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/infiniband/hw/i40iw/i40iw_cm.c 
b/drivers/infiniband/hw/i40iw/i40iw_cm.c
index bb78d3280acc..fa7a5ff498c7 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_cm.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_cm.c
@@ -1987,7 +1987,6 @@ static int i40iw_addr_resolve_neigh(struct i40iw_device 
*iwdev,
struct rtable *rt;
struct neighbour *neigh;
int rc = arpindex;
-   struct net_device *netdev = iwdev->netdev;
__be32 dst_ipaddr = htonl(dst_ip);
__be32 src_ipaddr = htonl(src_ip);
 
@@ -1997,9 +1996,6 @@ static int i40iw_addr_resolve_neigh(struct i40iw_device 
*iwdev,
return rc;
}
 
-   if (netif_is_bond_slave(netdev))
-   netdev = netdev_master_upper_dev_get(netdev);
-
neigh = dst_neigh_lookup(&rt->dst, &dst_ipaddr);
 
rcu_read_lock();
@@ -2065,7 +2061,6 @@ static int i40iw_addr_resolve_neigh_ipv6(struct 
i40iw_device *iwdev,
 {
struct neighbour *neigh;
int rc = arpindex;
-   struct net_device *netdev = iwdev->netdev;
struct dst_entry *dst;
struct sockaddr_in6 dst_addr;
struct sockaddr_in6 src_addr;
@@ -2086,9 +2081,6 @@ static int i40iw_addr_resolve_neigh_ipv6(struct 
i40iw_device *iwdev,
return rc;
}
 
-   if (netif_is_bond_slave(netdev))
-   netdev = netdev_master_upper_dev_get(netdev);
-
neigh = dst_neigh_lookup(dst, dst_addr.sin6_addr.in6_u.u6_addr32);
 
rcu_read_lock();
-- 
2.25.1





[PATCH 5.6 068/177] drm/amd/amdgpu: Update update_config() logic

2020-06-01 Thread Greg Kroah-Hartman
From: Leo (Hanghong) Ma 

[ Upstream commit 650e723cecf2738dee828564396f3239829aba83 ]

[Why]
For MST case: when update_config is called to disable a stream,
this clears the settings for all the streams on that link.
We should only clear the settings for the stream that was disabled.

[How]
Clear the settings after the call to remove display is called.

Reviewed-by: Harry Wentland 
Reviewed-by: Bhawanpreet Lakha 
Signed-off-by: Leo (Hanghong) Ma 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
index 3abeff7722e3..e80371542622 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
@@ -316,15 +316,15 @@ static void update_config(void *handle, struct 
cp_psp_stream_config *config)
struct mod_hdcp_display *display = &hdcp_work[link_index].display;
struct mod_hdcp_link *link = &hdcp_work[link_index].link;
 
-   memset(display, 0, sizeof(*display));
-   memset(link, 0, sizeof(*link));
-
-   display->index = aconnector->base.index;
-
if (config->dpms_off) {
hdcp_remove_display(hdcp_work, link_index, aconnector);
return;
}
+
+   memset(display, 0, sizeof(*display));
+   memset(link, 0, sizeof(*link));
+
+   display->index = aconnector->base.index;
display->state = MOD_HDCP_DISPLAY_ACTIVE;
 
if (aconnector->dc_sink != NULL)
-- 
2.25.1





[PATCH 5.6 055/177] net: microchip: encx24j600: add missed kthread_stop

2020-06-01 Thread Greg Kroah-Hartman
From: Chuhong Yuan 

[ Upstream commit ff8ce319e9c25e920d994cc35236f0bb32dfc8f3 ]

This driver calls kthread_run() in probe, but forgets to call
kthread_stop() in probe failure and remove.
Add the missed kthread_stop() to fix it.

Signed-off-by: Chuhong Yuan 
Signed-off-by: David S. Miller 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/microchip/encx24j600.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/microchip/encx24j600.c 
b/drivers/net/ethernet/microchip/encx24j600.c
index 39925e4bf2ec..b25a13da900a 100644
--- a/drivers/net/ethernet/microchip/encx24j600.c
+++ b/drivers/net/ethernet/microchip/encx24j600.c
@@ -1070,7 +1070,7 @@ static int encx24j600_spi_probe(struct spi_device *spi)
if (unlikely(ret)) {
netif_err(priv, probe, ndev, "Error %d initializing card 
encx24j600 card\n",
  ret);
-   goto out_free;
+   goto out_stop;
}
 
eidled = encx24j600_read_reg(priv, EIDLED);
@@ -1088,6 +1088,8 @@ static int encx24j600_spi_probe(struct spi_device *spi)
 
 out_unregister:
unregister_netdev(priv->ndev);
+out_stop:
+   kthread_stop(priv->kworker_task);
 out_free:
free_netdev(ndev);
 
@@ -1100,6 +1102,7 @@ static int encx24j600_spi_remove(struct spi_device *spi)
struct encx24j600_priv *priv = dev_get_drvdata(&spi->dev);
 
unregister_netdev(priv->ndev);
+   kthread_stop(priv->kworker_task);
 
free_netdev(priv->ndev);
 
-- 
2.25.1





[PATCH 5.6 056/177] kselftests: dmabuf-heaps: Fix confused return value on expected error testing

2020-06-01 Thread Greg Kroah-Hartman
From: John Stultz 

[ Upstream commit 4bb9d46d47b105a774f9dca642f5271375bca4b2 ]

When I added the expected error testing, I forgot I need to set
the return to zero when we successfully see an error.

Without this change we only end up testing a single heap
before the test quits.

Cc: Shuah Khan 
Cc: Sumit Semwal 
Cc: Benjamin Gaignard 
Cc: Brian Starkey 
Cc: Laura Abbott 
Cc: "Andrew F. Davis" 
Cc: linux-kselft...@vger.kernel.org
Signed-off-by: John Stultz 
Signed-off-by: Shuah Khan 
Signed-off-by: Sasha Levin 
---
 tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c 
b/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c
index cd5e1f602ac9..909da9cdda97 100644
--- a/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c
+++ b/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c
@@ -351,6 +351,7 @@ static int test_alloc_errors(char *heap_name)
}
 
printf("Expected error checking passed\n");
+   ret = 0;
 out:
if (dmabuf_fd >= 0)
close(dmabuf_fd);
-- 
2.25.1





[PATCH 5.6 007/177] net: ethernet: ti: cpsw: fix ASSERT_RTNL() warning during suspend

2020-06-01 Thread Greg Kroah-Hartman
From: Grygorii Strashko 

[ Upstream commit 4c64b83d03f4aafcdf710caad994cbc855802e74 ]

vlan_for_each() are required to be called with rtnl_lock taken, otherwise
ASSERT_RTNL() warning will be triggered - which happens now during System
resume from suspend:
  cpsw_suspend()
  |- cpsw_ndo_stop()
|- __hw_addr_ref_unsync_dev()
  |- cpsw_purge_all_mc()
 |- vlan_for_each()
|- ASSERT_RTNL();

Hence, fix it by surrounding cpsw_ndo_stop() by rtnl_lock/unlock() calls.

Fixes: 15180eca569b ("net: ethernet: ti: cpsw: fix vlan mcast")
Signed-off-by: Grygorii Strashko 
Signed-off-by: David S. Miller 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/net/ethernet/ti/cpsw.c |4 
 1 file changed, 4 insertions(+)

--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1752,11 +1752,15 @@ static int cpsw_suspend(struct device *d
struct cpsw_common *cpsw = dev_get_drvdata(dev);
int i;
 
+   rtnl_lock();
+
for (i = 0; i < cpsw->data.slaves; i++)
if (cpsw->slaves[i].ndev)
if (netif_running(cpsw->slaves[i].ndev))
cpsw_ndo_stop(cpsw->slaves[i].ndev);
 
+   rtnl_unlock();
+
/* Select sleep pin state */
pinctrl_pm_select_sleep_state(dev);
 




[PATCH 5.6 049/177] ARM: dts: rockchip: swap clock-names of gpu nodes

2020-06-01 Thread Greg Kroah-Hartman
From: Johan Jonker 

[ Upstream commit b14f3898d2c25a9b47a61fb879d0b1f3af92c59b ]

Dts files with Rockchip 'gpu' nodes were manually verified.
In order to automate this process arm,mali-utgard.txt
has been converted to yaml. In the new setup dtbs_check with
arm,mali-utgard.yaml expects clock-names values
in the same order, so fix that.

Signed-off-by: Johan Jonker 
Link: https://lore.kernel.org/r/20200425192500.1808-1-jbx6...@gmail.com
Signed-off-by: Heiko Stuebner 
Signed-off-by: Sasha Levin 
---
 arch/arm/boot/dts/rk3036.dtsi | 2 +-
 arch/arm/boot/dts/rk322x.dtsi | 2 +-
 arch/arm/boot/dts/rk3xxx.dtsi | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/rk3036.dtsi b/arch/arm/boot/dts/rk3036.dtsi
index cf36e25195b4..8c4b8f56c9e0 100644
--- a/arch/arm/boot/dts/rk3036.dtsi
+++ b/arch/arm/boot/dts/rk3036.dtsi
@@ -128,7 +128,7 @@
assigned-clocks = <&cru SCLK_GPU>;
assigned-clock-rates = <1>;
clocks = <&cru SCLK_GPU>, <&cru SCLK_GPU>;
-   clock-names = "core", "bus";
+   clock-names = "bus", "core";
resets = <&cru SRST_GPU>;
status = "disabled";
};
diff --git a/arch/arm/boot/dts/rk322x.dtsi b/arch/arm/boot/dts/rk322x.dtsi
index 4e90efdc9630..729119952c68 100644
--- a/arch/arm/boot/dts/rk322x.dtsi
+++ b/arch/arm/boot/dts/rk322x.dtsi
@@ -561,7 +561,7 @@
  "pp1",
  "ppmmu1";
clocks = <&cru ACLK_GPU>, <&cru ACLK_GPU>;
-   clock-names = "core", "bus";
+   clock-names = "bus", "core";
resets = <&cru SRST_GPU_A>;
status = "disabled";
};
diff --git a/arch/arm/boot/dts/rk3xxx.dtsi b/arch/arm/boot/dts/rk3xxx.dtsi
index 241f43e29c77..bb5ff10b9110 100644
--- a/arch/arm/boot/dts/rk3xxx.dtsi
+++ b/arch/arm/boot/dts/rk3xxx.dtsi
@@ -84,7 +84,7 @@
compatible = "arm,mali-400";
reg = <0x1009 0x1>;
clocks = <&cru ACLK_GPU>, <&cru ACLK_GPU>;
-   clock-names = "core", "bus";
+   clock-names = "bus", "core";
assigned-clocks = <&cru ACLK_GPU>;
assigned-clock-rates = <1>;
resets = <&cru SRST_GPU>;
-- 
2.25.1





[PATCH 5.6 066/177] usb: gadget: legacy: fix redundant initialization warnings

2020-06-01 Thread Greg Kroah-Hartman
From: Masahiro Yamada 

[ Upstream commit d13cce757954fa663c69845611957396843ed87a ]

Fix the following cppcheck warnings:

drivers/usb/gadget/legacy/inode.c:1364:8: style: Redundant initialization for 
'value'. The initialized value is overwritten$
 value = -EOPNOTSUPP;
   ^
drivers/usb/gadget/legacy/inode.c:1331:15: note: value is initialized
 intvalue = -EOPNOTSUPP;
  ^
drivers/usb/gadget/legacy/inode.c:1364:8: note: value is overwritten
 value = -EOPNOTSUPP;
   ^
drivers/usb/gadget/legacy/inode.c:1817:8: style: Redundant initialization for 
'value'. The initialized value is overwritten$
 value = -EINVAL;
   ^
drivers/usb/gadget/legacy/inode.c:1787:18: note: value is initialized
 ssize_t   value = len, length = len;
 ^
drivers/usb/gadget/legacy/inode.c:1817:8: note: value is overwritten
 value = -EINVAL;
   ^
Acked-by: Alan Stern 
Reported-by: kbuild test robot 
Signed-off-by: Masahiro Yamada 
Signed-off-by: Felipe Balbi 

Signed-off-by: Sasha Levin 
---
 drivers/usb/gadget/legacy/inode.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/legacy/inode.c 
b/drivers/usb/gadget/legacy/inode.c
index b47938dff1a2..238f555fe494 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -1361,7 +1361,6 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct 
usb_ctrlrequest *ctrl)
 
req->buf = dev->rbuf;
req->context = NULL;
-   value = -EOPNOTSUPP;
switch (ctrl->bRequest) {
 
case USB_REQ_GET_DESCRIPTOR:
@@ -1784,7 +1783,7 @@ static ssize_t
 dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
 {
struct dev_data *dev = fd->private_data;
-   ssize_t value = len, length = len;
+   ssize_t value, length = len;
unsignedtotal;
u32 tag;
char*kbuf;
-- 
2.25.1





[PATCH 5.6 041/177] net: sgi: ioc3-eth: Fix return value check in ioc3eth_probe()

2020-06-01 Thread Greg Kroah-Hartman
From: Tang Bin 

commit a7654211d0ffeaa8eb0545ea00f8445242cbce05 upstream.

In the function devm_platform_ioremap_resource(), if get resource
failed, the return value is ERR_PTR() not NULL. Thus it must be
replaced by IS_ERR(), or else it may result in crashes if a critical
error path is encountered.

Fixes: 0ce5ebd24d25 ("mfd: ioc3: Add driver for SGI IOC3 chip")
Signed-off-by: Zhang Shengju 
Signed-off-by: Tang Bin 
Signed-off-by: David S. Miller 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/ethernet/sgi/ioc3-eth.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/drivers/net/ethernet/sgi/ioc3-eth.c
+++ b/drivers/net/ethernet/sgi/ioc3-eth.c
@@ -865,14 +865,14 @@ static int ioc3eth_probe(struct platform
ip = netdev_priv(dev);
ip->dma_dev = pdev->dev.parent;
ip->regs = devm_platform_ioremap_resource(pdev, 0);
-   if (!ip->regs) {
-   err = -ENOMEM;
+   if (IS_ERR(ip->regs)) {
+   err = PTR_ERR(ip->regs);
goto out_free;
}
 
ip->ssram = devm_platform_ioremap_resource(pdev, 1);
-   if (!ip->ssram) {
-   err = -ENOMEM;
+   if (IS_ERR(ip->ssram)) {
+   err = PTR_ERR(ip->ssram);
goto out_free;
}
 




[PATCH 5.6 067/177] net: freescale: select CONFIG_FIXED_PHY where needed

2020-06-01 Thread Greg Kroah-Hartman
From: Arnd Bergmann 

[ Upstream commit 99352c79af3e5f2e4724abf37fa5a2a3299b1c81 ]

I ran into a randconfig build failure with CONFIG_FIXED_PHY=m
and CONFIG_GIANFAR=y:

x86_64-linux-ld: drivers/net/ethernet/freescale/gianfar.o:(.rodata+0x418): 
undefined reference to `fixed_phy_change_carrier'

It seems the same thing can happen with dpaa and ucc_geth, so change
all three to do an explicit 'select FIXED_PHY'.

The fixed-phy driver actually has an alternative stub function that
theoretically allows building network drivers when fixed-phy is
disabled, but I don't see how that would help here, as the drivers
presumably would not work then.

Signed-off-by: Arnd Bergmann 
Acked-by: Florian Fainelli 
Signed-off-by: Jakub Kicinski 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/freescale/Kconfig  | 2 ++
 drivers/net/ethernet/freescale/dpaa/Kconfig | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/freescale/Kconfig 
b/drivers/net/ethernet/freescale/Kconfig
index 2bd7ace0a953..bfc6bfe94d0a 100644
--- a/drivers/net/ethernet/freescale/Kconfig
+++ b/drivers/net/ethernet/freescale/Kconfig
@@ -77,6 +77,7 @@ config UCC_GETH
depends on QUICC_ENGINE && PPC32
select FSL_PQ_MDIO
select PHYLIB
+   select FIXED_PHY
---help---
  This driver supports the Gigabit Ethernet mode of the QUICC Engine,
  which is available on some Freescale SOCs.
@@ -90,6 +91,7 @@ config GIANFAR
depends on HAS_DMA
select FSL_PQ_MDIO
select PHYLIB
+   select FIXED_PHY
select CRC32
---help---
  This driver supports the Gigabit TSEC on the MPC83xx, MPC85xx,
diff --git a/drivers/net/ethernet/freescale/dpaa/Kconfig 
b/drivers/net/ethernet/freescale/dpaa/Kconfig
index 3b325733a4f8..0a54c7e0e4ae 100644
--- a/drivers/net/ethernet/freescale/dpaa/Kconfig
+++ b/drivers/net/ethernet/freescale/dpaa/Kconfig
@@ -3,6 +3,7 @@ menuconfig FSL_DPAA_ETH
tristate "DPAA Ethernet"
depends on FSL_DPAA && FSL_FMAN
select PHYLIB
+   select FIXED_PHY
select FSL_FMAN_MAC
---help---
  Data Path Acceleration Architecture Ethernet driver,
-- 
2.25.1





[PATCH 5.6 000/177] 5.6.16-rc1 review

2020-06-01 Thread Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.6.16 release.
There are 177 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Wed, 03 Jun 2020 17:38:19 +.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:

https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.6.16-rc1.gz
or in the git tree and branch at:

git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
linux-5.6.y
and the diffstat can be found below.

thanks,

greg k-h

-
Pseudo-Shortlog of commits:

Greg Kroah-Hartman 
Linux 5.6.16-rc1

Pablo Neira Ayuso 
netfilter: nf_conntrack_pptp: fix compilation warning with W=1 build

Nathan Chancellor 
netfilter: conntrack: Pass value of ctinfo to __nf_conntrack_update

Pablo Neira Ayuso 
netfilter: conntrack: comparison of unsigned in cthelper confirmation

Dmitry Torokhov 
Revert "Input: i8042 - add ThinkPad S230u to i8042 nomux list"

Petr Mladek 
powerpc/bpf: Enable bpf_probe_read{, str}() on powerpc again

Qiushi Wu 
bonding: Fix reference count leak in bond_sysfs_slave_add.

Vladimir Oltean 
net: dsa: declare lockless TX feature for slave ports

David Ahern 
ipv4: nexthop version of fib_info_nh_uses_dev

David Ahern 
nexthop: Expand nexthop_is_multipath in a few places

Nikolay Aleksandrov 
nexthops: don't modify published nexthop groups

David Ahern 
nexthops: Move code from remove_nexthop_from_groups to remove_nh_grp_entry

Eric Dumazet 
crypto: chelsio/chtls: properly set tp->lsndtime

Qiushi Wu 
qlcnic: fix missing release in qlcnic_83xx_interrupt_test.

Björn Töpel 
xsk: Add overflow check for u64 division, stored into u32

Jay Lang 
x86/ioperm: Prevent a memory leak when fork fails

Pradeep Kumar Chitrapu 
ieee80211: Fix incorrect mask for default PE duration

Edwin Peer 
bnxt_en: fix firmware message length endianness

Michael Chan 
bnxt_en: Fix accumulation of bp->net_stats_prev.

Xin Long 
esp6: get the right proto for transport mode in esp6_gso_encap

Pablo Neira Ayuso 
netfilter: nf_conntrack_pptp: prevent buffer overflows in debug code

Pablo Neira Ayuso 
netfilter: nfnetlink_cthelper: unbreak userspace helper support

Pablo Neira Ayuso 
netfilter: conntrack: make conntrack userspace helpers work again

Phil Sutter 
netfilter: ipset: Fix subcounter update skip

Michael Braun 
netfilter: nft_reject_bridge: enable reject with bridge vlan

Xin Long 
ip_vti: receive ipip packet by calling ip_tunnel_rcv

Antony Antony 
xfrm: fix error in comment

Xin Long 
xfrm: fix a NULL-ptr deref in xfrm_local_error

Xin Long 
xfrm: fix a warning in xfrm_policy_insert_list

Nicolas Dichtel 
xfrm interface: fix oops when deleting a x-netns interface

Xin Long 
xfrm: call xfrm_output_gso when inner_protocol is set in xfrm_output

Sabrina Dubroca 
xfrm: espintcp: save and call old ->sk_destruct

Xin Long 
xfrm: remove the xfrm_state_put call becofe going to out_reset

Xin Long 
xfrm: do pskb_pull properly in __xfrm_transport_prep

Xin Long 
xfrm: allow to accept packets with ipv6 NEXTHDR_HOP in xfrm_input

Al Viro 
copy_xstate_to_kernel(): don't leave parts of destination uninitialized

Alexander Dahl 
x86/dma: Fix max PFN arithmetic overflow on 32 bit systems

Linus Lüssing 
mac80211: mesh: fix discovery timer re-arming issue / crash

Johannes Berg 
cfg80211: fix debugfs rename crash

Helge Deller 
parisc: Fix kernel panic in mem_init()

Qiushi Wu 
iommu: Fix reference count leak in iommu_group_alloc.

Linus Walleij 
gpio: fix locking open drain IRQ lines

Jens Axboe 
Revert "block: end bio with BLK_STS_AGAIN in case of non-mq devs and 
REQ_NOWAIT"

Arnd Bergmann 
include/asm-generic/topology.h: guard cpumask_of_node() macro argument

Alexander Potapenko 
fs/binfmt_elf.c: allocate initialized memory in fill_thread_core_info()

Konstantin Khlebnikov 
mm: remove VM_BUG_ON(PageSlab()) from page_mapcount()

Hugh Dickins 
mm,thp: stop leaking unreleased file pages

Valentine Fatiev 
IB/ipoib: Fix double free of skb in case of multicast traffic in CM mode

Aric Cyr 
drm/amd/display: Fix potential integer wraparound resulting in a hang

Nicholas Kazlauskas 
drm/amd/display: Defer cursor lock until after VUPDATE

Aric Cyr 
drm/amd/display: Use cursor locking to prevent flip delays

Anthony Koo 
drm/amd/display: Added locking for atomic update stream and update planes

Anthony Koo 
drm/amd/display: Indicate dsc updates explicitly

Anthony Koo 
drm/amd/display: Split program front end part that occur outside lock

Simon Ser 
drm/amd/display: drop cursor position check in atomic test

Jason Gunthorpe 
RDMA/core: Fix double destruction of uobject

Jeff Layton

[PATCH 5.6 094/177] ARM: uaccess: consolidate uaccess asm to asm/uaccess-asm.h

2020-06-01 Thread Greg Kroah-Hartman
From: Russell King 

[ Upstream commit 747ffc2fcf969eff9309d7f2d1d61cb8b9e1bb40 ]

Consolidate the user access assembly code to asm/uaccess-asm.h.  This
moves the csdb, check_uaccess, uaccess_mask_range_ptr, uaccess_enable,
uaccess_disable, uaccess_save, uaccess_restore macros, and creates two
new ones for exception entry and exit - uaccess_entry and uaccess_exit.

This makes the uaccess_save and uaccess_restore macros private to
asm/uaccess-asm.h.

Signed-off-by: Russell King 
Signed-off-by: Sasha Levin 
---
 arch/arm/include/asm/assembler.h   |  75 +---
 arch/arm/include/asm/uaccess-asm.h | 106 +
 arch/arm/kernel/entry-armv.S   |  11 +--
 arch/arm/kernel/entry-header.S |   9 +--
 4 files changed, 112 insertions(+), 89 deletions(-)
 create mode 100644 arch/arm/include/asm/uaccess-asm.h

diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index 99929122dad7..3546d294d55f 100644
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -18,11 +18,11 @@
 #endif
 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #define IOMEM(x)   (x)
 
@@ -446,79 +446,6 @@ THUMB( orr \reg , \reg , #PSR_T_BIT)
.size \name , . - \name
.endm
 
-   .macro  csdb
-#ifdef CONFIG_THUMB2_KERNEL
-   .inst.w 0xf3af8014
-#else
-   .inst   0xe320f014
-#endif
-   .endm
-
-   .macro check_uaccess, addr:req, size:req, limit:req, tmp:req, bad:req
-#ifndef CONFIG_CPU_USE_DOMAINS
-   adds\tmp, \addr, #\size - 1
-   sbcscc  \tmp, \tmp, \limit
-   bcs \bad
-#ifdef CONFIG_CPU_SPECTRE
-   movcs   \addr, #0
-   csdb
-#endif
-#endif
-   .endm
-
-   .macro uaccess_mask_range_ptr, addr:req, size:req, limit:req, tmp:req
-#ifdef CONFIG_CPU_SPECTRE
-   sub \tmp, \limit, #1
-   subs\tmp, \tmp, \addr   @ tmp = limit - 1 - addr
-   addhs   \tmp, \tmp, #1  @ if (tmp >= 0) {
-   subshs  \tmp, \tmp, \size   @ tmp = limit - (addr + size) }
-   movlo   \addr, #0   @ if (tmp < 0) addr = NULL
-   csdb
-#endif
-   .endm
-
-   .macro  uaccess_disable, tmp, isb=1
-#ifdef CONFIG_CPU_SW_DOMAIN_PAN
-   /*
-* Whenever we re-enter userspace, the domains should always be
-* set appropriately.
-*/
-   mov \tmp, #DACR_UACCESS_DISABLE
-   mcr p15, 0, \tmp, c3, c0, 0 @ Set domain register
-   .if \isb
-   instr_sync
-   .endif
-#endif
-   .endm
-
-   .macro  uaccess_enable, tmp, isb=1
-#ifdef CONFIG_CPU_SW_DOMAIN_PAN
-   /*
-* Whenever we re-enter userspace, the domains should always be
-* set appropriately.
-*/
-   mov \tmp, #DACR_UACCESS_ENABLE
-   mcr p15, 0, \tmp, c3, c0, 0
-   .if \isb
-   instr_sync
-   .endif
-#endif
-   .endm
-
-   .macro  uaccess_save, tmp
-#ifdef CONFIG_CPU_SW_DOMAIN_PAN
-   mrc p15, 0, \tmp, c3, c0, 0
-   str \tmp, [sp, #SVC_DACR]
-#endif
-   .endm
-
-   .macro  uaccess_restore
-#ifdef CONFIG_CPU_SW_DOMAIN_PAN
-   ldr r0, [sp, #SVC_DACR]
-   mcr p15, 0, r0, c3, c0, 0
-#endif
-   .endm
-
.irpc,,eq,ne,cs,cc,mi,pl,vs,vc,hi,ls,ge,lt,gt,le,hs,lo
.macro  ret\c, reg
 #if __LINUX_ARM_ARCH__ < 6
diff --git a/arch/arm/include/asm/uaccess-asm.h 
b/arch/arm/include/asm/uaccess-asm.h
new file mode 100644
index ..d475e3e8145d
--- /dev/null
+++ b/arch/arm/include/asm/uaccess-asm.h
@@ -0,0 +1,106 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef __ASM_UACCESS_ASM_H__
+#define __ASM_UACCESS_ASM_H__
+
+#include 
+#include 
+#include 
+#include 
+
+   .macro  csdb
+#ifdef CONFIG_THUMB2_KERNEL
+   .inst.w 0xf3af8014
+#else
+   .inst   0xe320f014
+#endif
+   .endm
+
+   .macro check_uaccess, addr:req, size:req, limit:req, tmp:req, bad:req
+#ifndef CONFIG_CPU_USE_DOMAINS
+   adds\tmp, \addr, #\size - 1
+   sbcscc  \tmp, \tmp, \limit
+   bcs \bad
+#ifdef CONFIG_CPU_SPECTRE
+   movcs   \addr, #0
+   csdb
+#endif
+#endif
+   .endm
+
+   .macro uaccess_mask_range_ptr, addr:req, size:req, limit:req, tmp:req
+#ifdef CONFIG_CPU_SPECTRE
+   sub \tmp, \limit, #1
+   subs\tmp, \tmp, \addr   @ tmp = limit - 1 - addr
+   addhs   \tmp, \tmp, #1  @ if (tmp >= 0) {
+   subshs  \tmp, \tmp, \size   @ tmp = limit - (addr + size) }
+   movlo   \addr, #0   @ if (tmp < 0) addr = NULL
+   csdb
+#endif
+   .endm
+
+   .macro  uaccess_disable, tmp, isb=1
+#ifdef CONFIG_CPU_SW_DOMAIN_PAN
+   /*
+* Whenever we re-enter userspace, the domains should always be
+* set appropriately.
+*/
+   mov \tmp, #DACR_UACCESS_DISABLE
+   mcr p15, 0, \tmp, c3, c0, 0 @ Set domain register
+   .if \isb
+   instr_syn

[PATCH 5.6 099/177] soc: mediatek: cmdq: return send msg error code

2020-06-01 Thread Greg Kroah-Hartman
From: Dennis YC Hsieh 

[ Upstream commit 34c4e4072603ff5c174df73b973896abb76cbb51 ]

Return error code to client if send message fail,
so that client has chance to error handling.

Fixes: 576f1b4bc802 ("soc: mediatek: Add Mediatek CMDQ helper")
Signed-off-by: Dennis YC Hsieh 
Reviewed-by: CK Hu 
Link: 
https://lore.kernel.org/r/1583664775-19382-6-git-send-email-dennis-yc.hs...@mediatek.com
Signed-off-by: Matthias Brugger 
Signed-off-by: Sasha Levin 
---
 drivers/soc/mediatek/mtk-cmdq-helper.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c 
b/drivers/soc/mediatek/mtk-cmdq-helper.c
index db37144ae98c..87ee9f767b7a 100644
--- a/drivers/soc/mediatek/mtk-cmdq-helper.c
+++ b/drivers/soc/mediatek/mtk-cmdq-helper.c
@@ -351,7 +351,9 @@ int cmdq_pkt_flush_async(struct cmdq_pkt *pkt, 
cmdq_async_flush_cb cb,
spin_unlock_irqrestore(&client->lock, flags);
}
 
-   mbox_send_message(client->chan, pkt);
+   err = mbox_send_message(client->chan, pkt);
+   if (err < 0)
+   return err;
/* We can send next packet immediately, so just call txdone. */
mbox_client_txdone(client->chan, 0);
 
-- 
2.25.1





[PATCH 5.6 046/177] ARM: dts: rockchip: fix phy nodename for rk3229-xms6

2020-06-01 Thread Greg Kroah-Hartman
From: Johan Jonker 

[ Upstream commit 621c8d0c233e260232278a4cfd3380caa3c1da29 ]

A test with the command below gives for example this error:

arch/arm/boot/dts/rk3229-xms6.dt.yaml: phy@0:
'#phy-cells' is a required property

The phy nodename is normally used by a phy-handle.
This node is however compatible with
"ethernet-phy-id1234.d400", "ethernet-phy-ieee802.3-c22"
which is just been added to 'ethernet-phy.yaml'.
So change nodename to 'ethernet-phy' for which '#phy-cells'
is not a required property

make ARCH=arm dtbs_check
DT_SCHEMA_FILES=~/.local/lib/python3.5/site-packages/dtschema/schemas/
phy/phy-provider.yaml

Signed-off-by: Johan Jonker 
Signed-off-by: Heiko Stuebner 
Link: https://lore.kernel.org/r/20200416170321.4216-2-jbx6...@gmail.com
Signed-off-by: Sasha Levin 
---
 arch/arm/boot/dts/rk3229-xms6.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/rk3229-xms6.dts 
b/arch/arm/boot/dts/rk3229-xms6.dts
index 679fc2b00e5a..933ef69da32a 100644
--- a/arch/arm/boot/dts/rk3229-xms6.dts
+++ b/arch/arm/boot/dts/rk3229-xms6.dts
@@ -150,7 +150,7 @@
#address-cells = <1>;
#size-cells = <0>;
 
-   phy: phy@0 {
+   phy: ethernet-phy@0 {
compatible = "ethernet-phy-id1234.d400",
 "ethernet-phy-ieee802.3-c22";
reg = <0>;
-- 
2.25.1





[PATCH 5.6 043/177] net: mscc: ocelot: fix address ageing time (again)

2020-06-01 Thread Greg Kroah-Hartman
From: Vladimir Oltean 

commit bf655ba212dfd10d1c86afeee3f3372dbd731d46 upstream.

ocelot_set_ageing_time has 2 callers:
 - felix_set_ageing_time: from drivers/net/dsa/ocelot/felix.c
 - ocelot_port_attr_ageing_set: from drivers/net/ethernet/mscc/ocelot.c

The issue described in the fixed commit below actually happened for the
felix_set_ageing_time code path only, since ocelot_port_attr_ageing_set
was already dividing by 1000. So to make both paths symmetrical (and to
fix addresses getting aged way too fast on Ocelot), stop dividing by
1000 at caller side altogether.

Fixes: c0d7eccbc761 ("net: mscc: ocelot: ANA_AUTOAGE_AGE_PERIOD holds a value 
in seconds, not ms")
Signed-off-by: Vladimir Oltean 
Signed-off-by: David S. Miller 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/ethernet/mscc/ocelot.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/ethernet/mscc/ocelot.c
+++ b/drivers/net/ethernet/mscc/ocelot.c
@@ -1460,7 +1460,7 @@ static void ocelot_port_attr_ageing_set(
unsigned long ageing_clock_t)
 {
unsigned long ageing_jiffies = clock_t_to_jiffies(ageing_clock_t);
-   u32 ageing_time = jiffies_to_msecs(ageing_jiffies) / 1000;
+   u32 ageing_time = jiffies_to_msecs(ageing_jiffies);
 
ocelot_set_ageing_time(ocelot, ageing_time);
 }




[PATCH 5.6 047/177] arm64: dts: rockchip: fix status for &gmac2phy in rk3328-evb.dts

2020-06-01 Thread Greg Kroah-Hartman
From: Johan Jonker 

[ Upstream commit c617ed88502d0b05149e7f32f3b3fd8a0663f7e2 ]

The status was removed of the '&gmac2phy' node with the apply
of a patch long time ago, so fix status for '&gmac2phy'
in 'rk3328-evb.dts'.

Signed-off-by: Johan Jonker 
Link: https://lore.kernel.org/r/20200425122345.12902-2-jbx6...@gmail.com
Signed-off-by: Heiko Stuebner 
Signed-off-by: Sasha Levin 
---
 arch/arm64/boot/dts/rockchip/rk3328-evb.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk3328-evb.dts 
b/arch/arm64/boot/dts/rockchip/rk3328-evb.dts
index 6abc6f4a86cf..05265b38cc02 100644
--- a/arch/arm64/boot/dts/rockchip/rk3328-evb.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3328-evb.dts
@@ -86,7 +86,7 @@
assigned-clock-rate = <5000>;
assigned-clocks = <&cru SCLK_MAC2PHY>;
assigned-clock-parents = <&cru SCLK_MAC2PHY_SRC>;
-
+   status = "okay";
 };
 
 &i2c1 {
-- 
2.25.1





[PATCH 5.6 076/177] csky: Fixup remove duplicate irq_disable

2020-06-01 Thread Greg Kroah-Hartman
From: Liu Yibin 

[ Upstream commit 6633a5aa8eb6bda70eb3a9837efd28a67ccc6e0a ]

Interrupt has been disabled in __schedule() with local_irq_disable()
and enabled in finish_task_switch->finish_lock_switch() with
local_irq_enabled(), So needn't to disable irq here.

Signed-off-by: Liu Yibin 
Signed-off-by: Guo Ren 
Signed-off-by: Sasha Levin 
---
 arch/csky/kernel/entry.S | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/csky/kernel/entry.S b/arch/csky/kernel/entry.S
index 007706328000..9718388448a4 100644
--- a/arch/csky/kernel/entry.S
+++ b/arch/csky/kernel/entry.S
@@ -318,8 +318,6 @@ ENTRY(__switch_to)
 
mfcra2, psr /* Save PSR value */
stw a2, (a3, THREAD_SR) /* Save PSR in task struct */
-   bclri   a2, 6   /* Disable interrupts */
-   mtcra2, psr
 
SAVE_SWITCH_STACK
 
-- 
2.25.1





[PATCH 5.6 075/177] csky: Fixup perf callchain unwind

2020-06-01 Thread Greg Kroah-Hartman
From: Mao Han 

[ Upstream commit 229a0ddee1108a3f82a873e6cbbe35c92c540444 ]

 [ 5221.974084] Unable to handle kernel paging request at virtual address 
0xf000, pc: 0x8002c18e
 [ 5221.985929] Oops: 
 [ 5221.989488]
 [ 5221.989488] CURRENT PROCESS:
 [ 5221.989488]
 [ 5221.992877] COMM=callchain_test PID=11962
 [ 5221.995213] TEXT=8000-87e0 DATA=9f1c-a018 
BSS=a018-b000
 [ 5221.999037] USER-STACK=7fc18e20  KERNEL-STACK=be204680
 [ 5221.999037]
 [ 5222.003292] PC: 0x8002c18e (perf_callchain_kernel+0x3e/0xd4)
 [ 5222.007957] LR: 0x8002c198 (perf_callchain_kernel+0x48/0xd4)
 [ 5222.074873] Call Trace:
 [ 5222.074873] [<800a248e>] get_perf_callchain+0x20a/0x29c
 [ 5222.074873] [<8009d964>] perf_callchain+0x64/0x80
 [ 5222.074873] [<8009dc1c>] perf_prepare_sample+0x29c/0x4b8
 [ 5222.074873] [<8009de6e>] perf_event_output_forward+0x36/0x98
 [ 5222.074873] [<800497e0>] search_exception_tables+0x20/0x44
 [ 5222.074873] [<8002cbb6>] do_page_fault+0x92/0x378
 [ 5222.074873] [<80098608>] __perf_event_overflow+0x54/0xdc
 [ 5222.074873] [<80098778>] perf_swevent_hrtimer+0xe8/0x164
 [ 5222.074873] [<8002ddd0>] update_mmu_cache+0x0/0xd8
 [ 5222.074873] [<8002c014>] user_backtrace+0x58/0xc4
 [ 5222.074873] [<8002c0b4>] perf_callchain_user+0x34/0xd0
 [ 5222.074873] [<800a2442>] get_perf_callchain+0x1be/0x29c
 [ 5222.074873] [<8009d964>] perf_callchain+0x64/0x80
 [ 5222.074873] [<8009d834>] perf_output_sample+0x78c/0x858
 [ 5222.074873] [<8009dc1c>] perf_prepare_sample+0x29c/0x4b8
 [ 5222.074873] [<8009de94>] perf_event_output_forward+0x5c/0x98
 [ 5222.097846]
 [ 5222.097846] [<800a0300>] perf_event_exit_task+0x58/0x43c
 [ 5222.097846] [<8006c874>] hrtimer_interrupt+0x104/0x2ec
 [ 5222.097846] [<800a0300>] perf_event_exit_task+0x58/0x43c
 [ 5222.097846] [<80437bb6>] dw_apb_clockevent_irq+0x2a/0x4c
 [ 5222.097846] [<8006c770>] hrtimer_interrupt+0x0/0x2ec
 [ 5222.097846] [<8005f2e4>] __handle_irq_event_percpu+0xac/0x19c
 [ 5222.097846] [<80437bb6>] dw_apb_clockevent_irq+0x2a/0x4c
 [ 5222.097846] [<8005f408>] handle_irq_event_percpu+0x34/0x88
 [ 5222.097846] [<8005f480>] handle_irq_event+0x24/0x64
 [ 5222.097846] [<8006218c>] handle_level_irq+0x68/0xdc
 [ 5222.097846] [<8005ec76>] __handle_domain_irq+0x56/0xa8
 [ 5222.097846] [<80450e90>] ck_irq_handler+0xac/0xe4
 [ 5222.097846] [<80029012>] csky_do_IRQ+0x12/0x24
 [ 5222.097846] [<8002a3a0>] csky_irq+0x70/0x80
 [ 5222.097846] [<800ca612>] alloc_set_pte+0xd2/0x238
 [ 5222.097846] [<8002ddd0>] update_mmu_cache+0x0/0xd8
 [ 5222.097846] [<800a0340>] perf_event_exit_task+0x98/0x43c

The original fp check doesn't base on the real kernal stack region.
Invalid fp address may cause kernel panic.

Signed-off-by: Mao Han 
Signed-off-by: Guo Ren 
Signed-off-by: Sasha Levin 
---
 arch/csky/kernel/perf_callchain.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/csky/kernel/perf_callchain.c 
b/arch/csky/kernel/perf_callchain.c
index e68ff375c8f8..ab55e98ee8f6 100644
--- a/arch/csky/kernel/perf_callchain.c
+++ b/arch/csky/kernel/perf_callchain.c
@@ -12,12 +12,17 @@ struct stackframe {
 
 static int unwind_frame_kernel(struct stackframe *frame)
 {
-   if (kstack_end((void *)frame->fp))
+   unsigned long low = (unsigned long)task_stack_page(current);
+   unsigned long high = low + THREAD_SIZE;
+
+   if (unlikely(frame->fp < low || frame->fp > high))
return -EPERM;
-   if (frame->fp & 0x3 || frame->fp < TASK_SIZE)
+
+   if (kstack_end((void *)frame->fp) || frame->fp & 0x3)
return -EPERM;
 
*frame = *(struct stackframe *)frame->fp;
+
if (__kernel_text_address(frame->lr)) {
int graph = 0;
 
-- 
2.25.1





[PATCH 5.6 070/177] riscv: Fix unmet direct dependencies built based on SOC_VIRT

2020-06-01 Thread Greg Kroah-Hartman
From: Kefeng Wang 

[ Upstream commit ab7fbad0c7d7a4f9b320a059a171a92a34b6d409 ]

Fix unmet direct dependencies Warning and fix Kconfig indent.

WARNING: unmet direct dependencies detected for POWER_RESET_SYSCON
  Depends on [n]: POWER_RESET [=n] && OF [=y] && HAS_IOMEM [=y]
  Selected by [y]:
  - SOC_VIRT [=y]

WARNING: unmet direct dependencies detected for POWER_RESET_SYSCON_POWEROFF
  Depends on [n]: POWER_RESET [=n] && OF [=y] && HAS_IOMEM [=y]
  Selected by [y]:
  - SOC_VIRT [=y]

WARNING: unmet direct dependencies detected for RTC_DRV_GOLDFISH
  Depends on [n]: RTC_CLASS [=n] && OF [=y] && HAS_IOMEM [=y] && (GOLDFISH [=y] 
|| COMPILE_TEST [=n])
  Selected by [y]:
  - SOC_VIRT [=y]

Reported-by: Hulk Robot 
Signed-off-by: Kefeng Wang 
Signed-off-by: Palmer Dabbelt 
Signed-off-by: Sasha Levin 
---
 arch/riscv/Kconfig.socs | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/arch/riscv/Kconfig.socs b/arch/riscv/Kconfig.socs
index a131174a0a77..f310ad8ffcf7 100644
--- a/arch/riscv/Kconfig.socs
+++ b/arch/riscv/Kconfig.socs
@@ -11,13 +11,14 @@ config SOC_SIFIVE
  This enables support for SiFive SoC platform hardware.
 
 config SOC_VIRT
-   bool "QEMU Virt Machine"
-   select POWER_RESET_SYSCON
-   select POWER_RESET_SYSCON_POWEROFF
-   select GOLDFISH
-   select RTC_DRV_GOLDFISH
-   select SIFIVE_PLIC
-   help
- This enables support for QEMU Virt Machine.
+   bool "QEMU Virt Machine"
+   select POWER_RESET
+   select POWER_RESET_SYSCON
+   select POWER_RESET_SYSCON_POWEROFF
+   select GOLDFISH
+   select RTC_DRV_GOLDFISH if RTC_CLASS
+   select SIFIVE_PLIC
+   help
+ This enables support for QEMU Virt Machine.
 
 endmenu
-- 
2.25.1





[PATCH 5.6 077/177] drm/meson: pm resume add return errno branch

2020-06-01 Thread Greg Kroah-Hartman
From: Bernard Zhao 

[ Upstream commit c54a8f1f329197d83d941ad84c4aa38bf282cbbd ]

pm_resump api did not handle drm_mode_config_helper_resume error.
This change add handle to return drm_mode_config_helper_resume`s
error number. This code logic is aligned with api pm_suspend.
After this change, the code maybe a bit readable.

Signed-off-by: Bernard Zhao 
Signed-off-by: Neil Armstrong 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200428131747.2099-1-bern...@vivo.com
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/meson/meson_drv.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/meson/meson_drv.c 
b/drivers/gpu/drm/meson/meson_drv.c
index b5f5eb7b4bb9..8c2e1b47e81a 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -412,9 +412,7 @@ static int __maybe_unused meson_drv_pm_resume(struct device 
*dev)
if (priv->afbcd.ops)
priv->afbcd.ops->init(priv);
 
-   drm_mode_config_helper_resume(priv->drm);
-
-   return 0;
+   return drm_mode_config_helper_resume(priv->drm);
 }
 
 static int compare_of(struct device *dev, void *data)
-- 
2.25.1





[PATCH 5.6 100/177] gpu/drm: ingenic: Fix bogus crtc_atomic_check callback

2020-06-01 Thread Greg Kroah-Hartman
From: Paul Cercueil 

[ Upstream commit a53bcc19876498bdd3b4ef796c787295dcc498b4 ]

The code was comparing the SoC's maximum height with the mode's width,
and vice-versa. D'oh.

Cc: sta...@vger.kernel.org # v5.6
Fixes: a7c909b7c037 ("gpu/drm: ingenic: Check for display size in CRTC atomic 
check")
Signed-off-by: Paul Cercueil 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20200516215057.392609-4-p...@crapouillou.net
Acked-by: Sam Ravnborg 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/ingenic/ingenic-drm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.c 
b/drivers/gpu/drm/ingenic/ingenic-drm.c
index bcba2f024842..8f5077370a52 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm.c
@@ -328,8 +328,8 @@ static int ingenic_drm_crtc_atomic_check(struct drm_crtc 
*crtc,
if (!drm_atomic_crtc_needs_modeset(state))
return 0;
 
-   if (state->mode.hdisplay > priv->soc_info->max_height ||
-   state->mode.vdisplay > priv->soc_info->max_width)
+   if (state->mode.hdisplay > priv->soc_info->max_width ||
+   state->mode.vdisplay > priv->soc_info->max_height)
return -EINVAL;
 
rate = clk_round_rate(priv->pix_clk,
-- 
2.25.1





[PATCH 5.6 045/177] ARM: dts: rockchip: fix phy nodename for rk3228-evb

2020-06-01 Thread Greg Kroah-Hartman
From: Johan Jonker 

[ Upstream commit 287e0d538fcec2f6e8eb1e565bf0749f3b90186d ]

A test with the command below gives for example this error:

arch/arm/boot/dts/rk3228-evb.dt.yaml: phy@0:
'#phy-cells' is a required property

The phy nodename is normally used by a phy-handle.
This node is however compatible with
"ethernet-phy-id1234.d400", "ethernet-phy-ieee802.3-c22"
which is just been added to 'ethernet-phy.yaml'.
So change nodename to 'ethernet-phy' for which '#phy-cells'
is not a required property

make ARCH=arm dtbs_check
DT_SCHEMA_FILES=~/.local/lib/python3.5/site-packages/dtschema/schemas/
phy/phy-provider.yaml

Signed-off-by: Johan Jonker 
Signed-off-by: Heiko Stuebner 
Link: https://lore.kernel.org/r/20200416170321.4216-1-jbx6...@gmail.com
Signed-off-by: Sasha Levin 
---
 arch/arm/boot/dts/rk3228-evb.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/rk3228-evb.dts b/arch/arm/boot/dts/rk3228-evb.dts
index 5670b33fd1bd..aed879db6c15 100644
--- a/arch/arm/boot/dts/rk3228-evb.dts
+++ b/arch/arm/boot/dts/rk3228-evb.dts
@@ -46,7 +46,7 @@
#address-cells = <1>;
#size-cells = <0>;
 
-   phy: phy@0 {
+   phy: ethernet-phy@0 {
compatible = "ethernet-phy-id1234.d400", 
"ethernet-phy-ieee802.3-c22";
reg = <0>;
clocks = <&cru SCLK_MAC_PHY>;
-- 
2.25.1





[PATCH 5.6 044/177] arm64: dts: qcom: db820c: fix audio configuration

2020-06-01 Thread Greg Kroah-Hartman
From: Srinivas Kandagatla 

[ Upstream commit 7710f80ecd9c74544a22557ab581cf603e713f51 ]

After patch f864edff110d ("ASoC: qdsp6: q6routing: remove default routing")
and 9b60441692d9 ("ASoC: qdsp6: q6asm-dai: only enable dais from device tree")
asm dais and routing needs to be properly specified at device tree level.

This patch fixes this.

Tested-by: Vinod Koul 
Reviewed-by: Vinod Koul 
Signed-off-by: Srinivas Kandagatla 
Link: 
https://lore.kernel.org/r/20200422101922.8894-1-srinivas.kandaga...@linaro.org
Signed-off-by: Bjorn Andersson 
Signed-off-by: Sasha Levin 
---
 arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi | 19 ++-
 arch/arm64/boot/dts/qcom/msm8996.dtsi|  2 ++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi 
b/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi
index a85b85d85a5f..3c7c9b52623c 100644
--- a/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi
+++ b/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi
@@ -908,10 +908,27 @@
status = "okay";
 };
 
+&q6asmdai {
+   dai@0 {
+   reg = <0>;
+   };
+
+   dai@1 {
+   reg = <1>;
+   };
+
+   dai@2 {
+   reg = <2>;
+   };
+};
+
 &sound {
compatible = "qcom,apq8096-sndcard";
model = "DB820c";
-   audio-routing = "RX_BIAS", "MCLK";
+   audio-routing = "RX_BIAS", "MCLK",
+   "MM_DL1",  "MultiMedia1 Playback",
+   "MM_DL2",  "MultiMedia2 Playback",
+   "MultiMedia3 Capture", "MM_UL3";
 
mm1-dai-link {
link-name = "MultiMedia1";
diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi 
b/arch/arm64/boot/dts/qcom/msm8996.dtsi
index 7ae082ea14ea..f925a6c7d293 100644
--- a/arch/arm64/boot/dts/qcom/msm8996.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi
@@ -2053,6 +2053,8 @@
reg = ;
q6asmdai: dais {
compatible = 
"qcom,q6asm-dais";
+   #address-cells = <1>;
+   #size-cells = <0>;
#sound-dai-cells = <1>;
iommus = 
<&lpass_q6_smmu 1>;
};
-- 
2.25.1





[PATCH 5.6 079/177] riscv: pgtable: Fix __kernel_map_pages build error if NOMMU

2020-06-01 Thread Greg Kroah-Hartman
From: Kefeng Wang 

[ Upstream commit 9a6630aef93394ac54494c7e273e9bc026509375 ]

riscv64-none-linux-gnu-ld: mm/page_alloc.o: in function `.L0 ':
page_alloc.c:(.text+0xd34): undefined reference to `__kernel_map_pages'
riscv64-none-linux-gnu-ld: page_alloc.c:(.text+0x104a): undefined reference to 
`__kernel_map_pages'
riscv64-none-linux-gnu-ld: mm/page_alloc.o: in function 
`__pageblock_pfn_to_page':
page_alloc.c:(.text+0x145e): undefined reference to `__kernel_map_pages'

Reported-by: Hulk Robot 
Signed-off-by: Kefeng Wang 
Signed-off-by: Palmer Dabbelt 
Signed-off-by: Sasha Levin 
---
 arch/riscv/include/asm/pgtable.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
index 05b92987f500..31d912944d8d 100644
--- a/arch/riscv/include/asm/pgtable.h
+++ b/arch/riscv/include/asm/pgtable.h
@@ -467,6 +467,8 @@ static inline int ptep_clear_flush_young(struct 
vm_area_struct *vma,
 
 #define TASK_SIZE 0xUL
 
+static inline void __kernel_map_pages(struct page *page, int numpages, int 
enable) {}
+
 #endif /* !CONFIG_MMU */
 
 #define kern_addr_valid(addr)   (1) /* FIXME */
-- 
2.25.1





[PATCH 5.6 072/177] riscv: Add pgprot_writecombine/device and PAGE_SHARED defination if NOMMU

2020-06-01 Thread Greg Kroah-Hartman
From: Kefeng Wang 

[ Upstream commit fa8174aa225fe3d53b37552e5066e6f0301dbabd ]

Some drivers use PAGE_SHARED, pgprot_writecombine()/pgprot_device(),
add the defination to fix build error if NOMMU.

Reported-by: Hulk Robot 
Signed-off-by: Kefeng Wang 
Signed-off-by: Palmer Dabbelt 
Signed-off-by: Sasha Levin 
---
 arch/riscv/include/asm/mmio.h| 2 ++
 arch/riscv/include/asm/pgtable.h | 1 +
 2 files changed, 3 insertions(+)

diff --git a/arch/riscv/include/asm/mmio.h b/arch/riscv/include/asm/mmio.h
index a2c809df2733..56053c9838b2 100644
--- a/arch/riscv/include/asm/mmio.h
+++ b/arch/riscv/include/asm/mmio.h
@@ -16,6 +16,8 @@
 
 #ifndef CONFIG_MMU
 #define pgprot_noncached(x)(x)
+#define pgprot_writecombine(x) (x)
+#define pgprot_device(x)   (x)
 #endif /* CONFIG_MMU */
 
 /* Generic IO read/write.  These perform native-endian accesses. */
diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
index 393f2014dfee..05b92987f500 100644
--- a/arch/riscv/include/asm/pgtable.h
+++ b/arch/riscv/include/asm/pgtable.h
@@ -460,6 +460,7 @@ static inline int ptep_clear_flush_young(struct 
vm_area_struct *vma,
 
 #else /* CONFIG_MMU */
 
+#define PAGE_SHARED__pgprot(0)
 #define PAGE_KERNEL__pgprot(0)
 #define swapper_pg_dir NULL
 #define VMALLOC_START  0
-- 
2.25.1





[PATCH 5.6 097/177] gpio: exar: Fix bad handling for ida_simple_get error path

2020-06-01 Thread Greg Kroah-Hartman
From: Takashi Iwai 

[ Upstream commit 333830aa149a87cabeb5d30fbcf12eecc8040d2c ]

The commit 7ecced0934e5 ("gpio: exar: add a check for the return value
of ida_simple_get fails") added a goto jump to the common error
handler for ida_simple_get() error, but this is wrong in two ways:
it doesn't set the proper return code and, more badly, it invokes
ida_simple_remove() with a negative index that shall lead to a kernel
panic via BUG_ON().

This patch addresses those two issues.

Fixes: 7ecced0934e5 ("gpio: exar: add a check for the return value of 
ida_simple_get fails")
Cc: 
Signed-off-by: Takashi Iwai 
Signed-off-by: Bartosz Golaszewski 
Signed-off-by: Sasha Levin 
---
 drivers/gpio/gpio-exar.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-exar.c b/drivers/gpio/gpio-exar.c
index da1ef0b1c291..b1accfba017d 100644
--- a/drivers/gpio/gpio-exar.c
+++ b/drivers/gpio/gpio-exar.c
@@ -148,8 +148,10 @@ static int gpio_exar_probe(struct platform_device *pdev)
mutex_init(&exar_gpio->lock);
 
index = ida_simple_get(&ida_index, 0, 0, GFP_KERNEL);
-   if (index < 0)
-   goto err_destroy;
+   if (index < 0) {
+   ret = index;
+   goto err_mutex_destroy;
+   }
 
sprintf(exar_gpio->name, "exar_gpio%d", index);
exar_gpio->gpio_chip.label = exar_gpio->name;
@@ -176,6 +178,7 @@ static int gpio_exar_probe(struct platform_device *pdev)
 
 err_destroy:
ida_simple_remove(&ida_index, index);
+err_mutex_destroy:
mutex_destroy(&exar_gpio->lock);
return ret;
 }
-- 
2.25.1





[PATCH 5.6 071/177] riscv: stacktrace: Fix undefined reference to `walk_stackframe

2020-06-01 Thread Greg Kroah-Hartman
From: Kefeng Wang 

[ Upstream commit 0502bee37cdef755d63eee60236562e5605e2480 ]

Drop static declaration to fix following build error if FRAME_POINTER disabled,
  riscv64-linux-ld: arch/riscv/kernel/perf_callchain.o: in function `.L0':
  perf_callchain.c:(.text+0x2b8): undefined reference to `walk_stackframe'

Reported-by: Hulk Robot 
Signed-off-by: Kefeng Wang 
Signed-off-by: Palmer Dabbelt 
Signed-off-by: Sasha Levin 
---
 arch/riscv/kernel/stacktrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c
index 0940681d2f68..19e46f4160cc 100644
--- a/arch/riscv/kernel/stacktrace.c
+++ b/arch/riscv/kernel/stacktrace.c
@@ -63,7 +63,7 @@ void notrace walk_stackframe(struct task_struct *task, struct 
pt_regs *regs,
 
 #else /* !CONFIG_FRAME_POINTER */
 
-static void notrace walk_stackframe(struct task_struct *task,
+void notrace walk_stackframe(struct task_struct *task,
struct pt_regs *regs, bool (*fn)(unsigned long, void *), void *arg)
 {
unsigned long sp, pc;
-- 
2.25.1





[PATCH 5.6 074/177] csky: Fixup msa highest 3 bits mask

2020-06-01 Thread Greg Kroah-Hartman
From: Liu Yibin 

[ Upstream commit 165f2d2858013253042809df082b8df7e34e86d7 ]

Just as comment mentioned, the msa format:

 cr<30/31, 15> MSA register format:
 31 - 29 | 28 - 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
   BA Reserved  SH  WA  B   SO SEC  C   D   V

So we should shift 29 bits not 28 bits for mask

Signed-off-by: Liu Yibin 
Signed-off-by: Guo Ren 
Signed-off-by: Sasha Levin 
---
 arch/csky/abiv1/inc/abi/entry.h | 4 ++--
 arch/csky/abiv2/inc/abi/entry.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/csky/abiv1/inc/abi/entry.h b/arch/csky/abiv1/inc/abi/entry.h
index 5056ebb902d1..61d94ec7dd16 100644
--- a/arch/csky/abiv1/inc/abi/entry.h
+++ b/arch/csky/abiv1/inc/abi/entry.h
@@ -167,8 +167,8 @@
 *   BA Reserved  C   D   V
 */
cprcr   r6, cpcr30
-   lsrir6, 28
-   lslir6, 28
+   lsrir6, 29
+   lslir6, 29
addir6, 0xe
cpwcr   r6, cpcr30
 
diff --git a/arch/csky/abiv2/inc/abi/entry.h b/arch/csky/abiv2/inc/abi/entry.h
index 111973c6c713..9023828ede97 100644
--- a/arch/csky/abiv2/inc/abi/entry.h
+++ b/arch/csky/abiv2/inc/abi/entry.h
@@ -225,8 +225,8 @@
 */
mfcrr6, cr<30, 15> /* Get MSA0 */
 2:
-   lsrir6, 28
-   lslir6, 28
+   lsrir6, 29
+   lslir6, 29
addir6, 0x1ce
mtcrr6, cr<30, 15> /* Set MSA0 */
 
-- 
2.25.1





[PATCH 5.6 105/177] ARM: dts: bcm: HR2: Fix PPI interrupt types

2020-06-01 Thread Greg Kroah-Hartman
From: Hamish Martin 

[ Upstream commit be0ec060b54f0481fb95d59086c1484a949c903c ]

These error messages are output when booting on a BCM HR2 system:
GIC: PPI11 is secure or misconfigured
GIC: PPI13 is secure or misconfigured

Per ARM documentation these interrupts are triggered on a rising edge.
See ARM Cortex A-9 MPCore Technical Reference Manual, Revision r4p1,
Section 3.3.8 Interrupt Configuration Registers.

The same issue was resolved for NSP systems in commit 5f1aa51c7a1e
("ARM: dts: NSP: Fix PPI interrupt types").

Fixes: b9099ec754b5 ("ARM: dts: Add Broadcom Hurricane 2 DTS include file")
Signed-off-by: Hamish Martin 
Signed-off-by: Florian Fainelli 
Signed-off-by: Sasha Levin 
---
 arch/arm/boot/dts/bcm-hr2.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/bcm-hr2.dtsi b/arch/arm/boot/dts/bcm-hr2.dtsi
index 6142c672811e..5e5f5ca3c86f 100644
--- a/arch/arm/boot/dts/bcm-hr2.dtsi
+++ b/arch/arm/boot/dts/bcm-hr2.dtsi
@@ -75,7 +75,7 @@
timer@20200 {
compatible = "arm,cortex-a9-global-timer";
reg = <0x20200 0x100>;
-   interrupts = ;
+   interrupts = ;
clocks = <&periph_clk>;
};
 
@@ -83,7 +83,7 @@
compatible = "arm,cortex-a9-twd-timer";
reg = <0x20600 0x20>;
interrupts = ;
+ IRQ_TYPE_EDGE_RISING)>;
clocks = <&periph_clk>;
};
 
@@ -91,7 +91,7 @@
compatible = "arm,cortex-a9-twd-wdt";
reg = <0x20620 0x20>;
interrupts = ;
+ IRQ_TYPE_EDGE_RISING)>;
clocks = <&periph_clk>;
};
 
-- 
2.25.1





[PATCH 5.6 108/177] ARM: dts: mmp3: Drop usb-nop-xceiv from HSIC phy

2020-06-01 Thread Greg Kroah-Hartman
From: Lubomir Rintel 

[ Upstream commit 24cf6eef79a7e85cfd2ef9dea52f769c9192fc6e ]

"usb-nop-xceiv" is good enough if we don't lose the configuration done
by the firmware, but we'd really prefer a real driver.

Unfortunately, the PHY core is odd in that when the node is compatible
with "usb-nop-xceiv", it ignores the other compatible strings. Let's
just remove it.

Signed-off-by: Lubomir Rintel 
Cc: 
Signed-off-by: Arnd Bergmann 
Signed-off-by: Sasha Levin 
---
 arch/arm/boot/dts/mmp3.dtsi | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/mmp3.dtsi b/arch/arm/boot/dts/mmp3.dtsi
index 3e28f0dc9df4..1e25bf998ab5 100644
--- a/arch/arm/boot/dts/mmp3.dtsi
+++ b/arch/arm/boot/dts/mmp3.dtsi
@@ -202,8 +202,7 @@
};
 
hsic_phy0: hsic-phy@f0001800 {
-   compatible = "marvell,mmp3-hsic-phy",
-"usb-nop-xceiv";
+   compatible = "marvell,mmp3-hsic-phy";
reg = <0xf0001800 0x40>;
#phy-cells = <0>;
status = "disabled";
@@ -224,8 +223,7 @@
};
 
hsic_phy1: hsic-phy@f0002800 {
-   compatible = "marvell,mmp3-hsic-phy",
-"usb-nop-xceiv";
+   compatible = "marvell,mmp3-hsic-phy";
reg = <0xf0002800 0x40>;
#phy-cells = <0>;
status = "disabled";
-- 
2.25.1





[PATCH 5.6 120/177] ALSA: hda/realtek - Add new codec supported for ALC287

2020-06-01 Thread Greg Kroah-Hartman
From: Kailang Yang 

[ Upstream commit 630e36126e420e1756378b3427b42711ce0b9ddd ]

Enable new codec supported for ALC287.

Signed-off-by: Kailang Yang 
Cc: 
Link: https://lore.kernel.org/r/dcf5ce5507104d0589a917cbb71dc...@realtek.com
Signed-off-by: Takashi Iwai 
Signed-off-by: Sasha Levin 
---
 sound/pci/hda/patch_realtek.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 92c6e58c3862..e62d58872b6e 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -384,6 +384,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec)
case 0x10ec0282:
case 0x10ec0283:
case 0x10ec0286:
+   case 0x10ec0287:
case 0x10ec0288:
case 0x10ec0285:
case 0x10ec0298:
@@ -8292,6 +8293,7 @@ static int patch_alc269(struct hda_codec *codec)
case 0x10ec0215:
case 0x10ec0245:
case 0x10ec0285:
+   case 0x10ec0287:
case 0x10ec0289:
spec->codec_variant = ALC269_TYPE_ALC215;
spec->shutup = alc225_shutup;
@@ -9570,6 +9572,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = {
HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
+   HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
-- 
2.25.1





[PATCH 5.6 115/177] ALSA: hda/realtek - Add a model for Thinkpad T570 without DAC workaround

2020-06-01 Thread Greg Kroah-Hartman
From: Takashi Iwai 

[ Upstream commit 399c01aa49e548c82d40f8161915a5941dd3c60e ]

We fixed the regression of the speaker volume for some Thinkpad models
(e.g. T570) by the commit 54947cd64c1b ("ALSA: hda/realtek - Fix
speaker output regression on Thinkpad T570").  Essentially it fixes
the DAC / pin pairing by a static table.  It was confirmed and merged
to stable kernel later.

Now, interestingly, we got another regression report for the very same
model (T570) about the similar problem, and the commit above was the
culprit.  That is, by some reason, there are devices that prefer the
DAC1, and another device DAC2!

Unfortunately those have the same ID and we have no idea what can
differentiate, in this patch, a new fixup model "tpt470-dock-fix" is
provided, so that users with such a machine can apply it manually.
When model=tpt470-dock-fix option is passed to snd-hda-intel module,
it avoids the fixed DAC pairing and the DAC1 is assigned to the
speaker like the earlier versions.

Fixes: 54947cd64c1b ("ALSA: hda/realtek - Fix speaker output regression on 
Thinkpad T570")
BugLink: https://apibugzilla.suse.com/show_bug.cgi?id=1172017
Cc: 
Link: https://lore.kernel.org/r/20200526062406.9799-1-ti...@suse.de
Signed-off-by: Takashi Iwai 
Signed-off-by: Sasha Levin 
---
 sound/pci/hda/patch_realtek.c | 36 +--
 1 file changed, 26 insertions(+), 10 deletions(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 041d2a32059b..92c6e58c3862 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -5484,18 +5484,9 @@ static void alc_fixup_tpt470_dock(struct hda_codec 
*codec,
{ 0x19, 0x21a11010 }, /* dock mic */
{ }
};
-   /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
-* the speaker output becomes too low by some reason on Thinkpads with
-* ALC298 codec
-*/
-   static const hda_nid_t preferred_pairs[] = {
-   0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
-   0
-   };
struct alc_spec *spec = codec->spec;
 
if (action == HDA_FIXUP_ACT_PRE_PROBE) {
-   spec->gen.preferred_dacs = preferred_pairs;
spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
snd_hda_apply_pincfgs(codec, pincfgs);
} else if (action == HDA_FIXUP_ACT_INIT) {
@@ -5508,6 +5499,23 @@ static void alc_fixup_tpt470_dock(struct hda_codec 
*codec,
}
 }
 
+static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
+ const struct hda_fixup *fix, int action)
+{
+   /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
+* the speaker output becomes too low by some reason on Thinkpads with
+* ALC298 codec
+*/
+   static const hda_nid_t preferred_pairs[] = {
+   0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
+   0
+   };
+   struct alc_spec *spec = codec->spec;
+
+   if (action == HDA_FIXUP_ACT_PRE_PROBE)
+   spec->gen.preferred_dacs = preferred_pairs;
+}
+
 static void alc_shutup_dell_xps13(struct hda_codec *codec)
 {
struct alc_spec *spec = codec->spec;
@@ -6063,6 +6071,7 @@ enum {
ALC700_FIXUP_INTEL_REFERENCE,
ALC274_FIXUP_DELL_BIND_DACS,
ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
+   ALC298_FIXUP_TPT470_DOCK_FIX,
ALC298_FIXUP_TPT470_DOCK,
ALC255_FIXUP_DUMMY_LINEOUT_VERB,
ALC255_FIXUP_DELL_HEADSET_MIC,
@@ -6994,12 +7003,18 @@ static const struct hda_fixup alc269_fixups[] = {
.chained = true,
.chain_id = ALC274_FIXUP_DELL_BIND_DACS
},
-   [ALC298_FIXUP_TPT470_DOCK] = {
+   [ALC298_FIXUP_TPT470_DOCK_FIX] = {
.type = HDA_FIXUP_FUNC,
.v.func = alc_fixup_tpt470_dock,
.chained = true,
.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
},
+   [ALC298_FIXUP_TPT470_DOCK] = {
+   .type = HDA_FIXUP_FUNC,
+   .v.func = alc_fixup_tpt470_dacs,
+   .chained = true,
+   .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
+   },
[ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
.type = HDA_FIXUP_PINS,
.v.pins = (const struct hda_pintbl[]) {
@@ -7638,6 +7653,7 @@ static const struct hda_model_fixup alc269_fixup_models[] 
= {
{.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
{.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
{.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
+   {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
{.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
{.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
{.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
-- 
2.25.1





[PATCH 5.6 106/177] ARM: dts: mmp3: Use the MMP3 compatible string for /clocks

2020-06-01 Thread Greg Kroah-Hartman
From: Lubomir Rintel 

[ Upstream commit ec7d12faf81de983efce8ff23f41c5d1bff14c41 ]

Clocks are in fact slightly different on MMP3. In particular, PLL2 is
fixed to a different frequency, there's an extra PLL3, and the GPU
clocks are configured differently.

Link: https://lore.kernel.org/r/20200419171157.672999-15-lkund...@v3.sk
Signed-off-by: Lubomir Rintel 
Cc: 
Signed-off-by: Arnd Bergmann 
Signed-off-by: Sasha Levin 
---
 arch/arm/boot/dts/mmp3.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/mmp3.dtsi b/arch/arm/boot/dts/mmp3.dtsi
index 59a108e49b41..3e28f0dc9df4 100644
--- a/arch/arm/boot/dts/mmp3.dtsi
+++ b/arch/arm/boot/dts/mmp3.dtsi
@@ -531,7 +531,7 @@
};
 
soc_clocks: clocks@d405 {
-   compatible = "marvell,mmp2-clock";
+   compatible = "marvell,mmp3-clock";
reg = <0xd405 0x1000>,
  <0xd4282800 0x400>,
  <0xd4015000 0x1000>;
-- 
2.25.1





[PATCH 5.6 111/177] gpio: pxa: Fix return value of pxa_gpio_probe()

2020-06-01 Thread Greg Kroah-Hartman
From: Tiezhu Yang 

[ Upstream commit 558ab2e8155e5f42ca0a6407957cd4173dc166cc ]

When call function devm_platform_ioremap_resource(), we should use IS_ERR()
to check the return value and return PTR_ERR() if failed.

Fixes: 542c25b7a209 ("drivers: gpio: pxa: use devm_platform_ioremap_resource()")
Signed-off-by: Tiezhu Yang 
Signed-off-by: Bartosz Golaszewski 
Signed-off-by: Sasha Levin 
---
 drivers/gpio/gpio-pxa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index 9888b62f37af..432c487f77b4 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -663,8 +663,8 @@ static int pxa_gpio_probe(struct platform_device *pdev)
pchip->irq1 = irq1;
 
gpio_reg_base = devm_platform_ioremap_resource(pdev, 0);
-   if (!gpio_reg_base)
-   return -EINVAL;
+   if (IS_ERR(gpio_reg_base))
+   return PTR_ERR(gpio_reg_base);
 
clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(clk)) {
-- 
2.25.1





[PATCH 5.6 107/177] ARM: dts: mmp3-dell-ariel: Fix the SPI devices

2020-06-01 Thread Greg Kroah-Hartman
From: Lubomir Rintel 

[ Upstream commit 233cbffaa0b9ca874731efee67a11f005da1f87c ]

I've managed to get about everything wrong while digging these out of
OEM's board file.

Correct the bus numbers, the exact model of the NOR flash, polarity of
the chip selects and align the SPI frequency with the data sheet.

Tested that it works now, with a slight fix to the PXA SSP driver.

Link: https://lore.kernel.org/r/20200419171157.672999-16-lkund...@v3.sk
Signed-off-by: Lubomir Rintel 
Cc: 
Signed-off-by: Arnd Bergmann 
Signed-off-by: Sasha Levin 
---
 arch/arm/boot/dts/mmp3-dell-ariel.dts | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/boot/dts/mmp3-dell-ariel.dts 
b/arch/arm/boot/dts/mmp3-dell-ariel.dts
index 15449c72c042..b0ec14c42164 100644
--- a/arch/arm/boot/dts/mmp3-dell-ariel.dts
+++ b/arch/arm/boot/dts/mmp3-dell-ariel.dts
@@ -98,19 +98,19 @@
status = "okay";
 };
 
-&ssp3 {
+&ssp1 {
status = "okay";
-   cs-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>;
+   cs-gpios = <&gpio 46 GPIO_ACTIVE_LOW>;
 
firmware-flash@0 {
-   compatible = "st,m25p80", "jedec,spi-nor";
+   compatible = "winbond,w25q32", "jedec,spi-nor";
reg = <0>;
-   spi-max-frequency = <4000>;
+   spi-max-frequency = <10400>;
m25p,fast-read;
};
 };
 
-&ssp4 {
-   cs-gpios = <&gpio 56 GPIO_ACTIVE_HIGH>;
+&ssp2 {
+   cs-gpios = <&gpio 56 GPIO_ACTIVE_LOW>;
status = "okay";
 };
-- 
2.25.1





[PATCH 5.6 121/177] libceph: ignore pool overlay and cache logic on redirects

2020-06-01 Thread Greg Kroah-Hartman
From: Jerry Lee 

[ Upstream commit 890bd0f8997ae6ac0a367dd5146154a3963306dd ]

OSD client should ignore cache/overlay flag if got redirect reply.
Otherwise, the client hangs when the cache tier is in forward mode.

[ idryomov: Redirects are effectively deprecated and no longer
  used or tested.  The original tiering modes based on redirects
  are inherently flawed because redirects can race and reorder,
  potentially resulting in data corruption.  The new proxy and
  readproxy tiering modes should be used instead of forward and
  readforward.  Still marking for stable as obviously correct,
  though. ]

Cc: sta...@vger.kernel.org
URL: https://tracker.ceph.com/issues/23296
URL: https://tracker.ceph.com/issues/36406
Signed-off-by: Jerry Lee 
Reviewed-by: Ilya Dryomov 
Signed-off-by: Ilya Dryomov 
Signed-off-by: Sasha Levin 
---
 net/ceph/osd_client.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index af868d3923b9..834019dbc6b1 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -3652,7 +3652,9 @@ static void handle_reply(struct ceph_osd *osd, struct 
ceph_msg *msg)
 * supported.
 */
req->r_t.target_oloc.pool = m.redirect.oloc.pool;
-   req->r_flags |= CEPH_OSD_FLAG_REDIRECTED;
+   req->r_flags |= CEPH_OSD_FLAG_REDIRECTED |
+   CEPH_OSD_FLAG_IGNORE_OVERLAY |
+   CEPH_OSD_FLAG_IGNORE_CACHE;
req->r_tid = 0;
__submit_request(req, false);
goto out_unlock_osdc;
-- 
2.25.1





[PATCH 5.6 116/177] ALSA: usb-audio: mixer: volume quirk for ESS Technology Asus USB DAC

2020-06-01 Thread Greg Kroah-Hartman
From: Chris Chiu 

[ Upstream commit 4020d1ccbe55bdf67b31d718d2400506eaf4b43f ]

The Asus USB DAC is a USB type-C audio dongle for connecting to
the headset and headphone. The volume minimum value -23040 which
is 0xa600 in hexadecimal with the resolution value 1 indicates
this should be endianness issue caused by the firmware bug. Add
a volume quirk to fix the volume control problem.

Also fixes this warning:
  Warning! Unlikely big volume range (=23040), cval->res is probably wrong.
  [5] FU [Headset Capture Volume] ch = 1, val = -23040/0/1
  Warning! Unlikely big volume range (=23040), cval->res is probably wrong.
  [7] FU [Headset Playback Volume] ch = 1, val = -23040/0/1

Signed-off-by: Chris Chiu 
Cc: 
Link: https://lore.kernel.org/r/20200526062613.55401-1-c...@endlessm.com
Signed-off-by: Takashi Iwai 
Signed-off-by: Sasha Levin 
---
 sound/usb/mixer.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 7a2961ad60de..68fefe55e5c0 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -1171,6 +1171,14 @@ static void volume_control_quirks(struct 
usb_mixer_elem_info *cval,
cval->res = 384;
}
break;
+   case USB_ID(0x0495, 0x3042): /* ESS Technology Asus USB DAC */
+   if ((strstr(kctl->id.name, "Playback Volume") != NULL) ||
+   strstr(kctl->id.name, "Capture Volume") != NULL) {
+   cval->min >>= 8;
+   cval->max = 0;
+   cval->res = 1;
+   }
+   break;
}
 }
 
-- 
2.25.1





[PATCH 5.6 110/177] mmc: block: Fix use-after-free issue for rpmb

2020-06-01 Thread Greg Kroah-Hartman
From: Peng Hao 

[ Upstream commit 202500d21654874aa03243e91f96de153ec61860 ]

The data structure member “rpmb->md” was passed to a call of the function
“mmc_blk_put” after a call of the function “put_device”. Reorder these
function calls to keep the data accesses consistent.

Fixes: 1c87f7357849 ("mmc: block: Fix bug when removing RPMB chardev ")
Signed-off-by: Peng Hao 
Cc: sta...@vger.kernel.org
[Uffe: Fixed up mangled patch and updated commit message]
Signed-off-by: Ulf Hansson 
Signed-off-by: Sasha Levin 
---
 drivers/mmc/core/block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 32db16f6debc..2d19291ebc84 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -2475,8 +2475,8 @@ static int mmc_rpmb_chrdev_release(struct inode *inode, 
struct file *filp)
struct mmc_rpmb_data *rpmb = container_of(inode->i_cdev,
  struct mmc_rpmb_data, chrdev);
 
-   put_device(&rpmb->dev);
mmc_blk_put(rpmb->md);
+   put_device(&rpmb->dev);
 
return 0;
 }
-- 
2.25.1





[PATCH 5.6 114/177] ALSA: hwdep: fix a left shifting 1 by 31 UB bug

2020-06-01 Thread Greg Kroah-Hartman
From: Changming Liu 

[ Upstream commit fb8cd6481ffd126f35e9e146a0dcf0c4e8899f2e ]

The "info.index" variable can be 31 in "1 << info.index".
This might trigger an undefined behavior since 1 is signed.

Fix this by casting 1 to 1u just to be sure "1u << 31" is defined.

Signed-off-by: Changming Liu 
Cc: 
Link: 
https://lore.kernel.org/r/bl0pr06mb4548170b842cb055c9af695de5...@bl0pr06mb4548.namprd06.prod.outlook.com
Signed-off-by: Takashi Iwai 
Signed-off-by: Sasha Levin 
---
 sound/core/hwdep.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c
index b412d3b3d5ff..21edb8ac95eb 100644
--- a/sound/core/hwdep.c
+++ b/sound/core/hwdep.c
@@ -216,12 +216,12 @@ static int snd_hwdep_dsp_load(struct snd_hwdep *hw,
if (info.index >= 32)
return -EINVAL;
/* check whether the dsp was already loaded */
-   if (hw->dsp_loaded & (1 << info.index))
+   if (hw->dsp_loaded & (1u << info.index))
return -EBUSY;
err = hw->ops.dsp_load(hw, &info);
if (err < 0)
return err;
-   hw->dsp_loaded |= (1 << info.index);
+   hw->dsp_loaded |= (1u << info.index);
return 0;
 }
 
-- 
2.25.1





[PATCH 5.6 091/177] Input: synaptics-rmi4 - really fix attn_data use-after-free

2020-06-01 Thread Greg Kroah-Hartman
From: Evan Green 

[ Upstream commit d5a5e5b5fa7b86c05bf073acc0ba98fa280174ec ]

Fix a use-after-free noticed by running with KASAN enabled. If
rmi_irq_fn() is run twice in a row, then rmi_f11_attention() (among
others) will end up reading from drvdata->attn_data.data, which was
freed and left dangling in rmi_irq_fn().

Commit 55edde9fff1a ("Input: synaptics-rmi4 - prevent UAF reported by
KASAN") correctly identified and analyzed this bug. However the attempted
fix only NULLed out a local variable, missing the fact that
drvdata->attn_data is a struct, not a pointer.

NULL out the correct pointer in the driver data to prevent the attention
functions from copying from it.

Fixes: 55edde9fff1a ("Input: synaptics-rmi4 - prevent UAF reported by KASAN")
Fixes: b908d3cd812a ("Input: synaptics-rmi4 - allow to add attention data")
Signed-off-by: Evan Green 
Cc: sta...@vger.kernel.org
Link: 
https://lore.kernel.org/r/20200427145537.1.Ic8f898e0147b2c005ee7b20f1aebdef1e7eb@changeid
Signed-off-by: Dmitry Torokhov 
Signed-off-by: Sasha Levin 
---
 drivers/input/rmi4/rmi_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index 190b9974526b..c18e1a25bca6 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -205,7 +205,7 @@ static irqreturn_t rmi_irq_fn(int irq, void *dev_id)
 
if (count) {
kfree(attn_data.data);
-   attn_data.data = NULL;
+   drvdata->attn_data.data = NULL;
}
 
if (!kfifo_is_empty(&drvdata->attn_fifo))
-- 
2.25.1





[PATCH 5.6 125/177] drm/amd/display: Split program front end part that occur outside lock

2020-06-01 Thread Greg Kroah-Hartman
From: Anthony Koo 

[ Upstream commit bbf5f6c3f83bedd71006473849138a446ad4d9a3 ]

[Why]
Eventually want to lock at a higher level in stack.
To do this, we need to be able to isolate the parts that need to be done
after pipe unlock.

[How]
Split out programming that is done post unlock.

Signed-off-by: Anthony Koo 
Reviewed-by: Aric Cyr 
Acked-by: Bhawanpreet Lakha 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/dc/core/dc.c  | 24 +---
 .../display/dc/dce110/dce110_hw_sequencer.c   |  6 +++
 .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 39 ---
 .../amd/display/dc/dcn10/dcn10_hw_sequencer.h |  3 ++
 .../gpu/drm/amd/display/dc/dcn10/dcn10_init.c |  1 +
 .../drm/amd/display/dc/dcn20/dcn20_hwseq.c| 11 +-
 .../drm/amd/display/dc/dcn20/dcn20_hwseq.h|  3 ++
 .../gpu/drm/amd/display/dc/dcn20/dcn20_init.c |  1 +
 .../gpu/drm/amd/display/dc/dcn21/dcn21_init.c |  1 +
 .../gpu/drm/amd/display/dc/inc/hw_sequencer.h |  2 +
 10 files changed, 79 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c 
b/drivers/gpu/drm/amd/display/dc/core/dc.c
index b3987124183a..66be2920fab0 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -788,11 +788,15 @@ static void disable_dangling_plane(struct dc *dc, struct 
dc_state *context)
if (should_disable && old_stream) {
dc_rem_all_planes_for_stream(dc, old_stream, 
dangling_context);
disable_all_writeback_pipes_for_stream(dc, old_stream, 
dangling_context);
-   if (dc->hwss.apply_ctx_for_surface)
+   if (dc->hwss.apply_ctx_for_surface) {
dc->hwss.apply_ctx_for_surface(dc, old_stream, 
0, dangling_context);
+   dc->hwss.post_unlock_program_front_end(dc, 
dangling_context);
+   }
+   if (dc->hwss.program_front_end_for_ctx) {
+   dc->hwss.program_front_end_for_ctx(dc, 
dangling_context);
+   dc->hwss.post_unlock_program_front_end(dc, 
dangling_context);
+   }
}
-   if (dc->hwss.program_front_end_for_ctx)
-   dc->hwss.program_front_end_for_ctx(dc, 
dangling_context);
}
 
current_ctx = dc->current_state;
@@ -1220,6 +1224,7 @@ static enum dc_status dc_commit_state_no_check(struct dc 
*dc, struct dc_state *c
dc, context->streams[i],
context->stream_status[i].plane_count,
context); /* use new pipe config in new context 
*/
+   dc->hwss.post_unlock_program_front_end(dc, context);
}
 
/* Program hardware */
@@ -1239,19 +1244,24 @@ static enum dc_status dc_commit_state_no_check(struct 
dc *dc, struct dc_state *c
}
 
/* Program all planes within new context*/
-   if (dc->hwss.program_front_end_for_ctx)
+   if (dc->hwss.program_front_end_for_ctx) {
dc->hwss.program_front_end_for_ctx(dc, context);
+   dc->hwss.post_unlock_program_front_end(dc, context);
+   }
+
for (i = 0; i < context->stream_count; i++) {
const struct dc_link *link = context->streams[i]->link;
 
if (!context->streams[i]->mode_changed)
continue;
 
-   if (dc->hwss.apply_ctx_for_surface)
+   if (dc->hwss.apply_ctx_for_surface) {
dc->hwss.apply_ctx_for_surface(
dc, context->streams[i],
context->stream_status[i].plane_count,
context);
+   dc->hwss.post_unlock_program_front_end(dc, context);
+   }
 
/*
 * enable stereo
@@ -2190,6 +2200,7 @@ static void commit_planes_for_stream(struct dc *dc,
if (dc->hwss.program_front_end_for_ctx)
dc->hwss.program_front_end_for_ctx(dc, context);
 
+   dc->hwss.post_unlock_program_front_end(dc, context);
return;
}
 
@@ -2322,6 +2333,9 @@ static void commit_planes_for_stream(struct dc *dc,
dc->hwss.pipe_control_lock(dc, top_pipe_to_program, false);
}
 
+   if (update_type != UPDATE_TYPE_FAST)
+   dc->hwss.post_unlock_program_front_end(dc, context);
+
// Fire manual trigger only when bottom plane is flipped
for (j = 0; j < dc->res_pool->pipe_count; j++) {
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c 
b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
index 5b689273ff44..a961b94aefd

[PATCH 5.6 087/177] Input: xpad - add custom init packet for Xbox One S controllers

2020-06-01 Thread Greg Kroah-Hartman
From: Łukasz Patron 

[ Upstream commit 764f7f911bf72450c51eb74cbb262ad9933741d8 ]

Sending [ 0x05, 0x20, 0x00, 0x0f, 0x06 ] packet for Xbox One S controllers
fixes an issue where controller is stuck in Bluetooth mode and not sending
any inputs.

Signed-off-by: Łukasz Patron 
Reviewed-by: Cameron Gutman 
Cc: sta...@vger.kernel.org
Link: https://lore.kernel.org/r/20200422075206.18229-1-priv@gmail.com
Signed-off-by: Dmitry Torokhov 
Signed-off-by: Sasha Levin 
---
 drivers/input/joystick/xpad.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 6b40a1c68f9f..c77cdb3b62b5 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -458,6 +458,16 @@ static const u8 xboxone_fw2015_init[] = {
0x05, 0x20, 0x00, 0x01, 0x00
 };
 
+/*
+ * This packet is required for Xbox One S (0x045e:0x02ea)
+ * and Xbox One Elite Series 2 (0x045e:0x0b00) pads to
+ * initialize the controller that was previously used in
+ * Bluetooth mode.
+ */
+static const u8 xboxone_s_init[] = {
+   0x05, 0x20, 0x00, 0x0f, 0x06
+};
+
 /*
  * This packet is required for the Titanfall 2 Xbox One pads
  * (0x0e6f:0x0165) to finish initialization and for Hori pads
@@ -516,6 +526,8 @@ static const struct xboxone_init_packet 
xboxone_init_packets[] = {
XBOXONE_INIT_PKT(0x0e6f, 0x0165, xboxone_hori_init),
XBOXONE_INIT_PKT(0x0f0d, 0x0067, xboxone_hori_init),
XBOXONE_INIT_PKT(0x, 0x, xboxone_fw2015_init),
+   XBOXONE_INIT_PKT(0x045e, 0x02ea, xboxone_s_init),
+   XBOXONE_INIT_PKT(0x045e, 0x0b00, xboxone_s_init),
XBOXONE_INIT_PKT(0x0e6f, 0x, xboxone_pdp_init1),
XBOXONE_INIT_PKT(0x0e6f, 0x, xboxone_pdp_init2),
XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumblebegin_init),
-- 
2.25.1





[PATCH 5.6 088/177] Input: dlink-dir685-touchkeys - fix a typo in driver name

2020-06-01 Thread Greg Kroah-Hartman
From: Christophe JAILLET 

[ Upstream commit 38347374ae3f1ec4df56dd688bd603a64e79a0ed ]

According to the file name and Kconfig, a 'k' is missing in this driver
name. It should be "dlink-dir685-touchkeys".

Fixes: 131b3de7016b ("Input: add D-Link DIR-685 touchkeys driver")
Signed-off-by: Christophe JAILLET 
Reviewed-by: Linus Walleij 
Link: 
https://lore.kernel.org/r/20200412213937.5287-1-christophe.jail...@wanadoo.fr
Signed-off-by: Dmitry Torokhov 
Signed-off-by: Sasha Levin 
---
 drivers/input/keyboard/dlink-dir685-touchkeys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/keyboard/dlink-dir685-touchkeys.c 
b/drivers/input/keyboard/dlink-dir685-touchkeys.c
index b0ead7199c40..a69dcc3bd30c 100644
--- a/drivers/input/keyboard/dlink-dir685-touchkeys.c
+++ b/drivers/input/keyboard/dlink-dir685-touchkeys.c
@@ -143,7 +143,7 @@ MODULE_DEVICE_TABLE(of, dir685_tk_of_match);
 
 static struct i2c_driver dir685_tk_i2c_driver = {
.driver = {
-   .name   = "dlin-dir685-touchkeys",
+   .name   = "dlink-dir685-touchkeys",
.of_match_table = of_match_ptr(dir685_tk_of_match),
},
.probe  = dir685_tk_probe,
-- 
2.25.1





[PATCH 5.6 124/177] drm/amd/display: drop cursor position check in atomic test

2020-06-01 Thread Greg Kroah-Hartman
From: Simon Ser 

[ Upstream commit f7d5991b92ff824798693ddf231cf814c9d5a88b ]

get_cursor_position already handles the case where the cursor has
negative off-screen coordinates by not setting
dc_cursor_position.enabled.

Signed-off-by: Simon Ser 
Fixes: 626bf90fe03f ("drm/amd/display: add basic atomic check for cursor plane")
Cc: Alex Deucher 
Cc: Nicholas Kazlauskas 
Signed-off-by: Alex Deucher 
Cc: sta...@vger.kernel.org
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 ---
 1 file changed, 7 deletions(-)

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 0cd11d3d4cf4..8e7cffe10cc5 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -7746,13 +7746,6 @@ static int dm_update_plane_state(struct dc *dc,
return -EINVAL;
}
 
-   if (new_plane_state->crtc_x <= -new_acrtc->max_cursor_width ||
-   new_plane_state->crtc_y <= 
-new_acrtc->max_cursor_height) {
-   DRM_DEBUG_ATOMIC("Bad cursor position %d, %d\n",
-
new_plane_state->crtc_x, new_plane_state->crtc_y);
-   return -EINVAL;
-   }
-
return 0;
}
 
-- 
2.25.1





[PATCH 5.6 137/177] gpio: fix locking open drain IRQ lines

2020-06-01 Thread Greg Kroah-Hartman
From: Linus Walleij 

[ Upstream commit e9bdf7e655b9ee81ee912fae1d59df48ce7311b6 ]

We provided the right semantics on open drain lines being
by definition output but incidentally the irq set up function
would only allow IRQs on lines that were "not output".

Fix the semantics to allow output open drain lines to be used
for IRQs.

Reported-by: Hans Verkuil 
Signed-off-by: Linus Walleij 
Signed-off-by: Hans Verkuil 
Tested-by: Hans Verkuil 
Cc: Russell King 
Cc: sta...@vger.kernel.org # v5.3+
Link: https://lore.kernel.org/r/20200527140758.162280-1-linus.wall...@linaro.org
Signed-off-by: Linus Walleij 
Signed-off-by: Sasha Levin 
---
 drivers/gpio/gpiolib.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 00fb91feba70..2f350e3df965 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -4025,7 +4025,9 @@ int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned 
int offset)
}
}
 
-   if (test_bit(FLAG_IS_OUT, &desc->flags)) {
+   /* To be valid for IRQ the line needs to be input or open drain */
+   if (test_bit(FLAG_IS_OUT, &desc->flags) &&
+   !test_bit(FLAG_OPEN_DRAIN, &desc->flags)) {
chip_err(chip,
 "%s: tried to flag a GPIO set as output for IRQ\n",
 __func__);
@@ -4088,7 +4090,12 @@ void gpiochip_enable_irq(struct gpio_chip *chip, 
unsigned int offset)
 
if (!IS_ERR(desc) &&
!WARN_ON(!test_bit(FLAG_USED_AS_IRQ, &desc->flags))) {
-   WARN_ON(test_bit(FLAG_IS_OUT, &desc->flags));
+   /*
+* We must not be output when using IRQ UNLESS we are
+* open drain.
+*/
+   WARN_ON(test_bit(FLAG_IS_OUT, &desc->flags) &&
+   !test_bit(FLAG_OPEN_DRAIN, &desc->flags));
set_bit(FLAG_IRQ_IS_ENABLED, &desc->flags);
}
 }
-- 
2.25.1





[PATCH 5.6 083/177] drivers: net: hamradio: Fix suspicious RCU usage warning in bpqether.c

2020-06-01 Thread Greg Kroah-Hartman
From: Madhuparna Bhowmik 

[ Upstream commit 95f59bf88bb75281cc626e283ecefdd5d5641427 ]

This patch fixes the following warning:
=
WARNING: suspicious RCU usage
5.7.0-rc5-next-20200514-syzkaller #0 Not tainted
-
drivers/net/hamradio/bpqether.c:149 RCU-list traversed in non-reader section!!

Since rtnl lock is held, pass this cond in list_for_each_entry_rcu().

Reported-by: syzbot+bb82cafc737c002d1...@syzkaller.appspotmail.com
Signed-off-by: Madhuparna Bhowmik 
Signed-off-by: David S. Miller 
Signed-off-by: Sasha Levin 
---
 drivers/net/hamradio/bpqether.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index fbea6f232819..e2ad3c2e8df5 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -127,7 +127,8 @@ static inline struct net_device *bpq_get_ax25_dev(struct 
net_device *dev)
 {
struct bpqdev *bpq;
 
-   list_for_each_entry_rcu(bpq, &bpq_devices, bpq_list) {
+   list_for_each_entry_rcu(bpq, &bpq_devices, bpq_list,
+   lockdep_rtnl_is_held()) {
if (bpq->ethdev == dev)
return bpq->axdev;
}
-- 
2.25.1





[PATCH 5.6 147/177] xfrm: espintcp: save and call old ->sk_destruct

2020-06-01 Thread Greg Kroah-Hartman
From: Sabrina Dubroca 

commit 9f0cadc32d738f0f0c8e30be83be7087c7b85ee5 upstream.

When ESP encapsulation is enabled on a TCP socket, I'm replacing the
existing ->sk_destruct callback with espintcp_destruct. We still need to
call the old callback to perform the other cleanups when the socket is
destroyed. Save the old callback, and call it from espintcp_destruct.

Fixes: e27cca96cd68 ("xfrm: add espintcp (RFC 8229)")
Signed-off-by: Sabrina Dubroca 
Signed-off-by: Steffen Klassert 
Signed-off-by: Greg Kroah-Hartman 

---
 include/net/espintcp.h |1 +
 net/xfrm/espintcp.c|2 ++
 2 files changed, 3 insertions(+)

--- a/include/net/espintcp.h
+++ b/include/net/espintcp.h
@@ -25,6 +25,7 @@ struct espintcp_ctx {
struct espintcp_msg partial;
void (*saved_data_ready)(struct sock *sk);
void (*saved_write_space)(struct sock *sk);
+   void (*saved_destruct)(struct sock *sk);
struct work_struct work;
bool tx_running;
 };
--- a/net/xfrm/espintcp.c
+++ b/net/xfrm/espintcp.c
@@ -379,6 +379,7 @@ static void espintcp_destruct(struct soc
 {
struct espintcp_ctx *ctx = espintcp_getctx(sk);
 
+   ctx->saved_destruct(sk);
kfree(ctx);
 }
 
@@ -419,6 +420,7 @@ static int espintcp_init_sk(struct sock
sk->sk_socket->ops = &espintcp_ops;
ctx->saved_data_ready = sk->sk_data_ready;
ctx->saved_write_space = sk->sk_write_space;
+   ctx->saved_destruct = sk->sk_destruct;
sk->sk_data_ready = espintcp_data_ready;
sk->sk_write_space = espintcp_write_space;
sk->sk_destruct = espintcp_destruct;




[PATCH 5.6 143/177] copy_xstate_to_kernel(): dont leave parts of destination uninitialized

2020-06-01 Thread Greg Kroah-Hartman
From: Al Viro 

commit 9e4636545933131de15e1ecd06733538ae939b2f upstream.

copy the corresponding pieces of init_fpstate into the gaps instead.

Cc: sta...@kernel.org
Tested-by: Alexander Potapenko 
Acked-by: Borislav Petkov 
Signed-off-by: Al Viro 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/x86/kernel/fpu/xstate.c |   86 ---
 1 file changed, 48 insertions(+), 38 deletions(-)

--- a/arch/x86/kernel/fpu/xstate.c
+++ b/arch/x86/kernel/fpu/xstate.c
@@ -954,18 +954,31 @@ static inline bool xfeatures_mxcsr_quirk
return true;
 }
 
-/*
- * This is similar to user_regset_copyout(), but will not add offset to
- * the source data pointer or increment pos, count, kbuf, and ubuf.
- */
-static inline void
-__copy_xstate_to_kernel(void *kbuf, const void *data,
-   unsigned int offset, unsigned int size, unsigned int 
size_total)
+static void fill_gap(unsigned to, void **kbuf, unsigned *pos, unsigned *count)
 {
-   if (offset < size_total) {
-   unsigned int copy = min(size, size_total - offset);
+   if (*pos < to) {
+   unsigned size = to - *pos;
+
+   if (size > *count)
+   size = *count;
+   memcpy(*kbuf, (void *)&init_fpstate.xsave + *pos, size);
+   *kbuf += size;
+   *pos += size;
+   *count -= size;
+   }
+}
 
-   memcpy(kbuf + offset, data, copy);
+static void copy_part(unsigned offset, unsigned size, void *from,
+   void **kbuf, unsigned *pos, unsigned *count)
+{
+   fill_gap(offset, kbuf, pos, count);
+   if (size > *count)
+   size = *count;
+   if (size) {
+   memcpy(*kbuf, from, size);
+   *kbuf += size;
+   *pos += size;
+   *count -= size;
}
 }
 
@@ -978,8 +991,9 @@ __copy_xstate_to_kernel(void *kbuf, cons
  */
 int copy_xstate_to_kernel(void *kbuf, struct xregs_state *xsave, unsigned int 
offset_start, unsigned int size_total)
 {
-   unsigned int offset, size;
struct xstate_header header;
+   const unsigned off_mxcsr = offsetof(struct fxregs_state, mxcsr);
+   unsigned count = size_total;
int i;
 
/*
@@ -995,46 +1009,42 @@ int copy_xstate_to_kernel(void *kbuf, st
header.xfeatures = xsave->header.xfeatures;
header.xfeatures &= ~XFEATURE_MASK_SUPERVISOR;
 
+   if (header.xfeatures & XFEATURE_MASK_FP)
+   copy_part(0, off_mxcsr,
+ &xsave->i387, &kbuf, &offset_start, &count);
+   if (header.xfeatures & (XFEATURE_MASK_SSE | XFEATURE_MASK_YMM))
+   copy_part(off_mxcsr, MXCSR_AND_FLAGS_SIZE,
+ &xsave->i387.mxcsr, &kbuf, &offset_start, &count);
+   if (header.xfeatures & XFEATURE_MASK_FP)
+   copy_part(offsetof(struct fxregs_state, st_space), 128,
+ &xsave->i387.st_space, &kbuf, &offset_start, &count);
+   if (header.xfeatures & XFEATURE_MASK_SSE)
+   copy_part(xstate_offsets[XFEATURE_MASK_SSE], 256,
+ &xsave->i387.xmm_space, &kbuf, &offset_start, &count);
+   /*
+* Fill xsave->i387.sw_reserved value for ptrace frame:
+*/
+   copy_part(offsetof(struct fxregs_state, sw_reserved), 48,
+ xstate_fx_sw_bytes, &kbuf, &offset_start, &count);
/*
 * Copy xregs_state->header:
 */
-   offset = offsetof(struct xregs_state, header);
-   size = sizeof(header);
-
-   __copy_xstate_to_kernel(kbuf, &header, offset, size, size_total);
+   copy_part(offsetof(struct xregs_state, header), sizeof(header),
+ &header, &kbuf, &offset_start, &count);
 
-   for (i = 0; i < XFEATURE_MAX; i++) {
+   for (i = FIRST_EXTENDED_XFEATURE; i < XFEATURE_MAX; i++) {
/*
 * Copy only in-use xstates:
 */
if ((header.xfeatures >> i) & 1) {
void *src = __raw_xsave_addr(xsave, i);
 
-   offset = xstate_offsets[i];
-   size = xstate_sizes[i];
-
-   /* The next component has to fit fully into the output 
buffer: */
-   if (offset + size > size_total)
-   break;
-
-   __copy_xstate_to_kernel(kbuf, src, offset, size, 
size_total);
+   copy_part(xstate_offsets[i], xstate_sizes[i],
+ src, &kbuf, &offset_start, &count);
}
 
}
-
-   if (xfeatures_mxcsr_quirk(header.xfeatures)) {
-   offset = offsetof(struct fxregs_state, mxcsr);
-   size = MXCSR_AND_FLAGS_SIZE;
-   __copy_xstate_to_kernel(kbuf, &xsave->i387.mxcsr, offset, size, 
size_total);
-   }
-
-   /*
-* Fill xsave->i387.sw_reserved value for ptrace frame:
-   

[PATCH 5.6 144/177] xfrm: allow to accept packets with ipv6 NEXTHDR_HOP in xfrm_input

2020-06-01 Thread Greg Kroah-Hartman
From: Xin Long 

commit afcaf61be9d1dbdee5ec186d1dcc67b6b692180f upstream.

For beet mode, when it's ipv6 inner address with nexthdrs set,
the packet format might be:


| outer  | | dest | |  |  ESP| ESP |
| IP hdr | ESP | opts.| TCP | Data | Trailer | ICV |


The nexthdr from ESP could be NEXTHDR_HOP(0), so it should
continue processing the packet when nexthdr returns 0 in
xfrm_input(). Otherwise, when ipv6 nexthdr is set, the
packet will be dropped.

I don't see any error cases that nexthdr may return 0. So
fix it by removing the check for nexthdr == 0.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Xin Long 
Signed-off-by: Steffen Klassert 
Signed-off-by: Greg Kroah-Hartman 

---
 net/xfrm/xfrm_input.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -644,7 +644,7 @@ resume:
dev_put(skb->dev);
 
spin_lock(&x->lock);
-   if (nexthdr <= 0) {
+   if (nexthdr < 0) {
if (nexthdr == -EBADMSG) {
xfrm_audit_state_icvfail(x, skb,
 x->type->proto);




[PATCH 5.6 140/177] cfg80211: fix debugfs rename crash

2020-06-01 Thread Greg Kroah-Hartman
From: Johannes Berg 

commit 0bbab5f0301587cad4e923ccc49bb910db86162c upstream.

Removing the "if (IS_ERR(dir)) dir = NULL;" check only works
if we adjust the remaining code to not rely on it being NULL.
Check IS_ERR_OR_NULL() before attempting to dereference it.

I'm not actually entirely sure this fixes the syzbot crash as
the kernel config indicates that they do have DEBUG_FS in the
kernel, but this is what I found when looking there.

Cc: sta...@vger.kernel.org
Fixes: d82574a8e5a4 ("cfg80211: no need to check return value of debugfs_create 
functions")
Reported-by: syzbot+fd5332e429401bf42...@syzkaller.appspotmail.com
Reviewed-by: Greg Kroah-Hartman 
Link: 
https://lore.kernel.org/r/20200525113816.fc4da3ec3d4b.Ica63a110679819eaa9fb3bc1b7437d96b1fd187d@changeid
Signed-off-by: Johannes Berg 
Signed-off-by: Greg Kroah-Hartman 

---
 net/wireless/core.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -142,7 +142,7 @@ int cfg80211_dev_rename(struct cfg80211_
if (result)
return result;
 
-   if (rdev->wiphy.debugfsdir)
+   if (!IS_ERR_OR_NULL(rdev->wiphy.debugfsdir))
debugfs_rename(rdev->wiphy.debugfsdir->d_parent,
   rdev->wiphy.debugfsdir,
   rdev->wiphy.debugfsdir->d_parent, newname);




[PATCH 5.6 141/177] mac80211: mesh: fix discovery timer re-arming issue / crash

2020-06-01 Thread Greg Kroah-Hartman
From: Linus Lüssing 

commit e2d4a80f93fcfaf72e2e20daf6a28e39c3b90677 upstream.

On a non-forwarding 802.11s link between two fairly busy
neighboring nodes (iperf with -P 16 at ~850MBit/s TCP;
1733.3 MBit/s VHT-MCS 9 80MHz short GI VHT-NSS 4), so with
frequent PREQ retries, usually after around 30-40 seconds the
following crash would occur:

[ 1110.822428] Unable to handle kernel read from unreadable memory at virtual 
address 
[ 1110.830786] Mem abort info:
[ 1110.833573]   Exception class = IABT (current EL), IL = 32 bits
[ 1110.839494]   SET = 0, FnV = 0
[ 1110.842546]   EA = 0, S1PTW = 0
[ 1110.845678] user pgtable: 4k pages, 48-bit VAs, pgd = 800076386000
[ 1110.852204] [] *pgd=f6322003, *pud=f62de003, 
*pmd=
[ 1110.861167] Internal error: Oops: 8604 [#1] PREEMPT SMP
[ 1110.866730] Modules linked in: pppoe ppp_async batman_adv ath10k_pci 
ath10k_core ath pppox ppp_generic nf_conntrack_ipv6 mac80211 iptable_nat 
ipt_REJECT ipt_MASQUERADE cfg80211 xt_time xt_tcpudp xt_state xt_nat 
xt_multiport xt_mark xt_mac xt_limit xt_conntrack xt_comment xt_TCPMSS 
xt_REDIRECT xt_LOG xt_FLOWOFFLOAD slhc nf_reject_ipv4 nf_nat_redirect 
nf_nat_masquerade_ipv4 nf_conntrack_ipv4 nf_nat_ipv4 nf_nat nf_log_ipv4 
nf_flow_table_hw nf_flow_table nf_defrag_ipv6 nf_defrag_ipv4 
nf_conntrack_rtcache nf_conntrack iptable_mangle iptable_filter ip_tables 
crc_ccitt compat nf_log_ipv6 nf_log_common ip6table_mangle ip6table_filter 
ip6_tables ip6t_REJECT x_tables nf_reject_ipv6 usb_storage xhci_plat_hcd 
xhci_pci xhci_hcd dwc3 usbcore usb_common
[ 1110.932190] Process swapper/3 (pid: 0, stack limit = 0x090c8000)
[ 1110.938884] CPU: 3 PID: 0 Comm: swapper/3 Not tainted 4.14.162 #0
[ 1110.944965] Hardware name: LS1043A RGW Board (DT)
[ 1110.949658] task: 8000787a81c0 task.stack: 090c8000
[ 1110.955568] PC is at 0x0
[ 1110.958097] LR is at call_timer_fn.isra.27+0x24/0x78
[ 1110.963055] pc : [<>] lr : [] pstate: 
00400145
[ 1110.970440] sp : 0801be10
[ 1110.973744] x29: 0801be10 x28: 08bf7018
[ 1110.979047] x27: 08bf87c8 x26: 08c160c0
[ 1110.984352] x25:  x24: 
[ 1110.989657] x23: dead0200 x22: 
[ 1110.994959] x21:  x20: 0101
[ .000262] x19: 8000787a81c0 x18: 
[ .005565] x17: 089167b0 x16: 0058
[ .010868] x15: 089167b0 x14: 
[ .016172] x13: 08916788 x12: 0040
[ .021475] x11: 80007fda9af0 x10: 0001
[ .026777] x9 : 0801bea0 x8 : 0004
[ .032080] x7 :  x6 : 80007fda9aa8
[ .037383] x5 : 0801bea0 x4 : 0010
[ .042685] x3 : 0801be98 x2 : 0614
[ .047988] x1 :  x0 : 
[ .053290] Call trace:
[ .055728] Exception stack(0x0801bcd0 to 0x0801be10)
[ .062158] bcc0:    

[ .069978] bce0: 0614 0801be98 0010 
0801bea0
[ .077798] bd00: 80007fda9aa8  0004 
0801bea0
[ .085618] bd20: 0001 80007fda9af0 0040 
08916788
[ .093437] bd40:  089167b0 0058 
089167b0
[ .101256] bd60:  8000787a81c0 0101 

[ .109075] bd80:  dead0200  

[ .116895] bda0: 08c160c0 08bf87c8 08bf7018 
0801be10
[ .124715] bdc0: 080ff29c 0801be10  
00400145
[ .132534] bde0: 8000787a81c0 0801bde8  
01029eb19be8
[ .140353] be00: 0801be10 
[ .145220] [<  (null)>]   (null)
[ .149917] [] run_timer_softirq+0x184/0x398
[ .155741] [] __do_softirq+0x100/0x1fc
[ .161130] [] irq_exit+0x80/0xd8
[ .166002] [] __handle_domain_irq+0x88/0xb0
[ .171825] [] gic_handle_irq+0x68/0xb0
[ .177213] Exception stack(0x090cbe30 to 0x090cbf70)
[ .183642] be20:   0020 

[ .191461] be40: 0001  8000771af000 

[ .199281] be60: 08c95180  08c19360 
090cbef0
[ .207101] be80: 0810 0400 0098 

[ .214920] bea0: 0001 089167b0  
089167b0
[ .222740] bec0:  08c198e8 08bf7018 
08c19000
[ .230559] bee0:   8000787a81c0 
08018000
[ .238380] bf00: f

[PATCH 5.6 148/177] xfrm: call xfrm_output_gso when inner_protocol is set in xfrm_output

2020-06-01 Thread Greg Kroah-Hartman
From: Xin Long 

commit a204aef9fd77dce1efd9066ca4e44eede99cd858 upstream.

An use-after-free crash can be triggered when sending big packets over
vxlan over esp with esp offload enabled:

  [] BUG: KASAN: use-after-free in ipv6_gso_pull_exthdrs.part.8+0x32c/0x4e0
  [] Call Trace:
  []  dump_stack+0x75/0xa0
  []  kasan_report+0x37/0x50
  []  ipv6_gso_pull_exthdrs.part.8+0x32c/0x4e0
  []  ipv6_gso_segment+0x2c8/0x13c0
  []  skb_mac_gso_segment+0x1cb/0x420
  []  skb_udp_tunnel_segment+0x6b5/0x1c90
  []  inet_gso_segment+0x440/0x1380
  []  skb_mac_gso_segment+0x1cb/0x420
  []  esp4_gso_segment+0xae8/0x1709 [esp4_offload]
  []  inet_gso_segment+0x440/0x1380
  []  skb_mac_gso_segment+0x1cb/0x420
  []  __skb_gso_segment+0x2d7/0x5f0
  []  validate_xmit_skb+0x527/0xb10
  []  __dev_queue_xmit+0x10f8/0x2320 <---
  []  ip_finish_output2+0xa2e/0x1b50
  []  ip_output+0x1a8/0x2f0
  []  xfrm_output_resume+0x110e/0x15f0
  []  __xfrm4_output+0xe1/0x1b0
  []  xfrm4_output+0xa0/0x200
  []  iptunnel_xmit+0x5a7/0x920
  []  vxlan_xmit_one+0x1658/0x37a0 [vxlan]
  []  vxlan_xmit+0x5e4/0x3ec8 [vxlan]
  []  dev_hard_start_xmit+0x125/0x540
  []  __dev_queue_xmit+0x17bd/0x2320  <---
  []  ip6_finish_output2+0xb20/0x1b80
  []  ip6_output+0x1b3/0x390
  []  ip6_xmit+0xb82/0x17e0
  []  inet6_csk_xmit+0x225/0x3d0
  []  __tcp_transmit_skb+0x1763/0x3520
  []  tcp_write_xmit+0xd64/0x5fe0
  []  __tcp_push_pending_frames+0x8c/0x320
  []  tcp_sendmsg_locked+0x2245/0x3500
  []  tcp_sendmsg+0x27/0x40

As on the tx path of vxlan over esp, skb->inner_network_header would be
set on vxlan_xmit() and xfrm4_tunnel_encap_add(), and the later one can
overwrite the former one. It causes skb_udp_tunnel_segment() to use a
wrong skb->inner_network_header, then the issue occurs.

This patch is to fix it by calling xfrm_output_gso() instead when the
inner_protocol is set, in which gso_segment of inner_protocol will be
done first.

While at it, also improve some code around.

Fixes: 7862b4058b9f ("esp: Add gso handlers for esp4 and esp6")
Reported-by: Xiumei Mu 
Signed-off-by: Xin Long 
Signed-off-by: Steffen Klassert 
Signed-off-by: Greg Kroah-Hartman 

---
 net/xfrm/xfrm_output.c |   12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -583,18 +583,20 @@ int xfrm_output(struct sock *sk, struct
xfrm_state_hold(x);
 
if (skb_is_gso(skb)) {
-   skb_shinfo(skb)->gso_type |= SKB_GSO_ESP;
+   if (skb->inner_protocol)
+   return xfrm_output_gso(net, sk, skb);
 
-   return xfrm_output2(net, sk, skb);
+   skb_shinfo(skb)->gso_type |= SKB_GSO_ESP;
+   goto out;
}
 
if (x->xso.dev && x->xso.dev->features & NETIF_F_HW_ESP_TX_CSUM)
goto out;
+   } else {
+   if (skb_is_gso(skb))
+   return xfrm_output_gso(net, sk, skb);
}
 
-   if (skb_is_gso(skb))
-   return xfrm_output_gso(net, sk, skb);
-
if (skb->ip_summed == CHECKSUM_PARTIAL) {
err = skb_checksum_help(skb);
if (err) {




[PATCH 5.6 138/177] iommu: Fix reference count leak in iommu_group_alloc.

2020-06-01 Thread Greg Kroah-Hartman
From: Qiushi Wu 

[ Upstream commit 7cc31613734c4870ae32f5265d576ef296621343 ]

kobject_init_and_add() takes reference even when it fails.
Thus, when kobject_init_and_add() returns an error,
kobject_put() must be called to properly clean up the kobject.

Fixes: d72e31c93746 ("iommu: IOMMU Groups")
Signed-off-by: Qiushi Wu 
Link: https://lore.kernel.org/r/20200527210020.6522-1-wu000...@umn.edu
Signed-off-by: Joerg Roedel 
Signed-off-by: Sasha Levin 
---
 drivers/iommu/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 22b28076d48e..b09de25df02e 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -509,7 +509,7 @@ struct iommu_group *iommu_group_alloc(void)
   NULL, "%d", group->id);
if (ret) {
ida_simple_remove(&iommu_group_ida, group->id);
-   kfree(group);
+   kobject_put(&group->kobj);
return ERR_PTR(ret);
}
 
-- 
2.25.1





[PATCH 5.6 146/177] xfrm: remove the xfrm_state_put call becofe going to out_reset

2020-06-01 Thread Greg Kroah-Hartman
From: Xin Long 

commit db87668ad1e4917cfe04e217307ba6ed9390716e upstream.

This xfrm_state_put call in esp4/6_gro_receive() will cause
double put for state, as in out_reset path secpath_reset()
will put all states set in skb sec_path.

So fix it by simply remove the xfrm_state_put call.

Fixes: 6ed69184ed9c ("xfrm: Reset secpath in xfrm failure")
Signed-off-by: Xin Long 
Signed-off-by: Steffen Klassert 
Signed-off-by: Greg Kroah-Hartman 

---
 net/ipv4/esp4_offload.c |4 +---
 net/ipv6/esp6_offload.c |4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

--- a/net/ipv4/esp4_offload.c
+++ b/net/ipv4/esp4_offload.c
@@ -63,10 +63,8 @@ static struct sk_buff *esp4_gro_receive(
sp->olen++;
 
xo = xfrm_offload(skb);
-   if (!xo) {
-   xfrm_state_put(x);
+   if (!xo)
goto out_reset;
-   }
}
 
xo->flags |= XFRM_GRO;
--- a/net/ipv6/esp6_offload.c
+++ b/net/ipv6/esp6_offload.c
@@ -85,10 +85,8 @@ static struct sk_buff *esp6_gro_receive(
sp->olen++;
 
xo = xfrm_offload(skb);
-   if (!xo) {
-   xfrm_state_put(x);
+   if (!xo)
goto out_reset;
-   }
}
 
xo->flags |= XFRM_GRO;




[PATCH 5.6 151/177] xfrm: fix a NULL-ptr deref in xfrm_local_error

2020-06-01 Thread Greg Kroah-Hartman
From: Xin Long 

commit f6a23d85d078c2ffde79c66ca81d0a1dde451649 upstream.

This patch is to fix a crash:

  [ ] kasan: GPF could be caused by NULL-ptr deref or user memory access
  [ ] general protection fault:  [#1] SMP KASAN PTI
  [ ] RIP: 0010:ipv6_local_error+0xac/0x7a0
  [ ] Call Trace:
  [ ]  xfrm6_local_error+0x1eb/0x300
  [ ]  xfrm_local_error+0x95/0x130
  [ ]  __xfrm6_output+0x65f/0xb50
  [ ]  xfrm6_output+0x106/0x46f
  [ ]  udp_tunnel6_xmit_skb+0x618/0xbf0 [ip6_udp_tunnel]
  [ ]  vxlan_xmit_one+0xbc6/0x2c60 [vxlan]
  [ ]  vxlan_xmit+0x6a0/0x4276 [vxlan]
  [ ]  dev_hard_start_xmit+0x165/0x820
  [ ]  __dev_queue_xmit+0x1ff0/0x2b90
  [ ]  ip_finish_output2+0xd3e/0x1480
  [ ]  ip_do_fragment+0x182d/0x2210
  [ ]  ip_output+0x1d0/0x510
  [ ]  ip_send_skb+0x37/0xa0
  [ ]  raw_sendmsg+0x1b4c/0x2b80
  [ ]  sock_sendmsg+0xc0/0x110

This occurred when sending a v4 skb over vxlan6 over ipsec, in which case
skb->protocol == htons(ETH_P_IPV6) while skb->sk->sk_family == AF_INET in
xfrm_local_error(). Then it will go to xfrm6_local_error() where it tries
to get ipv6 info from a ipv4 sk.

This issue was actually fixed by Commit 628e341f319f ("xfrm: make local
error reporting more robust"), but brought back by Commit 844d48746e4b
("xfrm: choose protocol family by skb protocol").

So to fix it, we should call xfrm6_local_error() only when skb->protocol
is htons(ETH_P_IPV6) and skb->sk->sk_family is AF_INET6.

Fixes: 844d48746e4b ("xfrm: choose protocol family by skb protocol")
Reported-by: Xiumei Mu 
Signed-off-by: Xin Long 
Signed-off-by: Steffen Klassert 
Signed-off-by: Greg Kroah-Hartman 

---
 net/xfrm/xfrm_output.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -642,7 +642,8 @@ void xfrm_local_error(struct sk_buff *sk
 
if (skb->protocol == htons(ETH_P_IP))
proto = AF_INET;
-   else if (skb->protocol == htons(ETH_P_IPV6))
+   else if (skb->protocol == htons(ETH_P_IPV6) &&
+skb->sk->sk_family == AF_INET6)
proto = AF_INET6;
else
return;




[PATCH 5.6 155/177] netfilter: ipset: Fix subcounter update skip

2020-06-01 Thread Greg Kroah-Hartman
From: Phil Sutter 

commit a164b95ad6055c50612795882f35e0efda1f1390 upstream.

If IPSET_FLAG_SKIP_SUBCOUNTER_UPDATE is set, user requested to not
update counters in sub sets. Therefore IPSET_FLAG_SKIP_COUNTER_UPDATE
must be set, not unset.

Fixes: 6e01781d1c80e ("netfilter: ipset: set match: add support to match the 
counters")
Signed-off-by: Phil Sutter 
Signed-off-by: Pablo Neira Ayuso 
Signed-off-by: Greg Kroah-Hartman 

---
 net/netfilter/ipset/ip_set_list_set.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/netfilter/ipset/ip_set_list_set.c
+++ b/net/netfilter/ipset/ip_set_list_set.c
@@ -59,7 +59,7 @@ list_set_ktest(struct ip_set *set, const
/* Don't lookup sub-counters at all */
opt->cmdflags &= ~IPSET_FLAG_MATCH_COUNTERS;
if (opt->cmdflags & IPSET_FLAG_SKIP_SUBCOUNTER_UPDATE)
-   opt->cmdflags &= ~IPSET_FLAG_SKIP_COUNTER_UPDATE;
+   opt->cmdflags |= IPSET_FLAG_SKIP_COUNTER_UPDATE;
list_for_each_entry_rcu(e, &map->members, list) {
ret = ip_set_test(e->id, skb, par, opt);
if (ret <= 0)




[PATCH 5.6 166/177] crypto: chelsio/chtls: properly set tp->lsndtime

2020-06-01 Thread Greg Kroah-Hartman
From: Eric Dumazet 

commit a4976a3ef844c510ae9120290b23e9f3f47d6bce upstream.

TCP tp->lsndtime unit/base is tcp_jiffies32, not tcp_time_stamp()

Fixes: 36bedb3f2e5b ("crypto: chtls - Inline TLS record Tx")
Signed-off-by: Eric Dumazet 
Cc: Ayush Sawal 
Cc: Vinay Kumar Yadav 
Signed-off-by: David S. Miller 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/crypto/chelsio/chtls/chtls_io.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/crypto/chelsio/chtls/chtls_io.c
+++ b/drivers/crypto/chelsio/chtls/chtls_io.c
@@ -682,7 +682,7 @@ int chtls_push_frames(struct chtls_sock
make_tx_data_wr(sk, skb, immdlen, len,
credits_needed, completion);
tp->snd_nxt += len;
-   tp->lsndtime = tcp_time_stamp(tp);
+   tp->lsndtime = tcp_jiffies32;
if (completion)
ULP_SKB_CB(skb)->flags &= ~ULPCB_FLAG_NEED_HDR;
} else {




[PATCH 5.6 130/177] drm/amd/display: Fix potential integer wraparound resulting in a hang

2020-06-01 Thread Greg Kroah-Hartman
From: Aric Cyr 

[ Upstream commit 4e5183200d9b66695c754ef214933402056e7b95 ]

[Why]
If VUPDATE_END is before VUPDATE_START the delay calculated can become
very large, causing a soft hang.

[How]
Take the absolute value of the difference between START and END.

Signed-off-by: Aric Cyr 
Reviewed-by: Nicholas Kazlauskas 
Acked-by: Qingqing Zhuo 
Signed-off-by: Alex Deucher 
Cc: sta...@vger.kernel.org
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 2 ++
 1 file changed, 2 insertions(+)

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 60cea910759b..0c987b5d68e2 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
@@ -1651,6 +1651,8 @@ static void delay_cursor_until_vupdate(struct dc *dc, 
struct pipe_ctx *pipe_ctx)
return;
 
/* Stall out until the cursor update completes. */
+   if (vupdate_end < vupdate_start)
+   vupdate_end += stream->timing.v_total;
us_vupdate = (vupdate_end - vupdate_start + 1) * us_per_line;
udelay(us_to_vupdate + us_vupdate);
 }
-- 
2.25.1





[PATCH 5.6 131/177] IB/ipoib: Fix double free of skb in case of multicast traffic in CM mode

2020-06-01 Thread Greg Kroah-Hartman
From: Valentine Fatiev 

[ Upstream commit 1acba6a817852d4aa7916d5c4f2c82f702ee9224 ]

When connected mode is set, and we have connected and datagram traffic in
parallel, ipoib might crash with double free of datagram skb.

The current mechanism assumes that the order in the completion queue is
the same as the order of sent packets for all QPs. Order is kept only for
specific QP, in case of mixed UD and CM traffic we have few QPs (one UD and
few CM's) in parallel.

The problem:
--

Transmit queue:
-
UD skb pointer kept in queue itself, CM skb kept in spearate queue and
uses transmit queue as a placeholder to count the number of total
transmitted packets.

0   1   2   3   4  5  6  7  8   9  10  11 12 13 .127

NL ud1 UD2 CM1 ud3 cm2 cm3 ud4 cm4 ud5 NL NL NL ...

^  ^
   tail   head

Completion queue (problematic scenario) - the order not the same as in
the transmit queue:

  1  2  3  4  5  6  7  8  9

 ud1 CM1 UD2 ud3 cm2 cm3 ud4 cm4 ud5


1. CM1 'wc' processing
   - skb freed in cm separate ring.
   - tx_tail of transmit queue increased although UD2 is not freed.
 Now driver assumes UD2 index is already freed and it could be used for
 new transmitted skb.

0   1   2   3   4  5  6  7  8   9  10  11 12 13 .127

NL NL  UD2 CM1 ud3 cm2 cm3 ud4 cm4 ud5 NL NL NL ...

^   ^   ^
  (Bad)tailhead
(Bad - Could be used for new SKB)

In this case (due to heavy load) UD2 skb pointer could be replaced by new
transmitted packet UD_NEW, as the driver assumes its free.  At this point
we will have to process two 'wc' with same index but we have only one
pointer to free.

During second attempt to free the same skb we will have NULL pointer
exception.

2. UD2 'wc' processing
   - skb freed according the index we got from 'wc', but it was already
 overwritten by mistake. So actually the skb that was released is the
 skb of the new transmitted packet and not the original one.

3. UD_NEW 'wc' processing
   - attempt to free already freed skb. NUll pointer exception.

The fix:
---

The fix is to stop using the UD ring as a placeholder for CM packets, the
cyclic ring variables tx_head and tx_tail will manage the UD tx_ring, a
new cyclic variables global_tx_head and global_tx_tail are introduced for
managing and counting the overall outstanding sent packets, then the send
queue will be stopped and waken based on these variables only.

Note that no locking is needed since global_tx_head is updated in the xmit
flow and global_tx_tail is updated in the NAPI flow only.  A previous
attempt tried to use one variable to count the outstanding sent packets,
but it did not work since xmit and NAPI flows can run at the same time and
the counter will be updated wrongly. Thus, we use the same simple cyclic
head and tail scheme that we have today for the UD tx_ring.

Fixes: 2c104ea68350 ("IB/ipoib: Get rid of the tx_outstanding variable in all 
modes")
Link: https://lore.kernel.org/r/20200527134705.480068-1-l...@kernel.org
Signed-off-by: Valentine Fatiev 
Signed-off-by: Alaa Hleihel 
Signed-off-by: Leon Romanovsky 
Acked-by: Doug Ledford 
Signed-off-by: Jason Gunthorpe 
Signed-off-by: Sasha Levin 
---
 drivers/infiniband/ulp/ipoib/ipoib.h  |  4 
 drivers/infiniband/ulp/ipoib/ipoib_cm.c   | 15 +--
 drivers/infiniband/ulp/ipoib/ipoib_ib.c   |  9 +++--
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 10 ++
 4 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h 
b/drivers/infiniband/ulp/ipoib/ipoib.h
index 2aa3457a30ce..0e5f27caf2b2 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -377,8 +377,12 @@ struct ipoib_dev_priv {
struct ipoib_rx_buf *rx_ring;
 
struct ipoib_tx_buf *tx_ring;
+   /* cyclic ring variables for managing tx_ring, for UD only */
unsigned int tx_head;
unsigned int tx_tail;
+   /* cyclic ring variables for counting overall outstanding send WRs */
+   unsigned int global_tx_head;
+   unsigned int global_tx_tail;
struct ib_sgetx_sge[MAX_SKB_FRAGS + 1];
struct ib_ud_wr  tx_wr;
struct ib_wc send_wc[MAX_SEND_CQE];
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c 
b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index c59e00a0881f..9bf0fa30df28 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c

[PATCH 5.6 154/177] netfilter: nft_reject_bridge: enable reject with bridge vlan

2020-06-01 Thread Greg Kroah-Hartman
From: Michael Braun 

commit e9c284ec4b41c827f4369973d2792992849e4fa5 upstream.

Currently, using the bridge reject target with tagged packets
results in untagged packets being sent back.

Fix this by mirroring the vlan id as well.

Fixes: 85f5b3086a04 ("netfilter: bridge: add reject support")
Signed-off-by: Michael Braun 
Signed-off-by: Pablo Neira Ayuso 
Signed-off-by: Greg Kroah-Hartman 

---
 net/bridge/netfilter/nft_reject_bridge.c |6 ++
 1 file changed, 6 insertions(+)

--- a/net/bridge/netfilter/nft_reject_bridge.c
+++ b/net/bridge/netfilter/nft_reject_bridge.c
@@ -31,6 +31,12 @@ static void nft_reject_br_push_etherhdr(
ether_addr_copy(eth->h_dest, eth_hdr(oldskb)->h_source);
eth->h_proto = eth_hdr(oldskb)->h_proto;
skb_pull(nskb, ETH_HLEN);
+
+   if (skb_vlan_tag_present(oldskb)) {
+   u16 vid = skb_vlan_tag_get(oldskb);
+
+   __vlan_hwaccel_put_tag(nskb, oldskb->vlan_proto, vid);
+   }
 }
 
 static int nft_bridge_iphdr_validate(struct sk_buff *skb)




[PATCH 5.6 152/177] xfrm: fix error in comment

2020-06-01 Thread Greg Kroah-Hartman
From: Antony Antony 

commit 29e4276667e24ee6b91d9f91064d8fda9a210ea1 upstream.

s/xfrm_state_offload/xfrm_user_offload/

Fixes: d77e38e612a ("xfrm: Add an IPsec hardware offloading API")
Signed-off-by: Antony Antony 
Signed-off-by: Steffen Klassert 
Signed-off-by: Greg Kroah-Hartman 

---
 include/uapi/linux/xfrm.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/include/uapi/linux/xfrm.h
+++ b/include/uapi/linux/xfrm.h
@@ -304,7 +304,7 @@ enum xfrm_attr_type_t {
XFRMA_PROTO,/* __u8 */
XFRMA_ADDRESS_FILTER,   /* struct xfrm_address_filter */
XFRMA_PAD,
-   XFRMA_OFFLOAD_DEV,  /* struct xfrm_state_offload */
+   XFRMA_OFFLOAD_DEV,  /* struct xfrm_user_offload */
XFRMA_SET_MARK, /* __u32 */
XFRMA_SET_MARK_MASK,/* __u32 */
XFRMA_IF_ID,/* __u32 */




[PATCH 5.6 133/177] mm: remove VM_BUG_ON(PageSlab()) from page_mapcount()

2020-06-01 Thread Greg Kroah-Hartman
From: Konstantin Khlebnikov 

[ Upstream commit 6988f31d558aa8c744464a7f6d91d34ada48ad12 ]

Replace superfluous VM_BUG_ON() with comment about correct usage.

Technically reverts commit 1d148e218a0d ("mm: add VM_BUG_ON_PAGE() to
page_mapcount()"), but context lines have changed.

Function isolate_migratepages_block() runs some checks out of lru_lock
when choose pages for migration.  After checking PageLRU() it checks
extra page references by comparing page_count() and page_mapcount().
Between these two checks page could be removed from lru, freed and taken
by slab.

As a result this race triggers VM_BUG_ON(PageSlab()) in page_mapcount().
Race window is tiny.  For certain workload this happens around once a
year.

page:ea0105ca9380 count:1 mapcount:0 mapping:88ff7712c180 index:0x0 
compound_mapcount: 0
flags: 0x5008100(slab|head)
raw: 05008100 dead0100 dead0200 88ff7712c180
raw:  80200020 0001 
page dumped because: VM_BUG_ON_PAGE(PageSlab(page))
[ cut here ]
kernel BUG at ./include/linux/mm.h:628!
invalid opcode:  [#1] SMP NOPTI
CPU: 77 PID: 504 Comm: kcompactd1 Tainted: GW 4.19.109-27 #1
Hardware name: Yandex T175-N41-Y3N/MY81-EX0-Y3N, BIOS R05 06/20/2019
RIP: 0010:isolate_migratepages_block+0x986/0x9b0

The code in isolate_migratepages_block() was added in commit
119d6d59dcc0 ("mm, compaction: avoid isolating pinned pages") before
adding VM_BUG_ON into page_mapcount().

This race has been predicted in 2015 by Vlastimil Babka (see link
below).

[a...@linux-foundation.org: comment tweaks, per Hugh]
Fixes: 1d148e218a0d ("mm: add VM_BUG_ON_PAGE() to page_mapcount()")
Signed-off-by: Konstantin Khlebnikov 
Signed-off-by: Andrew Morton 
Acked-by: Hugh Dickins 
Acked-by: Kirill A. Shutemov 
Acked-by: Vlastimil Babka 
Cc: David Rientjes 
Cc: 
Link: 
http://lkml.kernel.org/r/159032779896.957378.7852761411265662220.stgit@buzz
Link: https://lore.kernel.org/lkml/557710e1.6060...@suse.cz/
Link: 
https://lore.kernel.org/linux-mm/158937872515.474360.5066096871639561424.stgit@buzz/T/
 (v1)
Signed-off-by: Linus Torvalds 
Signed-off-by: Sasha Levin 
---
 include/linux/mm.h | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index c54fb96cb1e6..96deeecd9179 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -670,6 +670,11 @@ static inline void *kvcalloc(size_t n, size_t size, gfp_t 
flags)
 
 extern void kvfree(const void *addr);
 
+/*
+ * Mapcount of compound page as a whole, does not include mapped sub-pages.
+ *
+ * Must be called only for compound pages or any their tail sub-pages.
+ */
 static inline int compound_mapcount(struct page *page)
 {
VM_BUG_ON_PAGE(!PageCompound(page), page);
@@ -689,10 +694,16 @@ static inline void page_mapcount_reset(struct page *page)
 
 int __page_mapcount(struct page *page);
 
+/*
+ * Mapcount of 0-order page; when compound sub-page, includes
+ * compound_mapcount().
+ *
+ * Result is undefined for pages which cannot be mapped into userspace.
+ * For example SLAB or special types of pages. See function page_has_type().
+ * They use this place in struct page differently.
+ */
 static inline int page_mapcount(struct page *page)
 {
-   VM_BUG_ON_PAGE(PageSlab(page), page);
-
if (unlikely(PageCompound(page)))
return __page_mapcount(page);
return atomic_read(&page->_mapcount) + 1;
-- 
2.25.1





[PATCH 5.6 159/177] esp6: get the right proto for transport mode in esp6_gso_encap

2020-06-01 Thread Greg Kroah-Hartman
From: Xin Long 

commit 3c96ec56828922e3fe5477f75eb3fc02f98f98b5 upstream.

For transport mode, when ipv6 nexthdr is set, the packet format might
be like:


|| dest | | |  |  ESP| ESP |
| IP6 hdr| opts.| ESP | TCP | Data | Trailer | ICV |


What it wants to get for x-proto in esp6_gso_encap() is the proto that
will be set in ESP nexthdr. So it should skip all ipv6 nexthdrs and
get the real transport protocol. Othersize, the wrong proto number
will be set into ESP nexthdr.

This patch is to skip all ipv6 nexthdrs by calling ipv6_skip_exthdr()
in esp6_gso_encap().

Fixes: 7862b4058b9f ("esp: Add gso handlers for esp4 and esp6")
Signed-off-by: Xin Long 
Signed-off-by: Steffen Klassert 
Signed-off-by: Greg Kroah-Hartman 

---
 net/ipv6/esp6_offload.c |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

--- a/net/ipv6/esp6_offload.c
+++ b/net/ipv6/esp6_offload.c
@@ -121,9 +121,16 @@ static void esp6_gso_encap(struct xfrm_s
struct ip_esp_hdr *esph;
struct ipv6hdr *iph = ipv6_hdr(skb);
struct xfrm_offload *xo = xfrm_offload(skb);
-   int proto = iph->nexthdr;
+   u8 proto = iph->nexthdr;
 
skb_push(skb, -skb_network_offset(skb));
+
+   if (x->outer_mode.encap == XFRM_MODE_TRANSPORT) {
+   __be16 frag;
+
+   ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &proto, &frag);
+   }
+
esph = ip_esp_hdr(skb);
*skb_mac_header(skb) = IPPROTO_ESP;
 




[PATCH 5.6 126/177] drm/amd/display: Indicate dsc updates explicitly

2020-06-01 Thread Greg Kroah-Hartman
From: Anthony Koo 

[ Upstream commit acdac228c4d1b9ff8ac778835719d3381c198aad ]

[Why]
DSC updates only set type to FULL UPDATE, but doesn't
flag the change

[How]
Add DSC flag update flag

Signed-off-by: Anthony Koo 
Reviewed-by: Aric Cyr 
Acked-by: Bhawanpreet Lakha 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/dc/core/dc.c   | 19 ---
 drivers/gpu/drm/amd/display/dc/dc_stream.h |  1 +
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c 
b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 66be2920fab0..2667691ba2aa 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -1745,14 +1745,15 @@ static enum surface_update_type 
check_update_surfaces_for_stream(
 
if (stream_update->wb_update)
su_flags->bits.wb_update = 1;
+
+   if (stream_update->dsc_config)
+   su_flags->bits.dsc_changed = 1;
+
if (su_flags->raw != 0)
overall_type = UPDATE_TYPE_FULL;
 
if (stream_update->output_csc_transform || 
stream_update->output_color_space)
su_flags->bits.out_csc = 1;
-
-   if (stream_update->dsc_config)
-   overall_type = UPDATE_TYPE_FULL;
}
 
for (i = 0 ; i < surface_count; i++) {
@@ -1787,8 +1788,11 @@ enum surface_update_type 
dc_check_update_surfaces_for_stream(
 
type = check_update_surfaces_for_stream(dc, updates, surface_count, 
stream_update, stream_status);
if (type == UPDATE_TYPE_FULL) {
-   if (stream_update)
+   if (stream_update) {
+   uint32_t dsc_changed = 
stream_update->stream->update_flags.bits.dsc_changed;
stream_update->stream->update_flags.raw = 0x;
+   stream_update->stream->update_flags.bits.dsc_changed = 
dsc_changed;
+   }
for (i = 0; i < surface_count; i++)
updates[i].surface->update_flags.raw = 0x;
}
@@ -2104,14 +2108,15 @@ static void commit_planes_do_stream_update(struct dc 
*dc,
}
}
 
+   /* Full fe update*/
+   if (update_type == UPDATE_TYPE_FAST)
+   continue;
+
if (stream_update->dsc_config && 
dc->hwss.pipe_control_lock_global) {
dc->hwss.pipe_control_lock_global(dc, pipe_ctx, 
true);
dp_update_dsc_config(pipe_ctx);
dc->hwss.pipe_control_lock_global(dc, pipe_ctx, 
false);
}
-   /* Full fe update*/
-   if (update_type == UPDATE_TYPE_FAST)
-   continue;
 
if (stream_update->dpms_off) {
dc->hwss.pipe_control_lock(dc, pipe_ctx, true);
diff --git a/drivers/gpu/drm/amd/display/dc/dc_stream.h 
b/drivers/gpu/drm/amd/display/dc/dc_stream.h
index 92096de79dec..a5c7ef47b8d3 100644
--- a/drivers/gpu/drm/amd/display/dc/dc_stream.h
+++ b/drivers/gpu/drm/amd/display/dc/dc_stream.h
@@ -118,6 +118,7 @@ union stream_update_flags {
uint32_t dpms_off:1;
uint32_t gamut_remap:1;
uint32_t wb_update:1;
+   uint32_t dsc_changed : 1;
} bits;
 
uint32_t raw;
-- 
2.25.1





[PATCH 5.6 167/177] nexthops: Move code from remove_nexthop_from_groups to remove_nh_grp_entry

2020-06-01 Thread Greg Kroah-Hartman
From: David Ahern 

commit ac21753a5c2c9a6a2019997481a2ac12bbde48c8 upstream.

Move nh_grp dereference and check for removing nexthop group due to
all members gone into remove_nh_grp_entry.

Fixes: 430a049190de ("nexthop: Add support for nexthop groups")
Signed-off-by: David Ahern 
Acked-by: Nikolay Aleksandrov 
Signed-off-by: David S. Miller 
Signed-off-by: Greg Kroah-Hartman 

---
 net/ipv4/nexthop.c |   27 +--
 1 file changed, 13 insertions(+), 14 deletions(-)

--- a/net/ipv4/nexthop.c
+++ b/net/ipv4/nexthop.c
@@ -694,17 +694,21 @@ static void nh_group_rebalance(struct nh
}
 }
 
-static void remove_nh_grp_entry(struct nh_grp_entry *nhge,
-   struct nh_group *nhg,
+static void remove_nh_grp_entry(struct net *net, struct nh_grp_entry *nhge,
struct nl_info *nlinfo)
 {
+   struct nexthop *nhp = nhge->nh_parent;
struct nexthop *nh = nhge->nh;
struct nh_grp_entry *nhges;
+   struct nh_group *nhg;
bool found = false;
int i;
 
WARN_ON(!nh);
 
+   list_del(&nhge->nh_list);
+
+   nhg = rtnl_dereference(nhp->nh_grp);
nhges = nhg->nh_entries;
for (i = 0; i < nhg->num_nh; ++i) {
if (found) {
@@ -728,7 +732,11 @@ static void remove_nh_grp_entry(struct n
nexthop_put(nh);
 
if (nlinfo)
-   nexthop_notify(RTM_NEWNEXTHOP, nhge->nh_parent, nlinfo);
+   nexthop_notify(RTM_NEWNEXTHOP, nhp, nlinfo);
+
+   /* if this group has no more entries then remove it */
+   if (!nhg->num_nh)
+   remove_nexthop(net, nhp, nlinfo);
 }
 
 static void remove_nexthop_from_groups(struct net *net, struct nexthop *nh,
@@ -736,17 +744,8 @@ static void remove_nexthop_from_groups(s
 {
struct nh_grp_entry *nhge, *tmp;
 
-   list_for_each_entry_safe(nhge, tmp, &nh->grp_list, nh_list) {
-   struct nh_group *nhg;
-
-   list_del(&nhge->nh_list);
-   nhg = rtnl_dereference(nhge->nh_parent->nh_grp);
-   remove_nh_grp_entry(nhge, nhg, nlinfo);
-
-   /* if this group has no more entries then remove it */
-   if (!nhg->num_nh)
-   remove_nexthop(net, nhge->nh_parent, nlinfo);
-   }
+   list_for_each_entry_safe(nhge, tmp, &nh->grp_list, nh_list)
+   remove_nh_grp_entry(net, nhge, nlinfo);
 }
 
 static void remove_nexthop_group(struct nexthop *nh, struct nl_info *nlinfo)




[PATCH 5.6 161/177] bnxt_en: fix firmware message length endianness

2020-06-01 Thread Greg Kroah-Hartman
From: Edwin Peer 

commit 2a5a8800fa915bd9bc272c91ca64728e6aa84c0a upstream.

The explicit mask and shift is not the appropriate way to parse fields
out of a little endian struct. The length field is internally __le16
and the strategy employed only happens to work on little endian machines
because the offset used is actually incorrect (length is at offset 6).

Also remove the related and no longer used definitions from bnxt.h.

Fixes: 845adfe40c2a ("bnxt_en: Improve valid bit checking in firmware response 
message.")
Signed-off-by: Edwin Peer 
Signed-off-by: Michael Chan 
Signed-off-by: David S. Miller 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c |   14 --
 drivers/net/ethernet/broadcom/bnxt/bnxt.h |5 -
 2 files changed, 4 insertions(+), 15 deletions(-)

--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -4184,14 +4184,12 @@ static int bnxt_hwrm_do_send_msg(struct
int i, intr_process, rc, tmo_count;
struct input *req = msg;
u32 *data = msg;
-   __le32 *resp_len;
u8 *valid;
u16 cp_ring_id, len = 0;
struct hwrm_err_output *resp = bp->hwrm_cmd_resp_addr;
u16 max_req_len = BNXT_HWRM_MAX_REQ_LEN;
struct hwrm_short_input short_input = {0};
u32 doorbell_offset = BNXT_GRCPF_REG_CHIMP_COMM_TRIGGER;
-   u8 *resp_addr = (u8 *)bp->hwrm_cmd_resp_addr;
u32 bar_offset = BNXT_GRCPF_REG_CHIMP_COMM;
u16 dst = BNXT_HWRM_CHNL_CHIMP;
 
@@ -4209,7 +4207,6 @@ static int bnxt_hwrm_do_send_msg(struct
bar_offset = BNXT_GRCPF_REG_KONG_COMM;
doorbell_offset = BNXT_GRCPF_REG_KONG_COMM_TRIGGER;
resp = bp->hwrm_cmd_kong_resp_addr;
-   resp_addr = (u8 *)bp->hwrm_cmd_kong_resp_addr;
}
 
memset(resp, 0, PAGE_SIZE);
@@ -4278,7 +4275,6 @@ static int bnxt_hwrm_do_send_msg(struct
tmo_count = HWRM_SHORT_TIMEOUT_COUNTER;
timeout = timeout - HWRM_SHORT_MIN_TIMEOUT * HWRM_SHORT_TIMEOUT_COUNTER;
tmo_count += DIV_ROUND_UP(timeout, HWRM_MIN_TIMEOUT);
-   resp_len = (__le32 *)(resp_addr + HWRM_RESP_LEN_OFFSET);
 
if (intr_process) {
u16 seq_id = bp->hwrm_intr_seq_id;
@@ -4306,9 +4302,8 @@ static int bnxt_hwrm_do_send_msg(struct
   le16_to_cpu(req->req_type));
return -EBUSY;
}
-   len = (le32_to_cpu(*resp_len) & HWRM_RESP_LEN_MASK) >>
- HWRM_RESP_LEN_SFT;
-   valid = resp_addr + len - 1;
+   len = le16_to_cpu(resp->resp_len);
+   valid = ((u8 *)resp) + len - 1;
} else {
int j;
 
@@ -4319,8 +4314,7 @@ static int bnxt_hwrm_do_send_msg(struct
 */
if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state))
return -EBUSY;
-   len = (le32_to_cpu(*resp_len) & HWRM_RESP_LEN_MASK) >>
- HWRM_RESP_LEN_SFT;
+   len = le16_to_cpu(resp->resp_len);
if (len)
break;
/* on first few passes, just barely sleep */
@@ -4342,7 +4336,7 @@ static int bnxt_hwrm_do_send_msg(struct
}
 
/* Last byte of resp contains valid bit */
-   valid = resp_addr + len - 1;
+   valid = ((u8 *)resp) + len - 1;
for (j = 0; j < HWRM_VALID_BIT_DELAY_USEC; j++) {
/* make sure we read from updated DMA memory */
dma_rmb();
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
@@ -654,11 +654,6 @@ struct nqe_cn {
 #define HWRM_CMD_TIMEOUT   (bp->hwrm_cmd_timeout)
 #define HWRM_RESET_TIMEOUT ((HWRM_CMD_TIMEOUT) * 4)
 #define HWRM_COREDUMP_TIMEOUT  ((HWRM_CMD_TIMEOUT) * 12)
-#define HWRM_RESP_ERR_CODE_MASK0x
-#define HWRM_RESP_LEN_OFFSET   4
-#define HWRM_RESP_LEN_MASK 0x
-#define HWRM_RESP_LEN_SFT  16
-#define HWRM_RESP_VALID_MASK   0xff00
 #define BNXT_HWRM_REQ_MAX_SIZE 128
 #define BNXT_HWRM_REQS_PER_PAGE(BNXT_PAGE_SIZE /   \
 BNXT_HWRM_REQ_MAX_SIZE)




[PATCH 5.6 170/177] ipv4: nexthop version of fib_info_nh_uses_dev

2020-06-01 Thread Greg Kroah-Hartman
From: David Ahern 

commit 1fd1c768f3624a5e66766e7b4ddb9b607cd834a5 upstream.

Similar to the last path, need to fix fib_info_nh_uses_dev for
external nexthops to avoid referencing multiple nh_grp structs.
Move the device check in fib_info_nh_uses_dev to a helper and
create a nexthop version that is called if the fib_info uses an
external nexthop.

Fixes: 430a049190de ("nexthop: Add support for nexthop groups")
Signed-off-by: David Ahern 
Acked-by: Nikolay Aleksandrov 
Signed-off-by: David S. Miller 
Signed-off-by: Greg Kroah-Hartman 

---
 include/net/ip_fib.h|   10 ++
 include/net/nexthop.h   |   25 +
 net/ipv4/fib_frontend.c |   19 ++-
 3 files changed, 45 insertions(+), 9 deletions(-)

--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -447,6 +447,16 @@ static inline int fib_num_tclassid_users
 #endif
 int fib_unmerge(struct net *net);
 
+static inline bool nhc_l3mdev_matches_dev(const struct fib_nh_common *nhc,
+const struct net_device *dev)
+{
+   if (nhc->nhc_dev == dev ||
+   l3mdev_master_ifindex_rcu(nhc->nhc_dev) == dev->ifindex)
+   return true;
+
+   return false;
+}
+
 /* Exported by fib_semantics.c */
 int ip_fib_check_default(__be32 gw, struct net_device *dev);
 int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool force);
--- a/include/net/nexthop.h
+++ b/include/net/nexthop.h
@@ -233,6 +233,31 @@ struct fib_nh_common *nexthop_fib_nhc(st
return &nhi->fib_nhc;
 }
 
+static inline bool nexthop_uses_dev(const struct nexthop *nh,
+   const struct net_device *dev)
+{
+   struct nh_info *nhi;
+
+   if (nh->is_group) {
+   struct nh_group *nhg = rcu_dereference(nh->nh_grp);
+   int i;
+
+   for (i = 0; i < nhg->num_nh; i++) {
+   struct nexthop *nhe = nhg->nh_entries[i].nh;
+
+   nhi = rcu_dereference(nhe->nh_info);
+   if (nhc_l3mdev_matches_dev(&nhi->fib_nhc, dev))
+   return true;
+   }
+   } else {
+   nhi = rcu_dereference(nh->nh_info);
+   if (nhc_l3mdev_matches_dev(&nhi->fib_nhc, dev))
+   return true;
+   }
+
+   return false;
+}
+
 static inline unsigned int fib_info_num_path(const struct fib_info *fi)
 {
if (unlikely(fi->nh))
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -309,17 +309,18 @@ bool fib_info_nh_uses_dev(struct fib_inf
 {
bool dev_match = false;
 #ifdef CONFIG_IP_ROUTE_MULTIPATH
-   int ret;
+   if (unlikely(fi->nh)) {
+   dev_match = nexthop_uses_dev(fi->nh, dev);
+   } else {
+   int ret;
 
-   for (ret = 0; ret < fib_info_num_path(fi); ret++) {
-   const struct fib_nh_common *nhc = fib_info_nhc(fi, ret);
+   for (ret = 0; ret < fib_info_num_path(fi); ret++) {
+   const struct fib_nh_common *nhc = fib_info_nhc(fi, ret);
 
-   if (nhc->nhc_dev == dev) {
-   dev_match = true;
-   break;
-   } else if (l3mdev_master_ifindex_rcu(nhc->nhc_dev) == 
dev->ifindex) {
-   dev_match = true;
-   break;
+   if (nhc_l3mdev_matches_dev(nhc, dev)) {
+   dev_match = true;
+   break;
+   }
}
}
 #else




[PATCH 5.6 129/177] drm/amd/display: Defer cursor lock until after VUPDATE

2020-06-01 Thread Greg Kroah-Hartman
From: Nicholas Kazlauskas 

[ Upstream commit 31ecebee9c36d5e5e113a357a655d993fa916174 ]

[Why]
We dropped the delay after changed the cursor functions locking the
entire pipe to locking just the CURSOR registers to fix page flip
stuttering - this introduced cursor stuttering instead, and an underflow
issue.

The cursor update can be delayed indefinitely if the cursor update
repeatedly happens right around VUPDATE.

The underflow issue can happen if we do a viewport update on a pipe
on the same frame where a cursor update happens around VUPDATE - the
old cursor registers are retained which can be in an invalid position.

This can cause a pipe hang and indefinite underflow.

[How]
The complex, ideal solution to the problem would be a software
triple buffering mechanism from the DM layer to program only one cursor
update per frame just before VUPDATE.

The simple workaround until we have that infrastructure in place is
this change - bring back the delay until VUPDATE before locking, but
with some corrections to the calculations.

This didn't work for all timings before because the calculation for
VUPDATE was wrong - it was using the offset from VSTARTUP instead and
didn't correctly handle the case where VUPDATE could be in the back
porch.

Add a new hardware sequencer function to use the existing helper to
calculate the real VUPDATE start and VUPDATE end - VUPDATE can last
multiple lines after all.

Change the udelay to incorporate the width of VUPDATE as well.

Signed-off-by: Nicholas Kazlauskas 
Reviewed-by: Aric Cyr 
Acked-by: Rodrigo Siqueira 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 69 ++-
 .../amd/display/dc/dcn10/dcn10_hw_sequencer.h |  5 ++
 .../gpu/drm/amd/display/dc/dcn10/dcn10_init.c |  1 +
 .../gpu/drm/amd/display/dc/dcn20/dcn20_init.c |  1 +
 .../gpu/drm/amd/display/dc/dcn21/dcn21_init.c |  1 +
 .../gpu/drm/amd/display/dc/inc/hw_sequencer.h |  5 ++
 6 files changed, 81 insertions(+), 1 deletion(-)

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 97a820b90541..60cea910759b 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
@@ -1592,12 +1592,79 @@ void dcn10_pipe_control_lock(
hws->funcs.verify_allow_pstate_change_high(dc);
 }
 
+/**
+ * delay_cursor_until_vupdate() - Delay cursor update if too close to VUPDATE.
+ *
+ * Software keepout workaround to prevent cursor update locking from stalling
+ * out cursor updates indefinitely or from old values from being retained in
+ * the case where the viewport changes in the same frame as the cursor.
+ *
+ * The idea is to calculate the remaining time from VPOS to VUPDATE. If it's
+ * too close to VUPDATE, then stall out until VUPDATE finishes.
+ *
+ * TODO: Optimize cursor programming to be once per frame before VUPDATE
+ *   to avoid the need for this workaround.
+ */
+static void delay_cursor_until_vupdate(struct dc *dc, struct pipe_ctx 
*pipe_ctx)
+{
+   struct dc_stream_state *stream = pipe_ctx->stream;
+   struct crtc_position position;
+   uint32_t vupdate_start, vupdate_end;
+   unsigned int lines_to_vupdate, us_to_vupdate, vpos;
+   unsigned int us_per_line, us_vupdate;
+
+   if (!dc->hwss.calc_vupdate_position || !dc->hwss.get_position)
+   return;
+
+   if (!pipe_ctx->stream_res.stream_enc || !pipe_ctx->stream_res.tg)
+   return;
+
+   dc->hwss.calc_vupdate_position(dc, pipe_ctx, &vupdate_start,
+  &vupdate_end);
+
+   dc->hwss.get_position(&pipe_ctx, 1, &position);
+   vpos = position.vertical_count;
+
+   /* Avoid wraparound calculation issues */
+   vupdate_start += stream->timing.v_total;
+   vupdate_end += stream->timing.v_total;
+   vpos += stream->timing.v_total;
+
+   if (vpos <= vupdate_start) {
+   /* VPOS is in VACTIVE or back porch. */
+   lines_to_vupdate = vupdate_start - vpos;
+   } else if (vpos > vupdate_end) {
+   /* VPOS is in the front porch. */
+   return;
+   } else {
+   /* VPOS is in VUPDATE. */
+   lines_to_vupdate = 0;
+   }
+
+   /* Calculate time until VUPDATE in microseconds. */
+   us_per_line =
+   stream->timing.h_total * 1u / stream->timing.pix_clk_100hz;
+   us_to_vupdate = lines_to_vupdate * us_per_line;
+
+   /* 70 us is a conservative estimate of cursor update time*/
+   if (us_to_vupdate > 70)
+   return;
+
+   /* Stall out until the cursor update completes. */
+   us_vupdate = (vupdate_end - vupdate_start + 1) * us_per_line;
+   udelay(us_to_vupdate + us_vupdate);
+}
+
 void dcn10_cursor_lock(struct dc *dc, struct pipe_ctx *pipe, bool lock)
 {
/* cursor lock is per M

[PATCH 5.6 157/177] netfilter: nfnetlink_cthelper: unbreak userspace helper support

2020-06-01 Thread Greg Kroah-Hartman
From: Pablo Neira Ayuso 

commit 703acd70f2496537457186211c2f03e792409e68 upstream.

Restore helper data size initialization and fix memcopy of the helper
data size.

Fixes: 157eb5dc ("netfilter: nfnetlink_cthelper: reject too large userspace 
allocation requests")
Reviewed-by: Florian Westphal 
Signed-off-by: Pablo Neira Ayuso 
Signed-off-by: Greg Kroah-Hartman 

---
 net/netfilter/nfnetlink_cthelper.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/net/netfilter/nfnetlink_cthelper.c
+++ b/net/netfilter/nfnetlink_cthelper.c
@@ -103,7 +103,7 @@ nfnl_cthelper_from_nlattr(struct nlattr
if (help->helper->data_len == 0)
return -EINVAL;
 
-   nla_memcpy(help->data, nla_data(attr), sizeof(help->data));
+   nla_memcpy(help->data, attr, sizeof(help->data));
return 0;
 }
 
@@ -240,6 +240,7 @@ nfnl_cthelper_create(const struct nlattr
ret = -ENOMEM;
goto err2;
}
+   helper->data_len = size;
 
helper->flags |= NF_CT_HELPER_F_USERSPACE;
memcpy(&helper->tuple, tuple, sizeof(struct nf_conntrack_tuple));




[PATCH 5.6 171/177] net: dsa: declare lockless TX feature for slave ports

2020-06-01 Thread Greg Kroah-Hartman
From: Vladimir Oltean 

commit 2b86cb8299765688c5119fd18d5f436716c81010 upstream.

Be there a platform with the following layout:

  Regular NIC
   |
   +> DSA master for switch port
   |
   +> DSA master for another switch port

After changing DSA back to static lockdep class keys in commit
1a33e10e4a95 ("net: partially revert dynamic lockdep key changes"), this
kernel splat can be seen:

[   13.361198] 
[   13.366524] WARNING: possible recursive locking detected
[   13.371851] 5.7.0-rc4-02121-gc32a05ecd7af-dirty #988 Not tainted
[   13.377874] 
[   13.383201] swapper/0/0 is trying to acquire lock:
[   13.388004] 668ff298 (&dsa_slave_netdev_xmit_lock_key){+.-.}-{2:2}, 
at: __dev_queue_xmit+0x84c/0xbe0
[   13.397879]
[   13.397879] but task is already holding lock:
[   13.403727] 661a1698 (&dsa_slave_netdev_xmit_lock_key){+.-.}-{2:2}, 
at: __dev_queue_xmit+0x84c/0xbe0
[   13.413593]
[   13.413593] other info that might help us debug this:
[   13.420140]  Possible unsafe locking scenario:
[   13.420140]
[   13.426075]CPU0
[   13.428523]
[   13.430969]   lock(&dsa_slave_netdev_xmit_lock_key);
[   13.435946]   lock(&dsa_slave_netdev_xmit_lock_key);
[   13.440924]
[   13.440924]  *** DEADLOCK ***
[   13.440924]
[   13.446860]  May be due to missing lock nesting notation
[   13.446860]
[   13.453668] 6 locks held by swapper/0/0:
[   13.457598]  #0: 800010003de0 ((&idev->mc_ifc_timer)){+.-.}-{0:0}, at: 
call_timer_fn+0x0/0x400
[   13.466593]  #1: d4d3fb478700 (rcu_read_lock){}-{1:2}, at: 
mld_sendpack+0x0/0x560
[   13.474803]  #2: d4d3fb478728 (rcu_read_lock_bh){}-{1:2}, at: 
ip6_finish_output2+0x64/0xb10
[   13.483886]  #3: d4d3fb478728 (rcu_read_lock_bh){}-{1:2}, at: 
__dev_queue_xmit+0x6c/0xbe0
[   13.492793]  #4: 661a1698 
(&dsa_slave_netdev_xmit_lock_key){+.-.}-{2:2}, at: __dev_queue_xmit+0x84c/0xbe0
[   13.503094]  #5: d4d3fb478728 (rcu_read_lock_bh){}-{1:2}, at: 
__dev_queue_xmit+0x6c/0xbe0
[   13.512000]
[   13.512000] stack backtrace:
[   13.516369] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 
5.7.0-rc4-02121-gc32a05ecd7af-dirty #988
[   13.530421] Call trace:
[   13.532871]  dump_backtrace+0x0/0x1d8
[   13.536539]  show_stack+0x24/0x30
[   13.539862]  dump_stack+0xe8/0x150
[   13.543271]  __lock_acquire+0x1030/0x1678
[   13.547290]  lock_acquire+0xf8/0x458
[   13.550873]  _raw_spin_lock+0x44/0x58
[   13.554543]  __dev_queue_xmit+0x84c/0xbe0
[   13.558562]  dev_queue_xmit+0x24/0x30
[   13.562232]  dsa_slave_xmit+0xe0/0x128
[   13.565988]  dev_hard_start_xmit+0xf4/0x448
[   13.570182]  __dev_queue_xmit+0x808/0xbe0
[   13.574200]  dev_queue_xmit+0x24/0x30
[   13.577869]  neigh_resolve_output+0x15c/0x220
[   13.582237]  ip6_finish_output2+0x244/0xb10
[   13.586430]  __ip6_finish_output+0x1dc/0x298
[   13.590709]  ip6_output+0x84/0x358
[   13.594116]  mld_sendpack+0x2bc/0x560
[   13.597786]  mld_ifc_timer_expire+0x210/0x390
[   13.602153]  call_timer_fn+0xcc/0x400
[   13.605822]  run_timer_softirq+0x588/0x6e0
[   13.609927]  __do_softirq+0x118/0x590
[   13.613597]  irq_exit+0x13c/0x148
[   13.616918]  __handle_domain_irq+0x6c/0xc0
[   13.621023]  gic_handle_irq+0x6c/0x160
[   13.624779]  el1_irq+0xbc/0x180
[   13.627927]  cpuidle_enter_state+0xb4/0x4d0
[   13.632120]  cpuidle_enter+0x3c/0x50
[   13.635703]  call_cpuidle+0x44/0x78
[   13.639199]  do_idle+0x228/0x2c8
[   13.642433]  cpu_startup_entry+0x2c/0x48
[   13.646363]  rest_init+0x1ac/0x280
[   13.649773]  arch_call_rest_init+0x14/0x1c
[   13.653878]  start_kernel+0x490/0x4bc

Lockdep keys themselves were added in commit ab92d68fc22f ("net: core:
add generic lockdep keys"), and it's very likely that this splat existed
since then, but I have no real way to check, since this stacked platform
wasn't supported by mainline back then.

>From Taehee's own words:

  This patch was considered that all stackable devices have LLTX flag.
  But the dsa doesn't have LLTX, so this splat happened.
  After this patch, dsa shares the same lockdep class key.
  On the nested dsa interface architecture, which you illustrated,
  the same lockdep class key will be used in __dev_queue_xmit() because
  dsa doesn't have LLTX.
  So that lockdep detects deadlock because the same lockdep class key is
  used recursively although actually the different locks are used.
  There are some ways to fix this problem.

  1. using NETIF_F_LLTX flag.
  If possible, using the LLTX flag is a very clear way for it.
  But I'm so sorry I don't know whether the dsa could have LLTX or not.

  2. using dynamic lockdep again.
  It means that each interface uses a separate lockdep class key.
  So, lockdep will not detect recursive locking.
  But this way has a problem that it could consume lockdep class key
  too many.
  Currently, lockdep can have 8192 lockdep class keys.
   - you can see this n

[PATCH 5.6 177/177] netfilter: nf_conntrack_pptp: fix compilation warning with W=1 build

2020-06-01 Thread Greg Kroah-Hartman
From: Pablo Neira Ayuso 

commit 4946ea5c1237036155c3b3a24f049fd5f849f8f6 upstream.

>> include/linux/netfilter/nf_conntrack_pptp.h:13:20: warning: 'const' type 
>> qualifier on return type has no effect [-Wignored-qualifiers]
extern const char *const pptp_msg_name(u_int16_t msg);
^~

Reported-by: kbuild test robot 
Fixes: 4c559f15efcc ("netfilter: nf_conntrack_pptp: prevent buffer overflows in 
debug code")
Signed-off-by: Pablo Neira Ayuso 
Signed-off-by: Greg Kroah-Hartman 

---
 include/linux/netfilter/nf_conntrack_pptp.h |2 +-
 net/netfilter/nf_conntrack_pptp.c   |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--- a/include/linux/netfilter/nf_conntrack_pptp.h
+++ b/include/linux/netfilter/nf_conntrack_pptp.h
@@ -10,7 +10,7 @@
 #include 
 #include 
 
-extern const char *const pptp_msg_name(u_int16_t msg);
+const char *pptp_msg_name(u_int16_t msg);
 
 /* state of the control session */
 enum pptp_ctrlsess_state {
--- a/net/netfilter/nf_conntrack_pptp.c
+++ b/net/netfilter/nf_conntrack_pptp.c
@@ -91,7 +91,7 @@ static const char *const pptp_msg_name_a
[PPTP_SET_LINK_INFO]= "SET_LINK_INFO"
 };
 
-const char *const pptp_msg_name(u_int16_t msg)
+const char *pptp_msg_name(u_int16_t msg)
 {
if (msg > PPTP_MSG_MAX)
return pptp_msg_name_array[0];




[PATCH 5.6 175/177] netfilter: conntrack: comparison of unsigned in cthelper confirmation

2020-06-01 Thread Greg Kroah-Hartman
From: Pablo Neira Ayuso 

commit 94945ad2b330207cded0fd8d4abebde43a776dfb upstream.

net/netfilter/nf_conntrack_core.c: In function nf_confirm_cthelper:
net/netfilter/nf_conntrack_core.c:2117:15: warning: comparison of unsigned 
expression in < 0 is always false [-Wtype-limits]
 2117 |   if (protoff < 0 || (frag_off & htons(~0x7)) != 0)
  |   ^

ipv6_skip_exthdr() returns a signed integer.

Reported-by: Colin Ian King 
Fixes: 703acd70f249 ("netfilter: nfnetlink_cthelper: unbreak userspace helper 
support")
Signed-off-by: Pablo Neira Ayuso 
Signed-off-by: Greg Kroah-Hartman 

---
 net/netfilter/nf_conntrack_core.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -2090,7 +2090,7 @@ static int nf_confirm_cthelper(struct sk
 {
const struct nf_conntrack_helper *helper;
const struct nf_conn_help *help;
-   unsigned int protoff;
+   int protoff;
 
help = nfct_help(ct);
if (!help)




[PATCH 5.6 174/177] Revert "Input: i8042 - add ThinkPad S230u to i8042 nomux list"

2020-06-01 Thread Greg Kroah-Hartman
From: Dmitry Torokhov 

commit f4dec2d6160976b14e54be9c3950ce0f52385741 upstream.

This reverts commit 18931506465a762ffd3f4803d36a18d336a67da9. From Kevin
Locke:

"... nomux only appeared to fix the issue because the controller
continued working after warm reboots. After more thorough testing from
both warm and cold start, I now believe the entry should be added to
i8042_dmi_reset_table rather than i8042_dmi_nomux_table as i8042.reset=1
alone is sufficient to avoid the issue from both states while
i8042.nomux is not."

Signed-off-by: Greg Kroah-Hartman 

---
 drivers/input/serio/i8042-x86ia64io.h |7 ---
 1 file changed, 7 deletions(-)

--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -541,13 +541,6 @@ static const struct dmi_system_id __init
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5738"),
},
},
-   {
-   /* Lenovo ThinkPad Twist S230u */
-   .matches = {
-   DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-   DMI_MATCH(DMI_PRODUCT_NAME, "33474HU"),
-   },
-   },
{ }
 };
 




[PATCH 5.6 168/177] nexthops: dont modify published nexthop groups

2020-06-01 Thread Greg Kroah-Hartman
From: Nikolay Aleksandrov 

commit 90f33bffa382598a32cc82abfeb20adc92d041b6 upstream.

We must avoid modifying published nexthop groups while they might be
in use, otherwise we might see NULL ptr dereferences. In order to do
that we allocate 2 nexthoup group structures upon nexthop creation
and swap between them when we have to delete an entry. The reason is
that we can't fail nexthop group removal, so we can't handle allocation
failure thus we move the extra allocation on creation where we can
safely fail and return ENOMEM.

Fixes: 430a049190de ("nexthop: Add support for nexthop groups")
Signed-off-by: Nikolay Aleksandrov 
Signed-off-by: David Ahern 
Signed-off-by: David S. Miller 
Signed-off-by: Greg Kroah-Hartman 

---
 include/net/nexthop.h |1 
 net/ipv4/nexthop.c|   91 +++---
 2 files changed, 59 insertions(+), 33 deletions(-)

--- a/include/net/nexthop.h
+++ b/include/net/nexthop.h
@@ -70,6 +70,7 @@ struct nh_grp_entry {
 };
 
 struct nh_group {
+   struct nh_group *spare; /* spare group for removals */
u16 num_nh;
boolmpath;
boolhas_v4;
--- a/net/ipv4/nexthop.c
+++ b/net/ipv4/nexthop.c
@@ -63,9 +63,16 @@ static void nexthop_free_mpath(struct ne
int i;
 
nhg = rcu_dereference_raw(nh->nh_grp);
-   for (i = 0; i < nhg->num_nh; ++i)
-   WARN_ON(nhg->nh_entries[i].nh);
+   for (i = 0; i < nhg->num_nh; ++i) {
+   struct nh_grp_entry *nhge = &nhg->nh_entries[i];
 
+   WARN_ON(!list_empty(&nhge->nh_list));
+   nexthop_put(nhge->nh);
+   }
+
+   WARN_ON(nhg->spare == nhg);
+
+   kfree(nhg->spare);
kfree(nhg);
 }
 
@@ -697,46 +704,53 @@ static void nh_group_rebalance(struct nh
 static void remove_nh_grp_entry(struct net *net, struct nh_grp_entry *nhge,
struct nl_info *nlinfo)
 {
+   struct nh_grp_entry *nhges, *new_nhges;
struct nexthop *nhp = nhge->nh_parent;
struct nexthop *nh = nhge->nh;
-   struct nh_grp_entry *nhges;
-   struct nh_group *nhg;
-   bool found = false;
-   int i;
+   struct nh_group *nhg, *newg;
+   int i, j;
 
WARN_ON(!nh);
 
-   list_del(&nhge->nh_list);
-
nhg = rtnl_dereference(nhp->nh_grp);
-   nhges = nhg->nh_entries;
-   for (i = 0; i < nhg->num_nh; ++i) {
-   if (found) {
-   nhges[i-1].nh = nhges[i].nh;
-   nhges[i-1].weight = nhges[i].weight;
-   list_del(&nhges[i].nh_list);
-   list_add(&nhges[i-1].nh_list, &nhges[i-1].nh->grp_list);
-   } else if (nhg->nh_entries[i].nh == nh) {
-   found = true;
-   }
-   }
+   newg = nhg->spare;
 
-   if (WARN_ON(!found))
+   /* last entry, keep it visible and remove the parent */
+   if (nhg->num_nh == 1) {
+   remove_nexthop(net, nhp, nlinfo);
return;
+   }
 
-   nhg->num_nh--;
-   nhg->nh_entries[nhg->num_nh].nh = NULL;
+   newg->has_v4 = nhg->has_v4;
+   newg->mpath = nhg->mpath;
+   newg->num_nh = nhg->num_nh;
 
-   nh_group_rebalance(nhg);
+   /* copy old entries to new except the one getting removed */
+   nhges = nhg->nh_entries;
+   new_nhges = newg->nh_entries;
+   for (i = 0, j = 0; i < nhg->num_nh; ++i) {
+   /* current nexthop getting removed */
+   if (nhg->nh_entries[i].nh == nh) {
+   newg->num_nh--;
+   continue;
+   }
 
-   nexthop_put(nh);
+   list_del(&nhges[i].nh_list);
+   new_nhges[j].nh_parent = nhges[i].nh_parent;
+   new_nhges[j].nh = nhges[i].nh;
+   new_nhges[j].weight = nhges[i].weight;
+   list_add(&new_nhges[j].nh_list, &new_nhges[j].nh->grp_list);
+   j++;
+   }
+
+   nh_group_rebalance(newg);
+   rcu_assign_pointer(nhp->nh_grp, newg);
+
+   list_del(&nhge->nh_list);
+   nexthop_put(nhge->nh);
 
if (nlinfo)
nexthop_notify(RTM_NEWNEXTHOP, nhp, nlinfo);
-
-   /* if this group has no more entries then remove it */
-   if (!nhg->num_nh)
-   remove_nexthop(net, nhp, nlinfo);
 }
 
 static void remove_nexthop_from_groups(struct net *net, struct nexthop *nh,
@@ -746,6 +760,9 @@ static void remove_nexthop_from_groups(s
 
list_for_each_entry_safe(nhge, tmp, &nh->grp_list, nh_list)
remove_nh_grp_entry(net, nhge, nlinfo);
+
+   /* make sure all see the newly published array before releasing rtnl */
+   synchronize_rcu();
 }
 
 static void remove_nexthop_group(struct nexthop *nh, struct nl_info *nlinfo)
@@ -759,10 +776,7 @@ static void remove_nexthop_group(struct
if (WARN_ON(!nhge->nh))

[PATCH 5.6 176/177] netfilter: conntrack: Pass value of ctinfo to __nf_conntrack_update

2020-06-01 Thread Greg Kroah-Hartman
From: Nathan Chancellor 

commit 46c1e0621a72e0469ec4edfdb6ed4d387ec34f8a upstream.

Clang warns:

net/netfilter/nf_conntrack_core.c:2068:21: warning: variable 'ctinfo' is
uninitialized when used here [-Wuninitialized]
nf_ct_set(skb, ct, ctinfo);
   ^~
net/netfilter/nf_conntrack_core.c:2024:2: note: variable 'ctinfo' is
declared here
enum ip_conntrack_info ctinfo;
^
1 warning generated.

nf_conntrack_update was split up into nf_conntrack_update and
__nf_conntrack_update, where the assignment of ctinfo is in
nf_conntrack_update but it is used in __nf_conntrack_update.

Pass the value of ctinfo from nf_conntrack_update to
__nf_conntrack_update so that uninitialized memory is not used
and everything works properly.

Fixes: ee04805ff54a ("netfilter: conntrack: make conntrack userspace helpers 
work again")
Link: https://github.com/ClangBuiltLinux/linux/issues/1039
Signed-off-by: Nathan Chancellor 
Signed-off-by: Pablo Neira Ayuso 
Signed-off-by: Greg Kroah-Hartman 

---
 net/netfilter/nf_conntrack_core.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -2015,11 +2015,11 @@ static void nf_conntrack_attach(struct s
 }
 
 static int __nf_conntrack_update(struct net *net, struct sk_buff *skb,
-struct nf_conn *ct)
+struct nf_conn *ct,
+enum ip_conntrack_info ctinfo)
 {
struct nf_conntrack_tuple_hash *h;
struct nf_conntrack_tuple tuple;
-   enum ip_conntrack_info ctinfo;
struct nf_nat_hook *nat_hook;
unsigned int status;
int dataoff;
@@ -2144,7 +2144,7 @@ static int nf_conntrack_update(struct ne
return 0;
 
if (!nf_ct_is_confirmed(ct)) {
-   err = __nf_conntrack_update(net, skb, ct);
+   err = __nf_conntrack_update(net, skb, ct, ctinfo);
if (err < 0)
return err;
}




[PATCH 5.6 164/177] xsk: Add overflow check for u64 division, stored into u32

2020-06-01 Thread Greg Kroah-Hartman
From: Björn Töpel 

commit b16a87d0aef7a6be766f6618976dc5ff2c689291 upstream.

The npgs member of struct xdp_umem is an u32 entity, and stores the
number of pages the UMEM consumes. The calculation of npgs

  npgs = size / PAGE_SIZE

can overflow.

To avoid overflow scenarios, the division is now first stored in a
u64, and the result is verified to fit into 32b.

An alternative would be storing the npgs as a u64, however, this
wastes memory and is an unrealisticly large packet area.

Fixes: c0c77d8fb787 ("xsk: add user memory registration support sockopt")
Reported-by: "Minh Bùi Quang" 
Signed-off-by: Björn Töpel 
Signed-off-by: Daniel Borkmann 
Acked-by: Jonathan Lemon 
Link: 
https://lore.kernel.org/bpf/CACtPs=ggvv-_yj6rbpztvnopgi5nhmocctkskyrjhgqhjwf...@mail.gmail.com/
Link: https://lore.kernel.org/bpf/20200525080400.13195-1-bjorn.to...@gmail.com
Signed-off-by: Greg Kroah-Hartman 

---
 net/xdp/xdp_umem.c |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/net/xdp/xdp_umem.c
+++ b/net/xdp/xdp_umem.c
@@ -341,8 +341,8 @@ static int xdp_umem_reg(struct xdp_umem
 {
bool unaligned_chunks = mr->flags & XDP_UMEM_UNALIGNED_CHUNK_FLAG;
u32 chunk_size = mr->chunk_size, headroom = mr->headroom;
+   u64 npgs, addr = mr->addr, size = mr->len;
unsigned int chunks, chunks_per_page;
-   u64 addr = mr->addr, size = mr->len;
int err;
 
if (chunk_size < XDP_UMEM_MIN_CHUNK_SIZE || chunk_size > PAGE_SIZE) {
@@ -372,6 +372,10 @@ static int xdp_umem_reg(struct xdp_umem
if ((addr + size) < addr)
return -EINVAL;
 
+   npgs = div_u64(size, PAGE_SIZE);
+   if (npgs > U32_MAX)
+   return -EINVAL;
+
chunks = (unsigned int)div_u64(size, chunk_size);
if (chunks == 0)
return -EINVAL;
@@ -391,7 +395,7 @@ static int xdp_umem_reg(struct xdp_umem
umem->size = size;
umem->headroom = headroom;
umem->chunk_size_nohr = chunk_size - headroom;
-   umem->npgs = size / PAGE_SIZE;
+   umem->npgs = (u32)npgs;
umem->pgs = NULL;
umem->user = NULL;
umem->flags = mr->flags;




[PATCH 5.6 162/177] ieee80211: Fix incorrect mask for default PE duration

2020-06-01 Thread Greg Kroah-Hartman
From: Pradeep Kumar Chitrapu 

commit d031781bdabe1027858a3220f868866586bf6e7c upstream.

Fixes bitmask for HE opration's default PE duration.

Fixes: daa5b83513a7 ("mac80211: update HE operation fields to D3.0")
Signed-off-by: Pradeep Kumar Chitrapu 
Link: https://lore.kernel.org/r/20200506102430.5153-1-prade...@codeaurora.org
Signed-off-by: Johannes Berg 
Signed-off-by: Greg Kroah-Hartman 

---
 include/linux/ieee80211.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -2047,7 +2047,7 @@ ieee80211_he_ppe_size(u8 ppe_thres_hdr,
 }
 
 /* HE Operation defines */
-#define IEEE80211_HE_OPERATION_DFLT_PE_DURATION_MASK   0x0003
+#define IEEE80211_HE_OPERATION_DFLT_PE_DURATION_MASK   0x0007
 #define IEEE80211_HE_OPERATION_TWT_REQUIRED0x0008
 #define IEEE80211_HE_OPERATION_RTS_THRESHOLD_MASK  0x3ff0
 #define IEEE80211_HE_OPERATION_RTS_THRESHOLD_OFFSET4




[PATCH 5.6 135/177] include/asm-generic/topology.h: guard cpumask_of_node() macro argument

2020-06-01 Thread Greg Kroah-Hartman
From: Arnd Bergmann 

[ Upstream commit 4377748c7b5187c3342a60fa2ceb60c8a57a8488 ]

drivers/hwmon/amd_energy.c:195:15: error: invalid operands to binary expression 
('void' and 'int')
(channel - data->nr_cpus));
~^
include/asm-generic/topology.h:51:42: note: expanded from macro 
'cpumask_of_node'
#define cpumask_of_node(node)   ((void)node, cpu_online_mask)
   ^~~~
include/linux/cpumask.h:618:72: note: expanded from macro 'cpumask_first_and'
 #define cpumask_first_and(src1p, src2p) cpumask_next_and(-1, (src1p), (src2p))
   ^

Fixes: f0b848ce6fe9 ("cpumask: Introduce cpumask_of_{node,pcibus} to replace 
{node,pcibus}_to_cpumask")
Fixes: 8abee9566b7e ("hwmon: Add amd_energy driver to report energy counters")
Signed-off-by: Arnd Bergmann 
Signed-off-by: Andrew Morton 
Acked-by: Guenter Roeck 
Link: http://lkml.kernel.org/r/20200527134623.930247-1-a...@arndb.de
Signed-off-by: Linus Torvalds 
Signed-off-by: Sasha Levin 
---
 include/asm-generic/topology.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/asm-generic/topology.h b/include/asm-generic/topology.h
index 238873739550..5aa8705df87e 100644
--- a/include/asm-generic/topology.h
+++ b/include/asm-generic/topology.h
@@ -48,7 +48,7 @@
   #ifdef CONFIG_NEED_MULTIPLE_NODES
 #define cpumask_of_node(node)  ((node) == 0 ? cpu_online_mask : 
cpu_none_mask)
   #else
-#define cpumask_of_node(node)  ((void)node, cpu_online_mask)
+#define cpumask_of_node(node)  ((void)(node), cpu_online_mask)
   #endif
 #endif
 #ifndef pcibus_to_node
-- 
2.25.1





[PATCH 5.6 173/177] powerpc/bpf: Enable bpf_probe_read{, str}() on powerpc again

2020-06-01 Thread Greg Kroah-Hartman
From: Petr Mladek 

commit d195b1d1d1196681ac4775e0361e9cca70f740c2 upstream.

The commit 0ebeea8ca8a4d1d453a ("bpf: Restrict bpf_probe_read{, str}() only
to archs where they work") caused that bpf_probe_read{, str}() functions
were not longer available on architectures where the same logical address
might have different content in kernel and user memory mapping. These
architectures should use probe_read_{user,kernel}_str helpers.

For backward compatibility, the problematic functions are still available
on architectures where the user and kernel address spaces are not
overlapping. This is defined CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE.

At the moment, these backward compatible functions are enabled only on x86_64,
arm, and arm64. Let's do it also on powerpc that has the non overlapping
address space as well.

Fixes: 0ebeea8ca8a4 ("bpf: Restrict bpf_probe_read{, str}() only to archs where 
they work")
Signed-off-by: Petr Mladek 
Signed-off-by: Daniel Borkmann 
Acked-by: Michael Ellerman 
Link: https://lore.kernel.org/lkml/20200527122844.19524-1-pmla...@suse.com
Signed-off-by: Greg Kroah-Hartman 

---
 arch/powerpc/Kconfig |1 +
 1 file changed, 1 insertion(+)

--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -125,6 +125,7 @@ config PPC
select ARCH_HAS_MMIOWB  if PPC64
select ARCH_HAS_PHYS_TO_DMA
select ARCH_HAS_PMEM_API
+   select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
select ARCH_HAS_PTE_DEVMAP  if PPC_BOOK3S_64
select ARCH_HAS_PTE_SPECIAL
select ARCH_HAS_MEMBARRIER_CALLBACKS




[PATCH 5.6 169/177] nexthop: Expand nexthop_is_multipath in a few places

2020-06-01 Thread Greg Kroah-Hartman
From: David Ahern 

commit 0b5e2e39739e861fa5fc84ab27a35dbe62a15330 upstream.

I got too fancy consolidating checks on multipath type. The result
is that path lookups can access 2 different nh_grp structs as exposed
by Nik's torture tests. Expand nexthop_is_multipath within nexthop.h to
avoid multiple, nh_grp dereferences and make decisions based on the
consistent struct.

Only 2 places left using nexthop_is_multipath are within IPv6, both
only check that the nexthop is a multipath for a branching decision
which are acceptable.

Fixes: 430a049190de ("nexthop: Add support for nexthop groups")
Signed-off-by: David Ahern 
Acked-by: Nikolay Aleksandrov 
Signed-off-by: David S. Miller 
Signed-off-by: Greg Kroah-Hartman 

---
 include/net/nexthop.h |   41 +
 1 file changed, 25 insertions(+), 16 deletions(-)

--- a/include/net/nexthop.h
+++ b/include/net/nexthop.h
@@ -137,21 +137,20 @@ static inline unsigned int nexthop_num_p
 {
unsigned int rc = 1;
 
-   if (nexthop_is_multipath(nh)) {
+   if (nh->is_group) {
struct nh_group *nh_grp;
 
nh_grp = rcu_dereference_rtnl(nh->nh_grp);
-   rc = nh_grp->num_nh;
+   if (nh_grp->mpath)
+   rc = nh_grp->num_nh;
}
 
return rc;
 }
 
 static inline
-struct nexthop *nexthop_mpath_select(const struct nexthop *nh, int nhsel)
+struct nexthop *nexthop_mpath_select(const struct nh_group *nhg, int nhsel)
 {
-   const struct nh_group *nhg = rcu_dereference_rtnl(nh->nh_grp);
-
/* for_nexthops macros in fib_semantics.c grabs a pointer to
 * the nexthop before checking nhsel
 */
@@ -186,12 +185,14 @@ static inline bool nexthop_is_blackhole(
 {
const struct nh_info *nhi;
 
-   if (nexthop_is_multipath(nh)) {
-   if (nexthop_num_path(nh) > 1)
-   return false;
-   nh = nexthop_mpath_select(nh, 0);
-   if (!nh)
+   if (nh->is_group) {
+   struct nh_group *nh_grp;
+
+   nh_grp = rcu_dereference_rtnl(nh->nh_grp);
+   if (nh_grp->num_nh > 1)
return false;
+
+   nh = nh_grp->nh_entries[0].nh;
}
 
nhi = rcu_dereference_rtnl(nh->nh_info);
@@ -217,10 +218,15 @@ struct fib_nh_common *nexthop_fib_nhc(st
BUILD_BUG_ON(offsetof(struct fib_nh, nh_common) != 0);
BUILD_BUG_ON(offsetof(struct fib6_nh, nh_common) != 0);
 
-   if (nexthop_is_multipath(nh)) {
-   nh = nexthop_mpath_select(nh, nhsel);
-   if (!nh)
-   return NULL;
+   if (nh->is_group) {
+   struct nh_group *nh_grp;
+
+   nh_grp = rcu_dereference_rtnl(nh->nh_grp);
+   if (nh_grp->mpath) {
+   nh = nexthop_mpath_select(nh_grp, nhsel);
+   if (!nh)
+   return NULL;
+   }
}
 
nhi = rcu_dereference_rtnl(nh->nh_info);
@@ -264,8 +270,11 @@ static inline struct fib6_nh *nexthop_fi
 {
struct nh_info *nhi;
 
-   if (nexthop_is_multipath(nh)) {
-   nh = nexthop_mpath_select(nh, 0);
+   if (nh->is_group) {
+   struct nh_group *nh_grp;
+
+   nh_grp = rcu_dereference_rtnl(nh->nh_grp);
+   nh = nexthop_mpath_select(nh_grp, 0);
if (!nh)
return NULL;
}




[PATCH 5.6 132/177] mm,thp: stop leaking unreleased file pages

2020-06-01 Thread Greg Kroah-Hartman
From: Hugh Dickins 

[ Upstream commit 2f33a706027c94cd4f70fcd3e3f4a17c1ce4ea4b ]

When collapse_file() calls try_to_release_page(), it has already isolated
the page: so if releasing buffers happens to fail (as it sometimes does),
remember to putback_lru_page(): otherwise that page is left unreclaimable
and unfreeable, and the file extent uncollapsible.

Fixes: 99cb0dbd47a1 ("mm,thp: add read-only THP support for (non-shmem) FS")
Signed-off-by: Hugh Dickins 
Signed-off-by: Andrew Morton 
Acked-by: Song Liu 
Acked-by: Kirill A. Shutemov 
Acked-by: Johannes Weiner 
Cc: Rik van Riel 
Cc: [5.4+]
Link: http://lkml.kernel.org/r/alpine.LSU.2.11.2005231837500.1766@eggly.anvils
Signed-off-by: Linus Torvalds 
Signed-off-by: Sasha Levin 
---
 mm/khugepaged.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index b679908743cb..ba059e68cf50 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -1673,6 +1673,7 @@ static void collapse_file(struct mm_struct *mm,
if (page_has_private(page) &&
!try_to_release_page(page, GFP_KERNEL)) {
result = SCAN_PAGE_HAS_PRIVATE;
+   putback_lru_page(page);
goto out_unlock;
}
 
-- 
2.25.1





[PATCH 5.6 172/177] bonding: Fix reference count leak in bond_sysfs_slave_add.

2020-06-01 Thread Greg Kroah-Hartman
From: Qiushi Wu 

commit a068aab42258e25094bc2c159948d263ed7d7a77 upstream.

kobject_init_and_add() takes reference even when it fails.
If this function returns an error, kobject_put() must be called to
properly clean up the memory associated with the object. Previous
commit "b8eb718348b8" fixed a similar problem.

Fixes: 07699f9a7c8d ("bonding: add sysfs /slave dir for bond slave devices.")
Signed-off-by: Qiushi Wu 
Acked-by: Jay Vosburgh 
Signed-off-by: David S. Miller 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/bonding/bond_sysfs_slave.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/net/bonding/bond_sysfs_slave.c
+++ b/drivers/net/bonding/bond_sysfs_slave.c
@@ -149,8 +149,10 @@ int bond_sysfs_slave_add(struct slave *s
 
err = kobject_init_and_add(&slave->kobj, &slave_ktype,
   &(slave->dev->dev.kobj), "bonding_slave");
-   if (err)
+   if (err) {
+   kobject_put(&slave->kobj);
return err;
+   }
 
for (a = slave_attrs; *a; ++a) {
err = sysfs_create_file(&slave->kobj, &((*a)->attr));




[PATCH 5.6 158/177] netfilter: nf_conntrack_pptp: prevent buffer overflows in debug code

2020-06-01 Thread Greg Kroah-Hartman
From: Pablo Neira Ayuso 

commit 4c559f15efcc43b996f4da528cd7f9483aaca36d upstream.

Dan Carpenter says: "Smatch complains that the value for "cmd" comes
from the network and can't be trusted."

Add pptp_msg_name() helper function that checks for the array boundary.

Fixes: f09943fefe6b ("[NETFILTER]: nf_conntrack/nf_nat: add PPTP helper port")
Reported-by: Dan Carpenter 
Signed-off-by: Pablo Neira Ayuso 
Signed-off-by: Greg Kroah-Hartman 

---
 include/linux/netfilter/nf_conntrack_pptp.h |2 
 net/ipv4/netfilter/nf_nat_pptp.c|7 ---
 net/netfilter/nf_conntrack_pptp.c   |   62 +++-
 3 files changed, 38 insertions(+), 33 deletions(-)

--- a/include/linux/netfilter/nf_conntrack_pptp.h
+++ b/include/linux/netfilter/nf_conntrack_pptp.h
@@ -10,7 +10,7 @@
 #include 
 #include 
 
-extern const char *const pptp_msg_name[];
+extern const char *const pptp_msg_name(u_int16_t msg);
 
 /* state of the control session */
 enum pptp_ctrlsess_state {
--- a/net/ipv4/netfilter/nf_nat_pptp.c
+++ b/net/ipv4/netfilter/nf_nat_pptp.c
@@ -166,8 +166,7 @@ pptp_outbound_pkt(struct sk_buff *skb,
break;
default:
pr_debug("unknown outbound packet 0x%04x:%s\n", msg,
-msg <= PPTP_MSG_MAX ? pptp_msg_name[msg] :
-  pptp_msg_name[0]);
+pptp_msg_name(msg));
/* fall through */
case PPTP_SET_LINK_INFO:
/* only need to NAT in case PAC is behind NAT box */
@@ -268,9 +267,7 @@ pptp_inbound_pkt(struct sk_buff *skb,
pcid_off = offsetof(union pptp_ctrl_union, setlink.peersCallID);
break;
default:
-   pr_debug("unknown inbound packet %s\n",
-msg <= PPTP_MSG_MAX ? pptp_msg_name[msg] :
-  pptp_msg_name[0]);
+   pr_debug("unknown inbound packet %s\n", pptp_msg_name(msg));
/* fall through */
case PPTP_START_SESSION_REQUEST:
case PPTP_START_SESSION_REPLY:
--- a/net/netfilter/nf_conntrack_pptp.c
+++ b/net/netfilter/nf_conntrack_pptp.c
@@ -72,24 +72,32 @@ EXPORT_SYMBOL_GPL(nf_nat_pptp_hook_expec
 
 #if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
 /* PptpControlMessageType names */
-const char *const pptp_msg_name[] = {
-   "UNKNOWN_MESSAGE",
-   "START_SESSION_REQUEST",
-   "START_SESSION_REPLY",
-   "STOP_SESSION_REQUEST",
-   "STOP_SESSION_REPLY",
-   "ECHO_REQUEST",
-   "ECHO_REPLY",
-   "OUT_CALL_REQUEST",
-   "OUT_CALL_REPLY",
-   "IN_CALL_REQUEST",
-   "IN_CALL_REPLY",
-   "IN_CALL_CONNECT",
-   "CALL_CLEAR_REQUEST",
-   "CALL_DISCONNECT_NOTIFY",
-   "WAN_ERROR_NOTIFY",
-   "SET_LINK_INFO"
+static const char *const pptp_msg_name_array[PPTP_MSG_MAX + 1] = {
+   [0] = "UNKNOWN_MESSAGE",
+   [PPTP_START_SESSION_REQUEST]= "START_SESSION_REQUEST",
+   [PPTP_START_SESSION_REPLY]  = "START_SESSION_REPLY",
+   [PPTP_STOP_SESSION_REQUEST] = "STOP_SESSION_REQUEST",
+   [PPTP_STOP_SESSION_REPLY]   = "STOP_SESSION_REPLY",
+   [PPTP_ECHO_REQUEST] = "ECHO_REQUEST",
+   [PPTP_ECHO_REPLY]   = "ECHO_REPLY",
+   [PPTP_OUT_CALL_REQUEST] = "OUT_CALL_REQUEST",
+   [PPTP_OUT_CALL_REPLY]   = "OUT_CALL_REPLY",
+   [PPTP_IN_CALL_REQUEST]  = "IN_CALL_REQUEST",
+   [PPTP_IN_CALL_REPLY]= "IN_CALL_REPLY",
+   [PPTP_IN_CALL_CONNECT]  = "IN_CALL_CONNECT",
+   [PPTP_CALL_CLEAR_REQUEST]   = "CALL_CLEAR_REQUEST",
+   [PPTP_CALL_DISCONNECT_NOTIFY]   = "CALL_DISCONNECT_NOTIFY",
+   [PPTP_WAN_ERROR_NOTIFY] = "WAN_ERROR_NOTIFY",
+   [PPTP_SET_LINK_INFO]= "SET_LINK_INFO"
 };
+
+const char *const pptp_msg_name(u_int16_t msg)
+{
+   if (msg > PPTP_MSG_MAX)
+   return pptp_msg_name_array[0];
+
+   return pptp_msg_name_array[msg];
+}
 EXPORT_SYMBOL(pptp_msg_name);
 #endif
 
@@ -276,7 +284,7 @@ pptp_inbound_pkt(struct sk_buff *skb, un
typeof(nf_nat_pptp_hook_inbound) nf_nat_pptp_inbound;
 
msg = ntohs(ctlh->messageType);
-   pr_debug("inbound control message %s\n", pptp_msg_name[msg]);
+   pr_debug("inbound control message %s\n", pptp_msg_name(msg));
 
switch (msg) {
case PPTP_START_SESSION_REPLY:
@@ -311,7 +319,7 @@ pptp_inbound_pkt(struct sk_buff *skb, un
pcid = pptpReq->ocack.peersCallID;
if (info->pns_call_id != pcid)
goto invalid;
-   pr_debug("%s, CID=%X, PCID=%X\n", pptp_msg_name[msg],
+   pr_debug("%s, CID=%X, PCID=%X\n", pptp_msg_name(msg),
 ntohs(cid), ntohs(pcid));
 
if (pptpReq->ocack.resultCode == PPTP_OUTCALL_CONNECT) {
@@ -328,7 +336,7 @@ pptp_inbound_pkt(struc

[PATCH 5.6 165/177] qlcnic: fix missing release in qlcnic_83xx_interrupt_test.

2020-06-01 Thread Greg Kroah-Hartman
From: Qiushi Wu 

commit 15c973858903009e995b2037683de29dfe968621 upstream.

In function qlcnic_83xx_interrupt_test(), function
qlcnic_83xx_diag_alloc_res() is not handled by function
qlcnic_83xx_diag_free_res() after a call of the function
qlcnic_alloc_mbx_args() failed. Fix this issue by adding
a jump target "fail_mbx_args", and jump to this new target
when qlcnic_alloc_mbx_args() failed.

Fixes: b6b4316c8b2f ("qlcnic: Handle qlcnic_alloc_mbx_args() failure")
Signed-off-by: Qiushi Wu 
Signed-off-by: David S. Miller 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
@@ -3651,7 +3651,7 @@ int qlcnic_83xx_interrupt_test(struct ne
ahw->diag_cnt = 0;
ret = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_INTRPT_TEST);
if (ret)
-   goto fail_diag_irq;
+   goto fail_mbx_args;
 
if (adapter->flags & QLCNIC_MSIX_ENABLED)
intrpt_id = ahw->intr_tbl[0].id;
@@ -3681,6 +3681,8 @@ int qlcnic_83xx_interrupt_test(struct ne
 
 done:
qlcnic_free_mbx_args(&cmd);
+
+fail_mbx_args:
qlcnic_83xx_diag_free_res(netdev, drv_sds_rings);
 
 fail_diag_irq:




[PATCH 5.6 163/177] x86/ioperm: Prevent a memory leak when fork fails

2020-06-01 Thread Greg Kroah-Hartman
From: Jay Lang 

commit 4bfe6cce133cad82cea04490c308795275857782 upstream.

In the copy_process() routine called by _do_fork(), failure to allocate
a PID (or further along in the function) will trigger an invocation to
exit_thread(). This is done to clean up from an earlier call to
copy_thread_tls(). Naturally, the child task is passed into exit_thread(),
however during the process, io_bitmap_exit() nullifies the parent's
io_bitmap rather than the child's.

As copy_thread_tls() has been called ahead of the failure, the reference
count on the calling thread's io_bitmap is incremented as we would expect.
However, io_bitmap_exit() doesn't accept any arguments, and thus assumes
it should trash the current thread's io_bitmap reference rather than the
child's. This is pretty sneaky in practice, because in all instances but
this one, exit_thread() is called with respect to the current task and
everything works out.

A determined attacker can issue an appropriate ioctl (i.e. KDENABIO) to
get a bitmap allocated, and force a clone3() syscall to fail by passing
in a zeroed clone_args structure. The kernel handles the erroneous struct
and the buggy code path is followed, and even though the parent's reference
to the io_bitmap is trashed, the child still holds a reference and thus
the structure will never be freed.

Fix this by tweaking io_bitmap_exit() and its subroutines to accept a
task_struct argument which to operate on.

Fixes: ea5f1cd7ab49 ("x86/ioperm: Remove bitmap if all permissions dropped")
Signed-off-by: Jay Lang 
Signed-off-by: Thomas Gleixner 
Cc: stable#@vger.kernel.org
Link: https://lkml.kernel.org/r/20200524162742.253727-1-jaytl...@mit.edu
Signed-off-by: Greg Kroah-Hartman 

---
 arch/x86/include/asm/io_bitmap.h |4 ++--
 arch/x86/kernel/ioport.c |   22 +++---
 arch/x86/kernel/process.c|4 ++--
 3 files changed, 15 insertions(+), 15 deletions(-)

--- a/arch/x86/include/asm/io_bitmap.h
+++ b/arch/x86/include/asm/io_bitmap.h
@@ -17,7 +17,7 @@ struct task_struct;
 
 #ifdef CONFIG_X86_IOPL_IOPERM
 void io_bitmap_share(struct task_struct *tsk);
-void io_bitmap_exit(void);
+void io_bitmap_exit(struct task_struct *tsk);
 
 void native_tss_update_io_bitmap(void);
 
@@ -29,7 +29,7 @@ void native_tss_update_io_bitmap(void);
 
 #else
 static inline void io_bitmap_share(struct task_struct *tsk) { }
-static inline void io_bitmap_exit(void) { }
+static inline void io_bitmap_exit(struct task_struct *tsk) { }
 static inline void tss_update_io_bitmap(void) { }
 #endif
 
--- a/arch/x86/kernel/ioport.c
+++ b/arch/x86/kernel/ioport.c
@@ -32,15 +32,15 @@ void io_bitmap_share(struct task_struct
set_tsk_thread_flag(tsk, TIF_IO_BITMAP);
 }
 
-static void task_update_io_bitmap(void)
+static void task_update_io_bitmap(struct task_struct *tsk)
 {
-   struct thread_struct *t = ¤t->thread;
+   struct thread_struct *t = &tsk->thread;
 
if (t->iopl_emul == 3 || t->io_bitmap) {
/* TSS update is handled on exit to user space */
-   set_thread_flag(TIF_IO_BITMAP);
+   set_tsk_thread_flag(tsk, TIF_IO_BITMAP);
} else {
-   clear_thread_flag(TIF_IO_BITMAP);
+   clear_tsk_thread_flag(tsk, TIF_IO_BITMAP);
/* Invalidate TSS */
preempt_disable();
tss_update_io_bitmap();
@@ -48,12 +48,12 @@ static void task_update_io_bitmap(void)
}
 }
 
-void io_bitmap_exit(void)
+void io_bitmap_exit(struct task_struct *tsk)
 {
-   struct io_bitmap *iobm = current->thread.io_bitmap;
+   struct io_bitmap *iobm = tsk->thread.io_bitmap;
 
-   current->thread.io_bitmap = NULL;
-   task_update_io_bitmap();
+   tsk->thread.io_bitmap = NULL;
+   task_update_io_bitmap(tsk);
if (iobm && refcount_dec_and_test(&iobm->refcnt))
kfree(iobm);
 }
@@ -101,7 +101,7 @@ long ksys_ioperm(unsigned long from, uns
if (!iobm)
return -ENOMEM;
refcount_set(&iobm->refcnt, 1);
-   io_bitmap_exit();
+   io_bitmap_exit(current);
}
 
/*
@@ -133,7 +133,7 @@ long ksys_ioperm(unsigned long from, uns
}
/* All permissions dropped? */
if (max_long == UINT_MAX) {
-   io_bitmap_exit();
+   io_bitmap_exit(current);
return 0;
}
 
@@ -191,7 +191,7 @@ SYSCALL_DEFINE1(iopl, unsigned int, leve
}
 
t->iopl_emul = level;
-   task_update_io_bitmap();
+   task_update_io_bitmap(current);
 
return 0;
 }
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -97,7 +97,7 @@ int arch_dup_task_struct(struct task_str
 }
 
 /*
- * Free current thread data structures etc..
+ * Free thread data structures etc..
  */
 void exit_thread(struct task_struct *tsk)
 {
@@ -105,7 +105,7 @@ void exit_thread(struct task_struct *tsk
struct fpu *fpu = &t->fpu;
 
if (test_th

[PATCH 5.6 134/177] fs/binfmt_elf.c: allocate initialized memory in fill_thread_core_info()

2020-06-01 Thread Greg Kroah-Hartman
From: Alexander Potapenko 

[ Upstream commit 1d605416fb7175e1adf094251466caa52093b413 ]

KMSAN reported uninitialized data being written to disk when dumping
core.  As a result, several kilobytes of kmalloc memory may be written
to the core file and then read by a non-privileged user.

Reported-by: sam 
Signed-off-by: Alexander Potapenko 
Signed-off-by: Andrew Morton 
Acked-by: Kees Cook 
Cc: Al Viro 
Cc: Alexey Dobriyan 
Cc: 
Link: http://lkml.kernel.org/r/20200419100848.63472-1-gli...@google.com
Link: https://github.com/google/kmsan/issues/76
Signed-off-by: Linus Torvalds 
Signed-off-by: Sasha Levin 
---
 fs/binfmt_elf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index f4713ea76e82..54f888ddb8cc 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1733,7 +1733,7 @@ static int fill_thread_core_info(struct 
elf_thread_core_info *t,
(!regset->active || regset->active(t->task, regset) > 0)) {
int ret;
size_t size = regset_size(t->task, regset);
-   void *data = kmalloc(size, GFP_KERNEL);
+   void *data = kzalloc(size, GFP_KERNEL);
if (unlikely(!data))
return 0;
ret = regset->get(t->task, regset,
-- 
2.25.1





[PATCH 5.6 160/177] bnxt_en: Fix accumulation of bp->net_stats_prev.

2020-06-01 Thread Greg Kroah-Hartman
From: Michael Chan 

commit b8056e8434b037fdab08158fea99ed7bc8ef3a74 upstream.

We have logic to maintain network counters across resets by storing
the counters in bp->net_stats_prev before reset.  But not all resets
will clear the counters.  Certain resets that don't need to change
the number of rings do not clear the counters.  The current logic
accumulates the counters before all resets, causing big jumps in
the counters after some resets, such as ethtool -G.

Fix it by only accumulating the counters during reset if the irq_re_init
parameter is set.  The parameter signifies that all rings and interrupts
will be reset and that means that the counters will also be reset.

Reported-by: Vijayendra Suman 
Fixes: b8875ca356f1 ("bnxt_en: Save ring statistics before reset.")
Signed-off-by: Michael Chan 
Signed-off-by: David S. Miller 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -9324,7 +9324,7 @@ static void __bnxt_close_nic(struct bnxt
bnxt_free_skbs(bp);
 
/* Save ring stats before shutdown */
-   if (bp->bnapi)
+   if (bp->bnapi && irq_re_init)
bnxt_get_ring_stats(bp, &bp->net_stats_prev);
if (irq_re_init) {
bnxt_free_irq(bp);




[PATCH 5.6 153/177] ip_vti: receive ipip packet by calling ip_tunnel_rcv

2020-06-01 Thread Greg Kroah-Hartman
From: Xin Long 

commit 976eba8ab596bab94b9714cd46d38d5c6a2c660d upstream.

In Commit dd9ee3444014 ("vti4: Fix a ipip packet processing bug in
'IPCOMP' virtual tunnel"), it tries to receive IPIP packets in vti
by calling xfrm_input(). This case happens when a small packet or
frag sent by peer is too small to get compressed.

However, xfrm_input() will still get to the IPCOMP path where skb
sec_path is set, but never dropped while it should have been done
in vti_ipcomp4_protocol.cb_handler(vti_rcv_cb), as it's not an
ipcomp4 packet. This will cause that the packet can never pass
xfrm4_policy_check() in the upper protocol rcv functions.

So this patch is to call ip_tunnel_rcv() to process IPIP packets
instead.

Fixes: dd9ee3444014 ("vti4: Fix a ipip packet processing bug in 'IPCOMP' 
virtual tunnel")
Reported-by: Xiumei Mu 
Signed-off-by: Xin Long 
Signed-off-by: Steffen Klassert 
Signed-off-by: Greg Kroah-Hartman 

---
 net/ipv4/ip_vti.c |   23 ++-
 1 file changed, 22 insertions(+), 1 deletion(-)

--- a/net/ipv4/ip_vti.c
+++ b/net/ipv4/ip_vti.c
@@ -93,7 +93,28 @@ static int vti_rcv_proto(struct sk_buff
 
 static int vti_rcv_tunnel(struct sk_buff *skb)
 {
-   return vti_rcv(skb, ip_hdr(skb)->saddr, true);
+   struct ip_tunnel_net *itn = net_generic(dev_net(skb->dev), vti_net_id);
+   const struct iphdr *iph = ip_hdr(skb);
+   struct ip_tunnel *tunnel;
+
+   tunnel = ip_tunnel_lookup(itn, skb->dev->ifindex, TUNNEL_NO_KEY,
+ iph->saddr, iph->daddr, 0);
+   if (tunnel) {
+   struct tnl_ptk_info tpi = {
+   .proto = htons(ETH_P_IP),
+   };
+
+   if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb))
+   goto drop;
+   if (iptunnel_pull_header(skb, 0, tpi.proto, false))
+   goto drop;
+   return ip_tunnel_rcv(tunnel, skb, &tpi, NULL, false);
+   }
+
+   return -EINVAL;
+drop:
+   kfree_skb(skb);
+   return 0;
 }
 
 static int vti_rcv_cb(struct sk_buff *skb, int err)




[PATCH 5.6 145/177] xfrm: do pskb_pull properly in __xfrm_transport_prep

2020-06-01 Thread Greg Kroah-Hartman
From: Xin Long 

commit 06a0afcfe2f551ff755849ea2549b0d8409fd9a0 upstream.

For transport mode, when ipv6 nexthdr is set, the packet format might
be like:


|| dest | | |  |  ESP| ESP |
| IP6 hdr| opts.| ESP | TCP | Data | Trailer | ICV |


and in __xfrm_transport_prep():

  pskb_pull(skb, skb->mac_len + sizeof(ip6hdr) + x->props.header_len);

it will pull the data pointer to the wrong position, as it missed the
nexthdrs/dest opts.

This patch is to fix it by using:

  pskb_pull(skb, skb_transport_offset(skb) + x->props.header_len);

as we can be sure transport_header points to ESP header at that moment.

It also fixes a panic when packets with ipv6 nexthdr are sent over
esp6 transport mode:

  [  100.473845] kernel BUG at net/core/skbuff.c:4325!
  [  100.478517] RIP: 0010:__skb_to_sgvec+0x252/0x260
  [  100.494355] Call Trace:
  [  100.494829]  skb_to_sgvec+0x11/0x40
  [  100.495492]  esp6_output_tail+0x12e/0x550 [esp6]
  [  100.496358]  esp6_xmit+0x1d5/0x260 [esp6_offload]
  [  100.498029]  validate_xmit_xfrm+0x22f/0x2e0
  [  100.499604]  __dev_queue_xmit+0x589/0x910
  [  100.502928]  ip6_finish_output2+0x2a5/0x5a0
  [  100.503718]  ip6_output+0x6c/0x120
  [  100.505198]  xfrm_output_resume+0x4bf/0x530
  [  100.508683]  xfrm6_output+0x3a/0xc0
  [  100.513446]  inet6_csk_xmit+0xa1/0xf0
  [  100.517335]  tcp_sendmsg+0x27/0x40
  [  100.517977]  sock_sendmsg+0x3e/0x60
  [  100.518648]  __sys_sendto+0xee/0x160

Fixes: c35fe4106b92 ("xfrm: Add mode handlers for IPsec on layer 2")
Signed-off-by: Xin Long 
Signed-off-by: Steffen Klassert 
Signed-off-by: Greg Kroah-Hartman 

---
 net/xfrm/xfrm_device.c |8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

--- a/net/xfrm/xfrm_device.c
+++ b/net/xfrm/xfrm_device.c
@@ -25,12 +25,10 @@ static void __xfrm_transport_prep(struct
struct xfrm_offload *xo = xfrm_offload(skb);
 
skb_reset_mac_len(skb);
-   pskb_pull(skb, skb->mac_len + hsize + x->props.header_len);
-
-   if (xo->flags & XFRM_GSO_SEGMENT) {
-   skb_reset_transport_header(skb);
+   if (xo->flags & XFRM_GSO_SEGMENT)
skb->transport_header -= x->props.header_len;
-   }
+
+   pskb_pull(skb, skb_transport_offset(skb) + x->props.header_len);
 }
 
 static void __xfrm_mode_tunnel_prep(struct xfrm_state *x, struct sk_buff *skb,




[PATCH 5.6 136/177] Revert "block: end bio with BLK_STS_AGAIN in case of non-mq devs and REQ_NOWAIT"

2020-06-01 Thread Greg Kroah-Hartman
From: Jens Axboe 

[ Upstream commit b0beb28097fa04177b3769f4bb7a0d0d9c4ae76e ]

This reverts commit c58c1f83436b501d45d4050fd1296d71a9760bcb.

io_uring does do the right thing for this case, and we're still returning
-EAGAIN to userspace for the cases we don't support. Revert this change
to avoid doing endless spins of resubmits.

Cc: sta...@vger.kernel.org # v5.6
Reported-by: Bijan Mottahedeh 
Signed-off-by: Jens Axboe 
Signed-off-by: Sasha Levin 
---
 block/blk-core.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 60dc9552ef8d..92232907605c 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -885,14 +885,11 @@ generic_make_request_checks(struct bio *bio)
}
 
/*
-* Non-mq queues do not honor REQ_NOWAIT, so complete a bio
-* with BLK_STS_AGAIN status in order to catch -EAGAIN and
-* to give a chance to the caller to repeat request gracefully.
+* For a REQ_NOWAIT based request, return -EOPNOTSUPP
+* if queue is not a request based queue.
 */
-   if ((bio->bi_opf & REQ_NOWAIT) && !queue_is_mq(q)) {
-   status = BLK_STS_AGAIN;
-   goto end_io;
-   }
+   if ((bio->bi_opf & REQ_NOWAIT) && !queue_is_mq(q))
+   goto not_supported;
 
if (should_fail_bio(bio))
goto end_io;
-- 
2.25.1





[PATCH 5.6 142/177] x86/dma: Fix max PFN arithmetic overflow on 32 bit systems

2020-06-01 Thread Greg Kroah-Hartman
From: Alexander Dahl 

commit 88743470668ef5eb6b7ba9e0f99888e5999bf172 upstream.

The intermediate result of the old term (4UL * 1024 * 1024 * 1024) is
4 294 967 296 or 0x1 which is no problem on 64 bit systems.
The patch does not change the later overall result of 0x10 for
MAX_DMA32_PFN (after it has been shifted by PAGE_SHIFT). The new
calculation yields the same result, but does not require 64 bit
arithmetic.

On 32 bit systems the old calculation suffers from an arithmetic
overflow in that intermediate term in braces: 4UL aka unsigned long int
is 4 byte wide and an arithmetic overflow happens (the 0x1 does
not fit in 4 bytes), the in braces result is truncated to zero, the
following right shift does not alter that, so MAX_DMA32_PFN evaluates to
0 on 32 bit systems.

That wrong value is a problem in a comparision against MAX_DMA32_PFN in
the init code for swiotlb in pci_swiotlb_detect_4gb() to decide if
swiotlb should be active.  That comparison yields the opposite result,
when compiling on 32 bit systems.

This was not possible before

  1b7e03ef7570 ("x86, NUMA: Enable emulation on 32bit too")

when that MAX_DMA32_PFN was first made visible to x86_32 (and which
landed in v3.0).

In practice this wasn't a problem, unless CONFIG_SWIOTLB is active on
x86-32.

However if one has set CONFIG_IOMMU_INTEL, since

  c5a5dc4cbbf4 ("iommu/vt-d: Don't switch off swiotlb if bounce page is used")

there's a dependency on CONFIG_SWIOTLB, which was not necessarily
active before. That landed in v5.4, where we noticed it in the fli4l
Linux distribution. We have CONFIG_IOMMU_INTEL active on both 32 and 64
bit kernel configs there (I could not find out why, so let's just say
historical reasons).

The effect is at boot time 64 MiB (default size) were allocated for
bounce buffers now, which is a noticeable amount of memory on small
systems like pcengines ALIX 2D3 with 256 MiB memory, which are still
frequently used as home routers.

We noticed this effect when migrating from kernel v4.19 (LTS) to v5.4
(LTS) in fli4l and got that kernel messages for example:

  Linux version 5.4.22 (buildroot@buildroot) (gcc version 7.3.0 (Buildroot 
2018.02.8)) #1 SMP Mon Nov 26 23:40:00 CET 2018
  …
  Memory: 183484K/261756K available (4594K kernel code, 393K rwdata, 1660K 
rodata, 536K init, 456K bss , 78272K reserved, 0K cma-reserved, 0K highmem)
  …
  PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
  software IO TLB: mapped [mem 0x0bb78000-0x0fb78000] (64MB)

The initial analysis and the suggested fix was done by user 'sourcejedi'
at stackoverflow and explicitly marked as GPLv2 for inclusion in the
Linux kernel:

  https://unix.stackexchange.com/a/520525/50007

The new calculation, which does not suffer from that overflow, is the
same as for arch/mips now as suggested by Robin Murphy.

The fix was tested by fli4l users on round about two dozen different
systems, including both 32 and 64 bit archs, bare metal and virtualized
machines.

 [ bp: Massage commit message. ]

Fixes: 1b7e03ef7570 ("x86, NUMA: Enable emulation on 32bit too")
Reported-by: Alan Jenkins 
Suggested-by: Robin Murphy 
Signed-off-by: Alexander Dahl 
Signed-off-by: Borislav Petkov 
Reviewed-by: Greg Kroah-Hartman 
Cc: sta...@vger.kernel.org
Link: https://unix.stackexchange.com/q/520065/50007
Link: https://web.nettworks.org/bugs/browse/FFL-2560
Link: https://lkml.kernel.org/r/20200526175749.20742-1-p...@lespocky.de
Signed-off-by: Greg Kroah-Hartman 

---
 arch/x86/include/asm/dma.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/x86/include/asm/dma.h
+++ b/arch/x86/include/asm/dma.h
@@ -74,7 +74,7 @@
 #define MAX_DMA_PFN   ((16UL * 1024 * 1024) >> PAGE_SHIFT)
 
 /* 4GB broken PCI/AGP hardware bus master zone */
-#define MAX_DMA32_PFN ((4UL * 1024 * 1024 * 1024) >> PAGE_SHIFT)
+#define MAX_DMA32_PFN (1UL << (32 - PAGE_SHIFT))
 
 #ifdef CONFIG_X86_32
 /* The maximum address that we can perform a DMA transfer to on this platform 
*/




[PATCH 5.6 128/177] drm/amd/display: Use cursor locking to prevent flip delays

2020-06-01 Thread Greg Kroah-Hartman
From: Aric Cyr 

[ Upstream commit b2a7b0ce0773bfa4406bc0a78e41979532a1edd7 ]

[Why]
Current locking scheme for cursor can result in a flip missing
its vsync, deferring it for one or more vsyncs.  Result is a
potential for stuttering when cursor is moved.

[How]
Use cursor update lock so that flips are not blocked while cursor
is being programmed.

Signed-off-by: Aric Cyr 
Reviewed-by: Nicholas Kazlauskas 
Acked-by: Aurabindo Pillai 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 .../gpu/drm/amd/display/dc/core/dc_stream.c   | 40 ++-
 .../display/dc/dce110/dce110_hw_sequencer.c   |  1 +
 .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 10 +
 .../amd/display/dc/dcn10/dcn10_hw_sequencer.h |  1 +
 .../gpu/drm/amd/display/dc/dcn10/dcn10_init.c |  1 +
 .../gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c  | 15 +++
 .../gpu/drm/amd/display/dc/dcn10/dcn10_mpc.h  | 20 +++---
 .../drm/amd/display/dc/dcn10/dcn10_resource.c | 14 ++-
 .../gpu/drm/amd/display/dc/dcn20/dcn20_init.c |  1 +
 .../gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c  |  1 +
 .../gpu/drm/amd/display/dc/dcn20/dcn20_mpc.h  |  3 +-
 .../drm/amd/display/dc/dcn20/dcn20_resource.c |  4 ++
 .../gpu/drm/amd/display/dc/dcn21/dcn21_init.c |  1 +
 .../drm/amd/display/dc/dcn21/dcn21_resource.c |  4 ++
 drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h   | 16 
 .../gpu/drm/amd/display/dc/inc/hw_sequencer.h |  1 +
 16 files changed, 88 insertions(+), 45 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
index 8c20e9e907b2..4f0e7203dba4 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
@@ -231,34 +231,6 @@ struct dc_stream_status *dc_stream_get_status(
return dc_stream_get_status_from_state(dc->current_state, stream);
 }
 
-static void delay_cursor_until_vupdate(struct pipe_ctx *pipe_ctx, struct dc 
*dc)
-{
-#if defined(CONFIG_DRM_AMD_DC_DCN)
-   unsigned int vupdate_line;
-   unsigned int lines_to_vupdate, us_to_vupdate, vpos, nvpos;
-   struct dc_stream_state *stream = pipe_ctx->stream;
-   unsigned int us_per_line;
-
-   if (!dc->hwss.get_vupdate_offset_from_vsync)
-   return;
-
-   vupdate_line = dc->hwss.get_vupdate_offset_from_vsync(pipe_ctx);
-   if (!dc_stream_get_crtc_position(dc, &stream, 1, &vpos, &nvpos))
-   return;
-
-   if (vpos >= vupdate_line)
-   return;
-
-   us_per_line =
-   stream->timing.h_total * 1 / stream->timing.pix_clk_100hz;
-   lines_to_vupdate = vupdate_line - vpos;
-   us_to_vupdate = lines_to_vupdate * us_per_line;
-
-   /* 70 us is a conservative estimate of cursor update time*/
-   if (us_to_vupdate < 70)
-   udelay(us_to_vupdate);
-#endif
-}
 
 /**
  * dc_stream_set_cursor_attributes() - Update cursor attributes and set cursor 
surface address
@@ -298,9 +270,7 @@ bool dc_stream_set_cursor_attributes(
 
if (!pipe_to_program) {
pipe_to_program = pipe_ctx;
-
-   delay_cursor_until_vupdate(pipe_ctx, dc);
-   dc->hwss.pipe_control_lock(dc, pipe_to_program, true);
+   dc->hwss.cursor_lock(dc, pipe_to_program, true);
}
 
dc->hwss.set_cursor_attribute(pipe_ctx);
@@ -309,7 +279,7 @@ bool dc_stream_set_cursor_attributes(
}
 
if (pipe_to_program)
-   dc->hwss.pipe_control_lock(dc, pipe_to_program, false);
+   dc->hwss.cursor_lock(dc, pipe_to_program, false);
 
return true;
 }
@@ -349,16 +319,14 @@ bool dc_stream_set_cursor_position(
 
if (!pipe_to_program) {
pipe_to_program = pipe_ctx;
-
-   delay_cursor_until_vupdate(pipe_ctx, dc);
-   dc->hwss.pipe_control_lock(dc, pipe_to_program, true);
+   dc->hwss.cursor_lock(dc, pipe_to_program, true);
}
 
dc->hwss.set_cursor_position(pipe_ctx);
}
 
if (pipe_to_program)
-   dc->hwss.pipe_control_lock(dc, pipe_to_program, false);
+   dc->hwss.cursor_lock(dc, pipe_to_program, false);
 
return true;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c 
b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
index 56d4ec7bdad7..454a123b92fc 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
@@ -2723,6 +2723,7 @@ static const struct hw_sequencer_funcs dce110_funcs = {
.disable_plane = dce110_power_down_fe,
.pipe_control_lock = dce_pipe_control_lock,
.interdependent_update_lock = NULL,
+   .cursor_lock = dce_pipe_control_lock,
.prepare_bandwidth = dce110_prepare_bandwidth,
.optimize_bandwidth = dce11

[PATCH 5.6 156/177] netfilter: conntrack: make conntrack userspace helpers work again

2020-06-01 Thread Greg Kroah-Hartman
From: Pablo Neira Ayuso 

commit ee04805ff54a63ffd90bc6749ebfe73473734ddb upstream.

Florian Westphal says:

"Problem is that after the helper hook was merged back into the confirm
one, the queueing itself occurs from the confirm hook, i.e. we queue
from the last netfilter callback in the hook-list.

Therefore, on return, the packet bypasses the confirm action and the
connection is never committed to the main conntrack table.

To fix this there are several ways:
1. revert the 'Fixes' commit and have a extra helper hook again.
   Works, but has the drawback of adding another indirect call for
   everyone.

2. Special case this: split the hooks only when userspace helper
   gets added, so queueing occurs at a lower priority again,
   and normal enqueue reinject would eventually call the last hook.

3. Extend the existing nf_queue ct update hook to allow a forced
   confirmation (plus run the seqadj code).

This goes for 3)."

Fixes: 827318feb69cb ("netfilter: conntrack: remove helper hook again")
Reviewed-by: Florian Westphal 
Signed-off-by: Pablo Neira Ayuso 
Signed-off-by: Greg Kroah-Hartman 

---
 net/netfilter/nf_conntrack_core.c |   78 +++---
 1 file changed, 72 insertions(+), 6 deletions(-)

--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -2014,22 +2014,18 @@ static void nf_conntrack_attach(struct s
nf_conntrack_get(skb_nfct(nskb));
 }
 
-static int nf_conntrack_update(struct net *net, struct sk_buff *skb)
+static int __nf_conntrack_update(struct net *net, struct sk_buff *skb,
+struct nf_conn *ct)
 {
struct nf_conntrack_tuple_hash *h;
struct nf_conntrack_tuple tuple;
enum ip_conntrack_info ctinfo;
struct nf_nat_hook *nat_hook;
unsigned int status;
-   struct nf_conn *ct;
int dataoff;
u16 l3num;
u8 l4num;
 
-   ct = nf_ct_get(skb, &ctinfo);
-   if (!ct || nf_ct_is_confirmed(ct))
-   return 0;
-
l3num = nf_ct_l3num(ct);
 
dataoff = get_l4proto(skb, skb_network_offset(skb), l3num, &l4num);
@@ -2086,6 +2082,76 @@ static int nf_conntrack_update(struct ne
return 0;
 }
 
+/* This packet is coming from userspace via nf_queue, complete the packet
+ * processing after the helper invocation in nf_confirm().
+ */
+static int nf_confirm_cthelper(struct sk_buff *skb, struct nf_conn *ct,
+  enum ip_conntrack_info ctinfo)
+{
+   const struct nf_conntrack_helper *helper;
+   const struct nf_conn_help *help;
+   unsigned int protoff;
+
+   help = nfct_help(ct);
+   if (!help)
+   return 0;
+
+   helper = rcu_dereference(help->helper);
+   if (!(helper->flags & NF_CT_HELPER_F_USERSPACE))
+   return 0;
+
+   switch (nf_ct_l3num(ct)) {
+   case NFPROTO_IPV4:
+   protoff = skb_network_offset(skb) + ip_hdrlen(skb);
+   break;
+#if IS_ENABLED(CONFIG_IPV6)
+   case NFPROTO_IPV6: {
+   __be16 frag_off;
+   u8 pnum;
+
+   pnum = ipv6_hdr(skb)->nexthdr;
+   protoff = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &pnum,
+  &frag_off);
+   if (protoff < 0 || (frag_off & htons(~0x7)) != 0)
+   return 0;
+   break;
+   }
+#endif
+   default:
+   return 0;
+   }
+
+   if (test_bit(IPS_SEQ_ADJUST_BIT, &ct->status) &&
+   !nf_is_loopback_packet(skb)) {
+   if (!nf_ct_seq_adjust(skb, ct, ctinfo, protoff)) {
+   NF_CT_STAT_INC_ATOMIC(nf_ct_net(ct), drop);
+   return -1;
+   }
+   }
+
+   /* We've seen it coming out the other side: confirm it */
+   return nf_conntrack_confirm(skb) == NF_DROP ? - 1 : 0;
+}
+
+static int nf_conntrack_update(struct net *net, struct sk_buff *skb)
+{
+   enum ip_conntrack_info ctinfo;
+   struct nf_conn *ct;
+   int err;
+
+   ct = nf_ct_get(skb, &ctinfo);
+   if (!ct)
+   return 0;
+
+   if (!nf_ct_is_confirmed(ct)) {
+   err = __nf_conntrack_update(net, skb, ct);
+   if (err < 0)
+   return err;
+   }
+
+   return nf_confirm_cthelper(skb, ct, ctinfo);
+}
+
 static bool nf_conntrack_get_tuple_skb(struct nf_conntrack_tuple *dst_tuple,
   const struct sk_buff *skb)
 {




[PATCH 5.6 150/177] xfrm: fix a warning in xfrm_policy_insert_list

2020-06-01 Thread Greg Kroah-Hartman
From: Xin Long 

commit ed17b8d377eaf6b4a01d46942b4c647378a79bdd upstream.

This waring can be triggered simply by:

  # ip xfrm policy update src 192.168.1.1/24 dst 192.168.1.2/24 dir in \
priority 1 mark 0 mask 0x10  #[1]
  # ip xfrm policy update src 192.168.1.1/24 dst 192.168.1.2/24 dir in \
priority 2 mark 0 mask 0x1   #[2]
  # ip xfrm policy update src 192.168.1.1/24 dst 192.168.1.2/24 dir in \
priority 2 mark 0 mask 0x10  #[3]

Then dmesg shows:

  [ ] WARNING: CPU: 1 PID: 7265 at net/xfrm/xfrm_policy.c:1548
  [ ] RIP: 0010:xfrm_policy_insert_list+0x2f2/0x1030
  [ ] Call Trace:
  [ ]  xfrm_policy_inexact_insert+0x85/0xe50
  [ ]  xfrm_policy_insert+0x4ba/0x680
  [ ]  xfrm_add_policy+0x246/0x4d0
  [ ]  xfrm_user_rcv_msg+0x331/0x5c0
  [ ]  netlink_rcv_skb+0x121/0x350
  [ ]  xfrm_netlink_rcv+0x66/0x80
  [ ]  netlink_unicast+0x439/0x630
  [ ]  netlink_sendmsg+0x714/0xbf0
  [ ]  sock_sendmsg+0xe2/0x110

The issue was introduced by Commit 7cb8a93968e3 ("xfrm: Allow inserting
policies with matching mark and different priorities"). After that, the
policies [1] and [2] would be able to be added with different priorities.

However, policy [3] will actually match both [1] and [2]. Policy [1]
was matched due to the 1st 'return true' in xfrm_policy_mark_match(),
and policy [2] was matched due to the 2nd 'return true' in there. It
caused WARN_ON() in xfrm_policy_insert_list().

This patch is to fix it by only (the same value and priority) as the
same policy in xfrm_policy_mark_match().

Thanks to Yuehaibing, we could make this fix better.

v1->v2:
  - check policy->mark.v == pol->mark.v only without mask.

Fixes: 7cb8a93968e3 ("xfrm: Allow inserting policies with matching mark and 
different priorities")
Reported-by: Xiumei Mu 
Signed-off-by: Xin Long 
Signed-off-by: Steffen Klassert 
Signed-off-by: Greg Kroah-Hartman 

---
 net/xfrm/xfrm_policy.c |7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1436,12 +1436,7 @@ static void xfrm_policy_requeue(struct x
 static bool xfrm_policy_mark_match(struct xfrm_policy *policy,
   struct xfrm_policy *pol)
 {
-   u32 mark = policy->mark.v & policy->mark.m;
-
-   if (policy->mark.v == pol->mark.v && policy->mark.m == pol->mark.m)
-   return true;
-
-   if ((mark & pol->mark.m) == pol->mark.v &&
+   if (policy->mark.v == pol->mark.v &&
policy->priority == pol->priority)
return true;
 




[PATCH 5.6 139/177] parisc: Fix kernel panic in mem_init()

2020-06-01 Thread Greg Kroah-Hartman
From: Helge Deller 

[ Upstream commit bf71bc16e02162388808949b179d59d0b571b965 ]

The Debian kernel v5.6 triggers this kernel panic:

 Kernel panic - not syncing: Bad Address (null pointer deref?)
 Bad Address (null pointer deref?): Code=26 (Data memory access rights trap) at 
addr 
 CPU: 0 PID: 0 Comm: swapper Not tainted 5.6.0-2-parisc64 #1 Debian 5.6.14-1
  IAOQ[0]: mem_init+0xb0/0x150
  IAOQ[1]: mem_init+0xb4/0x150
  RP(r2): start_kernel+0x6c8/0x1190
 Backtrace:
  [<40101ab4>] start_kernel+0x6c8/0x1190
  [<40108574>] start_parisc+0x158/0x1b8

on a HP-PARISC rp3440 machine with this memory layout:
 Memory Ranges:
  0) Start 0x End 0x3fff Size   1024 MB
  1) Start 0x00404000 End 0x0040ffdf Size   3070 MB

Fix the crash by avoiding virt_to_page() and similar functions in
mem_init() until the memory zones have been fully set up.

Signed-off-by: Helge Deller 
Cc: sta...@vger.kernel.org # v5.0+
Signed-off-by: Sasha Levin 
---
 arch/parisc/mm/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 5224fb38d766..01d7071b23f7 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -562,7 +562,7 @@ void __init mem_init(void)
> BITS_PER_LONG);
 
high_memory = __va((max_pfn << PAGE_SHIFT));
-   set_max_mapnr(page_to_pfn(virt_to_page(high_memory - 1)) + 1);
+   set_max_mapnr(max_low_pfn);
memblock_free_all();
 
 #ifdef CONFIG_PA11
-- 
2.25.1





<    5   6   7   8   9   10   11   12   13   14   >