* [PATCH net v2] ieee802154: keep the original error after a netns rollback
@ 2026-11-20 6:57 Andrey Misiurov
2026-11-20 8:25 ` Miquel Raynal
0 siblings, 1 reply; 2+ messages in thread
From: Andrey Misiurov @ 2026-11-20 6:57 UTC (permalink / raw)
To: Alexander Aring, Stefan Schmidt, Miquel Raynal
Cc: linux-wpan, netdev, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, linux-kernel,
amisiurov
cfg802154_switch_netns() moves all of a phy's netdevs into a new netns. If
one move fails, it jumps to the errout label and moves the already-moved
netdevs back to the old netns.
That rollback loop overwrites the same 'err' variable with the result of
each move-back. The move-backs succeed, so 'err' ends up 0 and the function
returns 0 -- success -- even though nothing moved and the phy stayed in the
old netns. nl802154_wpan_phy_netns() then tells userspace the move worked.
Give the rollback loop its own 'err' so the original error survives and is
returned.
Fixes: 66e5c2672cd1 ("ieee802154: add netns support")
Signed-off-by: Andrey Misiurov <amisiurov@cloudlinux.com>
---
v2: shadow 'err' inside the rollback loop instead of adding a separate
variable next to it (Miquel Raynal).
Found during a backport review.
On debian13 6.12.88, "iwpan phy phy0 set netns name T" reported success
(returned 0) while phy0 and its wpan0 interface stayed in the original
namespace; internally the move had failed with -EEXIST, but the function
returned 0 anyway. With the fix the same command correctly fails
with "File exists".
net/ieee802154/core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/ieee802154/core.c b/net/ieee802154/core.c
--- a/net/ieee802154/core.c
+++ b/net/ieee802154/core.c
@@ -255,6 +255,8 @@ errout:
list_for_each_entry_continue_reverse(wpan_dev,
&rdev->wpan_dev_list,
list) {
+ int err;
+
if (!wpan_dev->netdev)
continue;
wpan_dev->netdev->netns_immutable = false;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH net v2] ieee802154: keep the original error after a netns rollback
2026-11-20 6:57 [PATCH net v2] ieee802154: keep the original error after a netns rollback Andrey Misiurov
@ 2026-11-20 8:25 ` Miquel Raynal
0 siblings, 0 replies; 2+ messages in thread
From: Miquel Raynal @ 2026-11-20 8:25 UTC (permalink / raw)
To: Andrey Misiurov
Cc: Alexander Aring, Stefan Schmidt, linux-wpan, netdev,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, linux-kernel
On 20/11/2026 at 07:57:49 +01, Andrey Misiurov <amisiurov@cloudlinux.com> wrote:
> cfg802154_switch_netns() moves all of a phy's netdevs into a new netns. If
> one move fails, it jumps to the errout label and moves the already-moved
> netdevs back to the old netns.
>
> That rollback loop overwrites the same 'err' variable with the result of
> each move-back. The move-backs succeed, so 'err' ends up 0 and the function
> returns 0 -- success -- even though nothing moved and the phy stayed in the
> old netns. nl802154_wpan_phy_netns() then tells userspace the move worked.
>
> Give the rollback loop its own 'err' so the original error survives and is
> returned.
>
> Fixes: 66e5c2672cd1 ("ieee802154: add netns support")
> Signed-off-by: Andrey Misiurov <amisiurov@cloudlinux.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-20 8:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-20 6:57 [PATCH net v2] ieee802154: keep the original error after a netns rollback Andrey Misiurov
2026-11-20 8:25 ` Miquel Raynal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®