public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] s390/ism: Fix trying to free already-freed IRQ by repeated ism_dev_exit()
@ 2023-06-13 12:25 Julian Ruess
  2023-06-15  7:50 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Julian Ruess @ 2023-06-13 12:25 UTC (permalink / raw)
  To: Julian Ruess, Alexandra Winter, Wenjia Zhang, Heiko Carstens,
	Vasily Gorbik, Alexander Gordeev, Christian Borntraeger,
	Sven Schnelle, David S. Miller, Jan Karcher, Stefan Raspl
  Cc: linux-s390, netdev, linux-kernel, stable, Niklas Schnelle

This patch prevents the system from crashing when unloading the ISM module.

How to reproduce: Attach an ISM device and execute 'rmmod ism'.

Error-Log:
- Trying to free already-free IRQ 0
- WARNING: CPU: 1 PID: 966 at kernel/irq/manage.c:1890 free_irq+0x140/0x540

After calling ism_dev_exit() for each ISM device in the exit routine,
pci_unregister_driver() will execute ism_remove() for each ISM device.
Because ism_remove() also calls ism_dev_exit(),
free_irq(pci_irq_vector(pdev, 0), ism) is called twice for each ISM
device. This results in a crash with the error
'Trying to free already-free IRQ'.

In the exit routine, it is enough to call pci_unregister_driver()
because it ensures that ism_dev_exit() is called once per
ISM device.

Cc: <stable@vger.kernel.org> # 6.3+
Fixes: 89e7d2ba61b7 ("net/ism: Add new API for client registration")
Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Julian Ruess <julianr@linux.ibm.com>
---
 drivers/s390/net/ism_drv.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/s390/net/ism_drv.c b/drivers/s390/net/ism_drv.c
index 8acb9eba691b..c2096e4bba31 100644
--- a/drivers/s390/net/ism_drv.c
+++ b/drivers/s390/net/ism_drv.c
@@ -771,14 +771,6 @@ static int __init ism_init(void)
 
 static void __exit ism_exit(void)
 {
-	struct ism_dev *ism;
-
-	mutex_lock(&ism_dev_list.mutex);
-	list_for_each_entry(ism, &ism_dev_list.list, list) {
-		ism_dev_exit(ism);
-	}
-	mutex_unlock(&ism_dev_list.mutex);
-
 	pci_unregister_driver(&ism_driver);
 	debug_unregister(ism_debug_info);
 }

---
base-commit: 858fd168a95c5b9669aac8db6c14a9aeab446375
change-id: 20230613-ism-rmmod-crash-d4f34223a683

Best regards,
-- 
Julian Ruess <julianr@linux.ibm.com>


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

* Re: [PATCH] s390/ism: Fix trying to free already-freed IRQ by repeated ism_dev_exit()
  2023-06-13 12:25 [PATCH] s390/ism: Fix trying to free already-freed IRQ by repeated ism_dev_exit() Julian Ruess
@ 2023-06-15  7:50 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-06-15  7:50 UTC (permalink / raw)
  To: Julian Ruess
  Cc: wintera, wenjia, hca, gor, agordeev, borntraeger, svens, davem,
	jaka, raspl, linux-s390, netdev, linux-kernel, stable, schnelle

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Tue, 13 Jun 2023 14:25:37 +0200 you wrote:
> This patch prevents the system from crashing when unloading the ISM module.
> 
> How to reproduce: Attach an ISM device and execute 'rmmod ism'.
> 
> Error-Log:
> - Trying to free already-free IRQ 0
> - WARNING: CPU: 1 PID: 966 at kernel/irq/manage.c:1890 free_irq+0x140/0x540
> 
> [...]

Here is the summary with links:
  - s390/ism: Fix trying to free already-freed IRQ by repeated ism_dev_exit()
    https://git.kernel.org/netdev/net/c/78d0f94902af

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2023-06-15  7:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-13 12:25 [PATCH] s390/ism: Fix trying to free already-freed IRQ by repeated ism_dev_exit() Julian Ruess
2023-06-15  7:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox