]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
bridge: Only call /sbin/bridge-stp for the initial network namespace
authorHannes Frederic Sowa <hannes@stressinduktion.org>
Tue, 5 Jan 2016 09:46:00 +0000 (10:46 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 5 Jan 2016 21:46:17 +0000 (16:46 -0500)
[I stole this patch from Eric Biederman. He wrote:]

> There is no defined mechanism to pass network namespace information
> into /sbin/bridge-stp therefore don't even try to invoke it except
> for bridge devices in the initial network namespace.
>
> It is possible for unprivileged users to cause /sbin/bridge-stp to be
> invoked for any network device name which if /sbin/bridge-stp does not
> guard against unreasonable arguments or being invoked twice on the
> same network device could cause problems.

[Hannes: changed patch using netns_eq]

Cc: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_stp_if.c

index 12045dea276c2ddae68f0d17ad0444eba02b8d02..8a7ada8bb947f5129375e549c22af5a5b32c5a99 100644 (file)
@@ -142,7 +142,10 @@ static void br_stp_start(struct net_bridge *br)
        char *envp[] = { NULL };
        struct net_bridge_port *p;
 
-       r = call_usermodehelper(BR_STP_PROG, argv, envp, UMH_WAIT_PROC);
+       if (net_eq(dev_net(br->dev), &init_net))
+               r = call_usermodehelper(BR_STP_PROG, argv, envp, UMH_WAIT_PROC);
+       else
+               r = -ENOENT;
 
        spin_lock_bh(&br->lock);