From: Hannes Frederic Sowa Date: Tue, 5 Jan 2016 09:46:00 +0000 (+0100) Subject: bridge: Only call /sbin/bridge-stp for the initial network namespace X-Git-Tag: v4.1.12-92~150^2~367 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3ef0199fb21a8e7b5496cc1862efc22868b04d03;p=users%2Fjedix%2Flinux-maple.git bridge: Only call /sbin/bridge-stp for the initial network namespace Orabug: 23330545 [ Upstream commit ff62198553e43cdffa9d539f6165d3e83f8a42bc ] [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 Signed-off-by: Eric W. Biederman Signed-off-by: Hannes Frederic Sowa Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman (cherry picked from commit a6b1d24893805bb4f2e7c7bc6f86a98ec37065ee) Signed-off-by: Dan Duval --- diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c index 7832d07f48f66..ce658abdc2c8d 100644 --- a/net/bridge/br_stp_if.c +++ b/net/bridge/br_stp_if.c @@ -128,7 +128,10 @@ static void br_stp_start(struct net_bridge *br) char *argv[] = { BR_STP_PROG, br->dev->name, "start", NULL }; char *envp[] = { NULL }; - 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);