2020-06-03 11:44:30

by Michal Vokáč

[permalink] [raw]
Subject: [PATCH net] net: dsa: qca8k: Fix "Unexpected gfp" kernel exception

Commit 7e99e3470172 ("net: dsa: remove dsa_switch_alloc helper")
replaced the dsa_switch_alloc helper by devm_kzalloc in all DSA
drivers. Unfortunately it introduced a typo in qca8k.c driver and
wrong argument is passed to the devm_kzalloc function.

This fix mitigates the following kernel exception:

Unexpected gfp: 0x6 (__GFP_HIGHMEM|GFP_DMA32). Fixing up to gfp: 0x101 (GFP_DMA|__GFP_ZERO). Fix your code!
CPU: 1 PID: 44 Comm: kworker/1:1 Not tainted 5.5.9-yocto-ua #1
Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
Workqueue: events deferred_probe_work_func
[<c0014924>] (unwind_backtrace) from [<c00123bc>] (show_stack+0x10/0x14)
[<c00123bc>] (show_stack) from [<c04c8fb4>] (dump_stack+0x90/0xa4)
[<c04c8fb4>] (dump_stack) from [<c00e1b10>] (new_slab+0x20c/0x214)
[<c00e1b10>] (new_slab) from [<c00e1cd0>] (___slab_alloc.constprop.0+0x1b8/0x540)
[<c00e1cd0>] (___slab_alloc.constprop.0) from [<c00e2074>] (__slab_alloc.constprop.0+0x1c/0x24)
[<c00e2074>] (__slab_alloc.constprop.0) from [<c00e4538>] (__kmalloc_track_caller+0x1b0/0x298)
[<c00e4538>] (__kmalloc_track_caller) from [<c02cccac>] (devm_kmalloc+0x24/0x70)
[<c02cccac>] (devm_kmalloc) from [<c030d888>] (qca8k_sw_probe+0x94/0x1ac)
[<c030d888>] (qca8k_sw_probe) from [<c0304788>] (mdio_probe+0x30/0x54)
[<c0304788>] (mdio_probe) from [<c02c93bc>] (really_probe+0x1e0/0x348)
[<c02c93bc>] (really_probe) from [<c02c9884>] (driver_probe_device+0x60/0x16c)
[<c02c9884>] (driver_probe_device) from [<c02c7fb0>] (bus_for_each_drv+0x70/0x94)
[<c02c7fb0>] (bus_for_each_drv) from [<c02c9708>] (__device_attach+0xb4/0x11c)
[<c02c9708>] (__device_attach) from [<c02c8148>] (bus_probe_device+0x84/0x8c)
[<c02c8148>] (bus_probe_device) from [<c02c8cec>] (deferred_probe_work_func+0x64/0x90)
[<c02c8cec>] (deferred_probe_work_func) from [<c0033c14>] (process_one_work+0x1d4/0x41c)
[<c0033c14>] (process_one_work) from [<c00340a4>] (worker_thread+0x248/0x528)
[<c00340a4>] (worker_thread) from [<c0039148>] (kthread+0x124/0x150)
[<c0039148>] (kthread) from [<c00090d8>] (ret_from_fork+0x14/0x3c)
Exception stack(0xee1b5fb0 to 0xee1b5ff8)
5fa0: 00000000 00000000 00000000 00000000
5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
5fe0: 00000000 00000000 00000000 00000000 00000013 00000000
qca8k 2188000.ethernet-1:0a: Using legacy PHYLIB callbacks. Please migrate to PHYLINK!
qca8k 2188000.ethernet-1:0a eth2 (uninitialized): PHY [2188000.ethernet-1:01] driver [Generic PHY]
qca8k 2188000.ethernet-1:0a eth1 (uninitialized): PHY [2188000.ethernet-1:02] driver [Generic PHY]

Fixes: 7e99e3470172 ("net: dsa: remove dsa_switch_alloc helper")
Cc: <[email protected]>
Signed-off-by: Michal Vokáč <[email protected]>
---
drivers/net/dsa/qca8k.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index 9f4205b4439b..d2b5ab403e06 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -1079,8 +1079,7 @@ qca8k_sw_probe(struct mdio_device *mdiodev)
if (id != QCA8K_ID_QCA8337)
return -ENODEV;

- priv->ds = devm_kzalloc(&mdiodev->dev, sizeof(*priv->ds),
- QCA8K_NUM_PORTS);
+ priv->ds = devm_kzalloc(&mdiodev->dev, sizeof(*priv->ds), GFP_KERNEL);
if (!priv->ds)
return -ENOMEM;

--
2.1.4


2020-06-03 13:43:31

by Andrew Lunn

[permalink] [raw]
Subject: Re: [PATCH net] net: dsa: qca8k: Fix "Unexpected gfp" kernel exception

