]> git.ipfire.org Git - thirdparty/linux.git/commit
net: Add ops_undo_single for module load/unload.
authorKuniyuki Iwashima <kuniyu@amazon.com>
Fri, 11 Apr 2025 20:52:31 +0000 (13:52 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 15 Apr 2025 00:08:40 +0000 (17:08 -0700)
commitfed176bf3143362ac9935e3964949ab6a5c3286b
tree7c49e12e18dfc06c90ced3595cbeb1a498a2b855
parente333b1c3cf25fca348422c9ad5cc8db40b4243fa
net: Add ops_undo_single for module load/unload.

If ops_init() fails while loading a module or we unload the
module, free_exit_list() rolls back the changes.

The rollback sequence is the same as ops_undo_list().

The ops is already removed from pernet_list before calling
free_exit_list().  If we link the ops to a temporary list,
we can reuse ops_undo_list().

Let's add a wrapper of ops_undo_list() and use it instead
of free_exit_list().

Now, we have the central place to roll back ops_init().

Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
Link: https://patch.msgid.link/20250411205258.63164-3-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/net_namespace.c