mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-10-26 10:57:38 +08:00
During network namespace teardown, devlink_pernet_pre_exit() reloads
devlink instances into init_net. If reload_down() fails, devlink_reload()
returns before changing the namespace, leaving the registered devlink with
a pointer to the namespace being destroyed.
Move the fallback transition to devlink_pernet_pre_exit(), where the
teardown context is explicit. Do it only when the devlink still belongs to
the exiting namespace, since reload_up() can fail after the regular reload
path has already moved the instance. Keep the original reload error.
Cc: stable+noautosel@kernel.org # unlikely driver error paths
Fixes: 070c63f20f ("net: devlink: allow to change namespaces during reload")
Reported-by: Vega <vega@nebusec.ai>
Closes: https://bugtracker.nebusec.ai/f/11365
Signed-off-by: Zixuan Chai <petalzu987@gmail.com>
Signed-off-by: Ren Wei <weir@nebusec.ai>
Link: https://patch.msgid.link/c43794aa549424b79a0da624e73bbb5215c0e9f5.1791555658.git.petalzu987@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>