On Wed, Jun 03, 2020 at 01:31:39PM +0200, Michal Vokáč wrote:
> Commit 7e99e3470172 ("net: dsa: remove dsa_switch_alloc helper")
> replaced the dsa_switch_alloc helper by devm_kzalloc in all DSA
> drivers. Unfortunately it introduced a typo in qca8k.c driver and
> wrong argument is passed to the devm_kzalloc function.
>
> This fix mitigates the following kernel exception:
>
> Unexpected gfp: 0x6 (__GFP_HIGHMEM|GFP_DMA32). Fixing up to gfp: 0x101 (GFP_DMA|__GFP_ZERO). Fix your code!
> CPU: 1 PID: 44 Comm: kworker/1:1 Not tainted 5.5.9-yocto-ua #1
> Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
> Workqueue: events deferred_probe_work_func
> [<c0014924>] (unwind_backtrace) from [<c00123bc>] (show_stack+0x10/0x14)
> [<c00123bc>] (show_stack) from [<c04c8fb4>] (dump_stack+0x90/0xa4)
> [<c04c8fb4>] (dump_stack) from [<c00e1b10>] (new_slab+0x20c/0x214)
> [<c00e1b10>] (new_slab) from [<c00e1cd0>] (___slab_alloc.constprop.0+0x1b8/0x540)
> [<c00e1cd0>] (___slab_alloc.constprop.0) from [<c00e2074>] (__slab_alloc.constprop.0+0x1c/0x24)
> [<c00e2074>] (__slab_alloc.constprop.0) from [<c00e4538>] (__kmalloc_track_caller+0x1b0/0x298)
> [<c00e4538>] (__kmalloc_track_caller) from [<c02cccac>] (devm_kmalloc+0x24/0x70)
> [<c02cccac>] (devm_kmalloc) from [<c030d888>] (qca8k_sw_probe+0x94/0x1ac)
> [<c030d888>] (qca8k_sw_probe) from [<c0304788>] (mdio_probe+0x30/0x54)
> [<c0304788>] (mdio_probe) from [<c02c93bc>] (really_probe+0x1e0/0x348)
> [<c02c93bc>] (really_probe) from [<c02c9884>] (driver_probe_device+0x60/0x16c)
> [<c02c9884>] (driver_probe_device) from [<c02c7fb0>] (bus_for_each_drv+0x70/0x94)
> [<c02c7fb0>] (bus_for_each_drv) from [<c02c9708>] (__device_attach+0xb4/0x11c)
> [<c02c9708>] (__device_attach) from [<c02c8148>] (bus_probe_device+0x84/0x8c)
> [<c02c8148>] (bus_probe_device) from [<c02c8cec>] (deferred_probe_work_func+0x64/0x90)
> [<c02c8cec>] (deferred_probe_work_func) from [<c0033c14>] (process_one_work+0x1d4/0x41c)
> [<c0033c14>] (process_one_work) from [<c00340a4>] (worker_thread+0x248/0x528)
> [<c00340a4>] (worker_thread) from [<c0039148>] (kthread+0x124/0x150)
> [<c0039148>] (kthread) from [<c00090d8>] (ret_from_fork+0x14/0x3c)
> Exception stack(0xee1b5fb0 to 0xee1b5ff8)
> 5fa0: 00000000 00000000 00000000 00000000
> 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000
> qca8k 2188000.ethernet-1:0a: Using legacy PHYLIB callbacks. Please migrate to PHYLINK!
> qca8k 2188000.ethernet-1:0a eth2 (uninitialized): PHY [2188000.ethernet-1:01] driver [Generic PHY]
> qca8k 2188000.ethernet-1:0a eth1 (uninitialized): PHY [2188000.ethernet-1:02] driver [Generic PHY]
>
> Fixes: 7e99e3470172 ("net: dsa: remove dsa_switch_alloc helper")
> Cc: <[email protected]>
> Signed-off-by: Michal Vokáč <[email protected]>

Signed-off-by: Andrew Lunn <[email protected]>

Andrew

2020-06-03 13:45:06

by Andrew Lunn

[permalink] [raw]
Subject: Re: [PATCH net] net: dsa: qca8k: Fix "Unexpected gfp" kernel exception

On Wed, Jun 03, 2020 at 03:41:21PM +0200, Andrew Lunn wrote:
> On Wed, Jun 03, 2020 at 01:31:39PM +0200, Michal Vokáč wrote:
> > Commit 7e99e3470172 ("net: dsa: remove dsa_switch_alloc helper")
> > replaced the dsa_switch_alloc helper by devm_kzalloc in all DSA
> > drivers. Unfortunately it introduced a typo in qca8k.c driver and
> > wrong argument is passed to the devm_kzalloc function.
> >
> > This fix mitigates the following kernel exception:
> >
> > Unexpected gfp: 0x6 (__GFP_HIGHMEM|GFP_DMA32). Fixing up to gfp: 0x101 (GFP_DMA|__GFP_ZERO). Fix your code!
> > CPU: 1 PID: 44 Comm: kworker/1:1 Not tainted 5.5.9-yocto-ua #1
> > Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
> > Workqueue: events deferred_probe_work_func
> > [<c0014924>] (unwind_backtrace) from [<c00123bc>] (show_stack+0x10/0x14)
> > [<c00123bc>] (show_stack) from [<c04c8fb4>] (dump_stack+0x90/0xa4)
> > [<c04c8fb4>] (dump_stack) from [<c00e1b10>] (new_slab+0x20c/0x214)
> > [<c00e1b10>] (new_slab) from [<c00e1cd0>] (___slab_alloc.constprop.0+0x1b8/0x540)
> > [<c00e1cd0>] (___slab_alloc.constprop.0) from [<c00e2074>] (__slab_alloc.constprop.0+0x1c/0x24)
> > [<c00e2074>] (__slab_alloc.constprop.0) from [<c00e4538>] (__kmalloc_track_caller+0x1b0/0x298)
> > [<c00e4538>] (__kmalloc_track_caller) from [<c02cccac>] (devm_kmalloc+0x24/0x70)
> > [<c02cccac>] (devm_kmalloc) from [<c030d888>] (qca8k_sw_probe+0x94/0x1ac)
> > [<c030d888>] (qca8k_sw_probe) from [<c0304788>] (mdio_probe+0x30/0x54)
> > [<c0304788>] (mdio_probe) from [<c02c93bc>] (really_probe+0x1e0/0x348)
> > [<c02c93bc>] (really_probe) from [<c02c9884>] (driver_probe_device+0x60/0x16c)
> > [<c02c9884>] (driver_probe_device) from [<c02c7fb0>] (bus_for_each_drv+0x70/0x94)
> > [<c02c7fb0>] (bus_for_each_drv) from [<c02c9708>] (__device_attach+0xb4/0x11c)
> > [<c02c9708>] (__device_attach) from [<c02c8148>] (bus_probe_device+0x84/0x8c)
> > [<c02c8148>] (bus_probe_device) from [<c02c8cec>] (deferred_probe_work_func+0x64/0x90)
> > [<c02c8cec>] (deferred_probe_work_func) from [<c0033c14>] (process_one_work+0x1d4/0x41c)
> > [<c0033c14>] (process_one_work) from [<c00340a4>] (worker_thread+0x248/0x528)
> > [<c00340a4>] (worker_thread) from [<c0039148>] (kthread+0x124/0x150)
> > [<c0039148>] (kthread) from [<c00090d8>] (ret_from_fork+0x14/0x3c)
> > Exception stack(0xee1b5fb0 to 0xee1b5ff8)
> > 5fa0: 00000000 00000000 00000000 00000000
> > 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> > 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000
> > qca8k 2188000.ethernet-1:0a: Using legacy PHYLIB callbacks. Please migrate to PHYLINK!
> > qca8k 2188000.ethernet-1:0a eth2 (uninitialized): PHY [2188000.ethernet-1:01] driver [Generic PHY]
> > qca8k 2188000.ethernet-1:0a eth1 (uninitialized): PHY [2188000.ethernet-1:02] driver [Generic PHY]
> >
> > Fixes: 7e99e3470172 ("net: dsa: remove dsa_switch_alloc helper")
> > Cc: <[email protected]>
> > Signed-off-by: Michal Vokáč <[email protected]>
>
> Signed-off-by: Andrew Lunn <[email protected]>

Arg! Sorry, wrong tag.

Reviewed-by: Andrew Lunn <[email protected]>

Andrew

2020-06-04 22:51:17

by David Miller

[permalink] [raw]
Subject: Re: [PATCH net] net: dsa: qca8k: Fix "Unexpected gfp" kernel exception

From: Michal Vok?? <[email protected]>
Date: Wed, 3 Jun 2020 13:31:39 +0200

> Commit 7e99e3470172 ("net: dsa: remove dsa_switch_alloc helper")
> replaced the dsa_switch_alloc helper by devm_kzalloc in all DSA
> drivers. Unfortunately it introduced a typo in qca8k.c driver and
> wrong argument is passed to the devm_kzalloc function.
>
> This fix mitigates the following kernel exception:
...
> Fixes: 7e99e3470172 ("net: dsa: remove dsa_switch_alloc helper")
> Cc: <[email protected]>

Please do not CC: stable for networking changes.

> Signed-off-by: Michal Vok?? <[email protected]>

Applied and queued up for -stable, thank you.