]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
net: ibm: emac: mal: fix potential system hang in mal_remove()
authorRosen Penev <rosenp@gmail.com>
Wed, 3 Jun 2026 23:08:21 +0000 (16:08 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 9 Jun 2026 00:35:50 +0000 (17:35 -0700)
commit7c5d41f87f079990bf241359e3c1332d8d10fe87
treed81aec3078acdef6c252f61f4b7002ed98e1903b
parentf0ba7f385de12d237f31c9439256647b25294a01
net: ibm: emac: mal: fix potential system hang in mal_remove()

napi_disable() is not idempotent and calling it on an already-disabled
or unenabled NAPI context will cause the kernel to spin indefinitely
waiting for the NAPI_STATE_SCHED bit to clear.

In mal_remove(), napi_disable() is called unconditionally. If no MACs were
registered, NAPI was never enabled. Also, if they were registered but
subsequently unregistered, NAPI was already disabled in
mal_unregister_commac(). In either case, calling napi_disable() causes
the kernel to hang upon module removal.

Fix this by only calling napi_disable() in mal_remove() if the commac list
is not empty (which implies NAPI is enabled).

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://patch.msgid.link/20260603230821.5619-1-rosenp@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/ibm/emac/mal.c