netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] net: ftgmac100: Fix crash when removing driver
@ 2020-11-16  3:27 Joel Stanley
  2020-11-17  1:20 ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Stanley @ 2020-11-16  3:27 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, David S . Miller, Jakub Kicinski
  Cc: Andrew Jeffery, Ivan Mikhaylov, netdev

When removing the driver we would hit BUG_ON(!list_empty(&dev->ptype_specific))
in net/core/dev.c due to still having the NC-SI packet handler
registered.

 # echo 1e660000.ethernet > /sys/bus/platform/drivers/ftgmac100/unbind
  ------------[ cut here ]------------
  kernel BUG at net/core/dev.c:10254!
  Internal error: Oops - BUG: 0 [#1] SMP ARM
  CPU: 0 PID: 115 Comm: sh Not tainted 5.10.0-rc3-next-20201111-00007-g02e0365710c4 #46
  Hardware name: Generic DT based system
  PC is at netdev_run_todo+0x314/0x394
  LR is at cpumask_next+0x20/0x24
  pc : [<806f5830>]    lr : [<80863cb0>]    psr: 80000153
  sp : 855bbd58  ip : 00000001  fp : 855bbdac
  r10: 80c03d00  r9 : 80c06228  r8 : 81158c54
  r7 : 00000000  r6 : 80c05dec  r5 : 80c05d18  r4 : 813b9280
  r3 : 813b9054  r2 : 8122c470  r1 : 00000002  r0 : 00000002
  Flags: Nzcv  IRQs on  FIQs off  Mode SVC_32  ISA ARM  Segment none
  Control: 00c5387d  Table: 85514008  DAC: 00000051
  Process sh (pid: 115, stack limit = 0x7cb5703d)
 ...
  Backtrace:
  [<806f551c>] (netdev_run_todo) from [<80707eec>] (rtnl_unlock+0x18/0x1c)
   r10:00000051 r9:854ed710 r8:81158c54 r7:80c76bb0 r6:81158c10 r5:8115b410
   r4:813b9000
  [<80707ed4>] (rtnl_unlock) from [<806f5db8>] (unregister_netdev+0x2c/0x30)
  [<806f5d8c>] (unregister_netdev) from [<805a8180>] (ftgmac100_remove+0x20/0xa8)
   r5:8115b410 r4:813b9000
  [<805a8160>] (ftgmac100_remove) from [<805355e4>] (platform_drv_remove+0x34/0x4c)

Fixes: bd466c3fb5a4 ("net/faraday: Support NCSI mode")
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
v2: Also unregister in _probe

 drivers/net/ethernet/faraday/ftgmac100.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index 983b6db2d80d..88bfe2107938 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -1926,6 +1926,8 @@ static int ftgmac100_probe(struct platform_device *pdev)
 err_phy_connect:
 	ftgmac100_phy_disconnect(netdev);
 err_ncsi_dev:
+	if (priv->ndev)
+		ncsi_unregister_dev(priv->ndev);
 	ftgmac100_destroy_mdio(netdev);
 err_setup_mdio:
 	iounmap(priv->base);
@@ -1945,6 +1947,8 @@ static int ftgmac100_remove(struct platform_device *pdev)
 	netdev = platform_get_drvdata(pdev);
 	priv = netdev_priv(netdev);
 
+	if (priv->ndev)
+		ncsi_unregister_dev(priv->ndev);
 	unregister_netdev(netdev);
 
 	clk_disable_unprepare(priv->rclk);
-- 
2.29.2


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

* Re: [PATCH v2] net: ftgmac100: Fix crash when removing driver
  2020-11-16  3:27 [PATCH v2] net: ftgmac100: Fix crash when removing driver Joel Stanley
@ 2020-11-17  1:20 ` Jakub Kicinski
  2020-11-17  1:21   ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2020-11-17  1:20 UTC (permalink / raw)
  To: Joel Stanley
  Cc: Benjamin Herrenschmidt, David S . Miller, Andrew Jeffery,
	Ivan Mikhaylov, netdev

On Mon, 16 Nov 2020 13:57:15 +1030 Joel Stanley wrote:
> When removing the driver we would hit BUG_ON(!list_empty(&dev->ptype_specific))
> in net/core/dev.c due to still having the NC-SI packet handler
> registered.
> 
>  # echo 1e660000.ethernet > /sys/bus/platform/drivers/ftgmac100/unbind
>   ------------[ cut here ]------------
>   kernel BUG at net/core/dev.c:10254!
>   Internal error: Oops - BUG: 0 [#1] SMP ARM
>   CPU: 0 PID: 115 Comm: sh Not tainted 5.10.0-rc3-next-20201111-00007-g02e0365710c4 #46
>   Hardware name: Generic DT based system
>   PC is at netdev_run_todo+0x314/0x394
>   LR is at cpumask_next+0x20/0x24
>   pc : [<806f5830>]    lr : [<80863cb0>]    psr: 80000153
>   sp : 855bbd58  ip : 00000001  fp : 855bbdac
>   r10: 80c03d00  r9 : 80c06228  r8 : 81158c54
>   r7 : 00000000  r6 : 80c05dec  r5 : 80c05d18  r4 : 813b9280
>   r3 : 813b9054  r2 : 8122c470  r1 : 00000002  r0 : 00000002
>   Flags: Nzcv  IRQs on  FIQs off  Mode SVC_32  ISA ARM  Segment none
>   Control: 00c5387d  Table: 85514008  DAC: 00000051
>   Process sh (pid: 115, stack limit = 0x7cb5703d)
>  ...
>   Backtrace:
>   [<806f551c>] (netdev_run_todo) from [<80707eec>] (rtnl_unlock+0x18/0x1c)
>    r10:00000051 r9:854ed710 r8:81158c54 r7:80c76bb0 r6:81158c10 r5:8115b410
>    r4:813b9000
>   [<80707ed4>] (rtnl_unlock) from [<806f5db8>] (unregister_netdev+0x2c/0x30)
>   [<806f5d8c>] (unregister_netdev) from [<805a8180>] (ftgmac100_remove+0x20/0xa8)
>    r5:8115b410 r4:813b9000
>   [<805a8160>] (ftgmac100_remove) from [<805355e4>] (platform_drv_remove+0x34/0x4c)
> 
> Fixes: bd466c3fb5a4 ("net/faraday: Support NCSI mode")
> Signed-off-by: Joel Stanley <joel@jms.id.au>

> diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
> index 983b6db2d80d..88bfe2107938 100644
> --- a/drivers/net/ethernet/faraday/ftgmac100.c
> +++ b/drivers/net/ethernet/faraday/ftgmac100.c
> @@ -1926,6 +1926,8 @@ static int ftgmac100_probe(struct platform_device *pdev)
>  err_phy_connect:
>  	ftgmac100_phy_disconnect(netdev);

This line does not exist in net, only in net-next, please respin on top
of net so we can apply this to Linux 5.10 and backport to older stable
releases.


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

* Re: [PATCH v2] net: ftgmac100: Fix crash when removing driver
  2020-11-17  1:20 ` Jakub Kicinski
@ 2020-11-17  1:21   ` Jakub Kicinski
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2020-11-17  1:21 UTC (permalink / raw)
  To: Joel Stanley
  Cc: Benjamin Herrenschmidt, David S . Miller, Andrew Jeffery,
	Ivan Mikhaylov, netdev

On Mon, 16 Nov 2020 17:20:44 -0800 Jakub Kicinski wrote:
> On Mon, 16 Nov 2020 13:57:15 +1030 Joel Stanley wrote:
> > When removing the driver we would hit BUG_ON(!list_empty(&dev->ptype_specific))
> > in net/core/dev.c due to still having the NC-SI packet handler
> > registered.
> > 
> >  # echo 1e660000.ethernet > /sys/bus/platform/drivers/ftgmac100/unbind
> >   ------------[ cut here ]------------
> >   kernel BUG at net/core/dev.c:10254!
> >   Internal error: Oops - BUG: 0 [#1] SMP ARM
> >   CPU: 0 PID: 115 Comm: sh Not tainted 5.10.0-rc3-next-20201111-00007-g02e0365710c4 #46
> >   Hardware name: Generic DT based system
> >   PC is at netdev_run_todo+0x314/0x394
> >   LR is at cpumask_next+0x20/0x24
> >   pc : [<806f5830>]    lr : [<80863cb0>]    psr: 80000153
> >   sp : 855bbd58  ip : 00000001  fp : 855bbdac
> >   r10: 80c03d00  r9 : 80c06228  r8 : 81158c54
> >   r7 : 00000000  r6 : 80c05dec  r5 : 80c05d18  r4 : 813b9280
> >   r3 : 813b9054  r2 : 8122c470  r1 : 00000002  r0 : 00000002
> >   Flags: Nzcv  IRQs on  FIQs off  Mode SVC_32  ISA ARM  Segment none
> >   Control: 00c5387d  Table: 85514008  DAC: 00000051
> >   Process sh (pid: 115, stack limit = 0x7cb5703d)
> >  ...
> >   Backtrace:
> >   [<806f551c>] (netdev_run_todo) from [<80707eec>] (rtnl_unlock+0x18/0x1c)
> >    r10:00000051 r9:854ed710 r8:81158c54 r7:80c76bb0 r6:81158c10 r5:8115b410
> >    r4:813b9000
> >   [<80707ed4>] (rtnl_unlock) from [<806f5db8>] (unregister_netdev+0x2c/0x30)
> >   [<806f5d8c>] (unregister_netdev) from [<805a8180>] (ftgmac100_remove+0x20/0xa8)
> >    r5:8115b410 r4:813b9000
> >   [<805a8160>] (ftgmac100_remove) from [<805355e4>] (platform_drv_remove+0x34/0x4c)
> > 
> > Fixes: bd466c3fb5a4 ("net/faraday: Support NCSI mode")
> > Signed-off-by: Joel Stanley <joel@jms.id.au>  
> 
> > diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
> > index 983b6db2d80d..88bfe2107938 100644
> > --- a/drivers/net/ethernet/faraday/ftgmac100.c
> > +++ b/drivers/net/ethernet/faraday/ftgmac100.c
> > @@ -1926,6 +1926,8 @@ static int ftgmac100_probe(struct platform_device *pdev)
> >  err_phy_connect:
> >  	ftgmac100_phy_disconnect(netdev);  
> 
> This line does not exist in net, only in net-next, please respin on top
> of net so we can apply this to Linux 5.10 and backport to older stable
> releases.

Ah, and when you respin please put [PATCH net v3] in the subject so
that bots know which tree to test against.

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

end of thread, other threads:[~2020-11-17  1:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-16  3:27 [PATCH v2] net: ftgmac100: Fix crash when removing driver Joel Stanley
2020-11-17  1:20 ` Jakub Kicinski
2020-11-17  1:21   ` Jakub Kicinski

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