netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v3] net: qualcomm: rmnet: require CAP_NET_ADMIN in the real device netns for config ops
@ 2026-08-29 17:06 user.email
  2026-08-31 20:22 ` subash.a.kasiviswanathan
  0 siblings, 1 reply; 4+ messages in thread
From: user.email @ 2026-08-29 17:06 UTC (permalink / raw)
  To: netdev, linux-kernel; +Cc: subash.a.kasiviswanathan, sean.tranchetti, horms

From: Abdifatah Suruur <suruurism@gmail.com>

An rmnet device may be created with its real device in a different
netns than the rmnet device itself (rmnet_newlink() resolves it in
link_net), and the rtnl config paths below only check CAP_NET_ADMIN
against dev_net(dev), while mutating rmnet port state attached to the
real device:

- rmnet_changelink() rewrites the endpoint mux table and
  port->data_format and, via rmnet_vnd_update_dev_mtu(), can shrink the
  MTU of the rmnet endpoint netdevs.
- rmnet_add_bridge() and rmnet_del_bridge(), reachable via
  ndo_add_slave/ndo_del_slave through RTM_SETLINK IFLA_MASTER, flip
  port->rmnet_mode and port->bridge_ep on the real device's port; with
  bridge_ep pointing at a caller-owned device, rmnet_rx_handler() then
  forwards real-device ingress frames to it.

A caller privileged only in the rmnet device's netns can therefore
rewrite the shared cellular data-path state owned by another netns, and
steer its ingress traffic.

Gate all three with rtnl_dev_link_net_capable(), matching the "require
CAP_NET_ADMIN in the device netns for changelink" series (vxlan/geneve,
CVE-2026-68432).

Fixes: 2abb5792387e ("net: qualcomm: rmnet: Allow configuration updates to existing devices")
Fixes: 60d58f971c1077 ("net: qualcomm: rmnet: Implement bridge mode")
Cc: stable@vger.kernel.org
Signed-off-by: Abdifatah Suruur <suruurism@gmail.com>
---
v3:
- cover rmnet_add_bridge() and rmnet_del_bridge() with the same gate;
  they mutate the same real-device port state via ndo_add_slave/
  ndo_del_slave and have no capability check of their own
- correct the impact wording: rmnet_vnd_update_dev_mtu() only reads
  real_dev->mtu; the MTU store lands on the rmnet endpoint netdevs via
  rmnet_vnd_change_mtu(), not on the real device
v2:
- drop Reported-by: (implied for the author), per Jakub Kicinski
---
 .../ethernet/qualcomm/rmnet/rmnet_config.c    | 30 ++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
index 78d4df55740a1..50c60e553d09f 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
@@ -312,6 +312,14 @@ static int rmnet_changelink(struct net_device *dev, struct nlattr *tb[],
 	if (!rmnet_is_real_dev_registered(real_dev))
 		return -ENODEV;
 
+	/*
+	 * The rtnl path only checks CAP_NET_ADMIN against dev_net(dev),
+	 * but the port state mutated below is attached to real_dev, which
+	 * may live in a different netns.
+	 */
+	if (!rtnl_dev_link_net_capable(dev, dev_net(real_dev)))
+		return -EPERM;
+
 	port = rmnet_get_port_rtnl(real_dev);
 
 	if (data[IFLA_RMNET_MUX_ID]) {
@@ -440,6 +448,14 @@ int rmnet_add_bridge(struct net_device *rmnet_dev,
 	struct rmnet_port *port, *slave_port;
 	int err;
 
+	/*
+	 * The rtnl path only checks CAP_NET_ADMIN against dev_net(dev),
+	 * but the port state mutated below is attached to real_dev, which
+	 * may live in a different netns.
+	 */
+	if (!rtnl_dev_link_net_capable(rmnet_dev, dev_net(real_dev)))
+		return -EPERM;
+
 	port = rmnet_get_port_rtnl(real_dev);
 
 	/* If there is more than one rmnet dev attached, its probably being
@@ -488,7 +504,19 @@ int rmnet_add_bridge(struct net_device *rmnet_dev,
 int rmnet_del_bridge(struct net_device *rmnet_dev,
 		     struct net_device *slave_dev)
 {
-	struct rmnet_port *port = rmnet_get_port_rtnl(slave_dev);
+	struct rmnet_priv *priv = netdev_priv(rmnet_dev);
+	struct net_device *real_dev = priv->real_dev;
+	struct rmnet_port *port;
+
+	/*
+	 * The rtnl path only checks CAP_NET_ADMIN against dev_net(dev),
+	 * but rmnet_unregister_bridge() below clears the bridge state of
+	 * the real device's port, which may live in a different netns.
+	 */
+	if (!rtnl_dev_link_net_capable(rmnet_dev, dev_net(real_dev)))
+		return -EPERM;
+
+	port = rmnet_get_port_rtnl(slave_dev);
 
 	rmnet_unregister_bridge(port);
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH net v3] net: qualcomm: rmnet: require CAP_NET_ADMIN in the real device netns for config ops
  2026-08-29 17:06 [PATCH net v3] net: qualcomm: rmnet: require CAP_NET_ADMIN in the real device netns for config ops user.email
@ 2026-08-31 20:22 ` subash.a.kasiviswanathan
  2026-08-31 20:47   ` Suruur
  0 siblings, 1 reply; 4+ messages in thread
From: subash.a.kasiviswanathan @ 2026-08-31 20:22 UTC (permalink / raw)
  To: 'user.email', netdev, linux-kernel; +Cc: sean.tranchetti, horms

> -----Original Message-----
> From: user.email <suruurism@gmail.com>
> Sent: Saturday, August 29, 2026 11:07 AM
> To: netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Cc: subash.a.kasiviswanathan@oss.qualcomm.com;
> sean.tranchetti@oss.qualcomm.com; horms@kernel.org
> Subject: [PATCH net v3] net: qualcomm: rmnet: require CAP_NET_ADMIN in
> the real device netns for config ops
> 
> From: Abdifatah Suruur <suruurism@gmail.com>
> 
> An rmnet device may be created with its real device in a different netns
than
> the rmnet device itself (rmnet_newlink() resolves it in link_net), and the
rtnl
> config paths below only check CAP_NET_ADMIN against dev_net(dev), while
> mutating rmnet port state attached to the real device:
> 
> - rmnet_changelink() rewrites the endpoint mux table and
>   port->data_format and, via rmnet_vnd_update_dev_mtu(), can shrink the
>   MTU of the rmnet endpoint netdevs.
> - rmnet_add_bridge() and rmnet_del_bridge(), reachable via
>   ndo_add_slave/ndo_del_slave through RTM_SETLINK IFLA_MASTER, flip
>   port->rmnet_mode and port->bridge_ep on the real device's port; with
>   bridge_ep pointing at a caller-owned device, rmnet_rx_handler() then
>   forwards real-device ingress frames to it.
> 
> A caller privileged only in the rmnet device's netns can therefore rewrite
the
> shared cellular data-path state owned by another netns, and steer its
ingress
> traffic.
> 
> Gate all three with rtnl_dev_link_net_capable(), matching the "require
> CAP_NET_ADMIN in the device netns for changelink" series (vxlan/geneve,
> CVE-2026-68432).
> 
> Fixes: 2abb5792387e ("net: qualcomm: rmnet: Allow configuration updates
> to existing devices")
> Fixes: 60d58f971c1077 ("net: qualcomm: rmnet: Implement bridge mode")
> Cc: stable@vger.kernel.org
> Signed-off-by: Abdifatah Suruur <suruurism@gmail.com>
> ---
> v3:
> - cover rmnet_add_bridge() and rmnet_del_bridge() with the same gate;
>   they mutate the same real-device port state via ndo_add_slave/
>   ndo_del_slave and have no capability check of their own
> - correct the impact wording: rmnet_vnd_update_dev_mtu() only reads
>   real_dev->mtu; the MTU store lands on the rmnet endpoint netdevs via
>   rmnet_vnd_change_mtu(), not on the real device
> v2:
> - drop Reported-by: (implied for the author), per Jakub Kicinski
> ---
>  .../ethernet/qualcomm/rmnet/rmnet_config.c    | 30
> ++++++++++++++++++-
>  1 file changed, 29 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
> b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
> index 78d4df55740a1..50c60e553d09f 100644
> --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
> +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
> @@ -312,6 +312,14 @@ static int rmnet_changelink(struct net_device *dev,
> struct nlattr *tb[],
>  	if (!rmnet_is_real_dev_registered(real_dev))
>  		return -ENODEV;
> 
> +	/*
> +	 * The rtnl path only checks CAP_NET_ADMIN against dev_net(dev),
> +	 * but the port state mutated below is attached to real_dev, which
> +	 * may live in a different netns.
> +	 */
> +	if (!rtnl_dev_link_net_capable(dev, dev_net(real_dev)))
> +		return -EPERM;
> +
>  	port = rmnet_get_port_rtnl(real_dev);
> 
>  	if (data[IFLA_RMNET_MUX_ID]) {
> @@ -440,6 +448,14 @@ int rmnet_add_bridge(struct net_device
> *rmnet_dev,
>  	struct rmnet_port *port, *slave_port;
>  	int err;
> 
> +	/*
> +	 * The rtnl path only checks CAP_NET_ADMIN against dev_net(dev),
> +	 * but the port state mutated below is attached to real_dev, which
> +	 * may live in a different netns.
> +	 */
> +	if (!rtnl_dev_link_net_capable(rmnet_dev, dev_net(real_dev)))
> +		return -EPERM;
> +
>  	port = rmnet_get_port_rtnl(real_dev);
> 
>  	/* If there is more than one rmnet dev attached, its probably being
> @@ -488,7 +504,19 @@ int rmnet_add_bridge(struct net_device
> *rmnet_dev,  int rmnet_del_bridge(struct net_device *rmnet_dev,
>  		     struct net_device *slave_dev)
>  {
> -	struct rmnet_port *port = rmnet_get_port_rtnl(slave_dev);
> +	struct rmnet_priv *priv = netdev_priv(rmnet_dev);
> +	struct net_device *real_dev = priv->real_dev;
> +	struct rmnet_port *port;
> +
> +	/*
> +	 * The rtnl path only checks CAP_NET_ADMIN against dev_net(dev),
> +	 * but rmnet_unregister_bridge() below clears the bridge state of
> +	 * the real device's port, which may live in a different netns.
> +	 */
> +	if (!rtnl_dev_link_net_capable(rmnet_dev, dev_net(real_dev)))
> +		return -EPERM;
> +
> +	port = rmnet_get_port_rtnl(slave_dev);
> 
>  	rmnet_unregister_bridge(port);
> 
> --
> 2.53.0

The change itself is fine though you might need to update the comment style
to match the networking convention
https://www.kernel.org/doc/html/v5.7/networking/netdev-FAQ.html#q-is-the-com
ment-style-convention-different-for-the-networking-content

diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
index bed6f63facf2..5d0a4a428e97 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
@@ -312,6 +312,13 @@ static int rmnet_changelink(struct net_device *dev,
struct nlattr *tb[],
        if (!rmnet_is_real_dev_registered(real_dev))
                return -ENODEV;
 
+       /* The rtnl path only checks CAP_NET_ADMIN against dev_net(dev),
+        * but the port state mutated below is attached to real_dev, which
+        * may live in a different netns.
+        */
+       if (!rtnl_dev_link_net_capable(dev, dev_net(real_dev)))
+               return -EPERM;
+
        port = rmnet_get_port_rtnl(real_dev);
 
        if (data[IFLA_RMNET_MUX_ID]) {
@@ -441,6 +448,13 @@ int rmnet_add_bridge(struct net_device *rmnet_dev,
        struct rmnet_port *port, *slave_port;
        int err;
 
+       /* The rtnl path only checks CAP_NET_ADMIN against dev_net(dev),
+        * but the port state mutated below is attached to real_dev, which
+        * may live in a different netns.
+        */
+       if (!rtnl_dev_link_net_capable(rmnet_dev, dev_net(real_dev)))
+               return -EPERM;
+
        port = rmnet_get_port_rtnl(real_dev);
 
        /* If there is more than one rmnet dev attached, its probably being
@@ -489,7 +503,18 @@ int rmnet_add_bridge(struct net_device *rmnet_dev,
 int rmnet_del_bridge(struct net_device *rmnet_dev,
                     struct net_device *slave_dev)
 {
-       struct rmnet_port *port = rmnet_get_port_rtnl(slave_dev);
+       struct rmnet_priv *priv = netdev_priv(rmnet_dev);
+       struct net_device *real_dev = priv->real_dev;
+       struct rmnet_port *port;
+
+       /* The rtnl path only checks CAP_NET_ADMIN against dev_net(dev),
+        * but rmnet_unregister_bridge() below clears the bridge state of
+        * the real device's port, which may live in a different netns.
+        */
+       if (!rtnl_dev_link_net_capable(rmnet_dev, dev_net(real_dev)))
+               return -EPERM;
+
+       port = rmnet_get_port_rtnl(slave_dev);
 
        rmnet_unregister_bridge(port);



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net v3] net: qualcomm: rmnet: require CAP_NET_ADMIN in the real device netns for config ops
  2026-08-31 20:22 ` subash.a.kasiviswanathan
@ 2026-08-31 20:47   ` Suruur
  2026-09-01  6:27     ` subash.a.kasiviswanathan
  0 siblings, 1 reply; 4+ messages in thread
From: Suruur @ 2026-08-31 20:47 UTC (permalink / raw)
  To: subash.a.kasiviswanathan; +Cc: netdev, linux-kernel, sean.tranchetti, horms


[-- Attachment #1.1: Type: text/plain, Size: 7940 bytes --]

Hi Subash,

Thanks for the review. Here is v4 with the comment blocks switched to
the networking style per the netdev FAQ; no other changes.

Thanks,
Abdifatah

On Mon, 31 Aug 2026 at 23:22, <subash.a.kasiviswanathan@oss.qualcomm.com>
wrote:

> > -----Original Message-----
> > From: user.email <suruurism@gmail.com>
> > Sent: Saturday, August 29, 2026 11:07 AM
> > To: netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> > Cc: subash.a.kasiviswanathan@oss.qualcomm.com;
> > sean.tranchetti@oss.qualcomm.com; horms@kernel.org
> > Subject: [PATCH net v3] net: qualcomm: rmnet: require CAP_NET_ADMIN in
> > the real device netns for config ops
> >
> > From: Abdifatah Suruur <suruurism@gmail.com>
> >
> > An rmnet device may be created with its real device in a different netns
> than
> > the rmnet device itself (rmnet_newlink() resolves it in link_net), and
> the
> rtnl
> > config paths below only check CAP_NET_ADMIN against dev_net(dev), while
> > mutating rmnet port state attached to the real device:
> >
> > - rmnet_changelink() rewrites the endpoint mux table and
> >   port->data_format and, via rmnet_vnd_update_dev_mtu(), can shrink the
> >   MTU of the rmnet endpoint netdevs.
> > - rmnet_add_bridge() and rmnet_del_bridge(), reachable via
> >   ndo_add_slave/ndo_del_slave through RTM_SETLINK IFLA_MASTER, flip
> >   port->rmnet_mode and port->bridge_ep on the real device's port; with
> >   bridge_ep pointing at a caller-owned device, rmnet_rx_handler() then
> >   forwards real-device ingress frames to it.
> >
> > A caller privileged only in the rmnet device's netns can therefore
> rewrite
> the
> > shared cellular data-path state owned by another netns, and steer its
> ingress
> > traffic.
> >
> > Gate all three with rtnl_dev_link_net_capable(), matching the "require
> > CAP_NET_ADMIN in the device netns for changelink" series (vxlan/geneve,
> > CVE-2026-68432).
> >
> > Fixes: 2abb5792387e ("net: qualcomm: rmnet: Allow configuration updates
> > to existing devices")
> > Fixes: 60d58f971c1077 ("net: qualcomm: rmnet: Implement bridge mode")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Abdifatah Suruur <suruurism@gmail.com>
> > ---
> > v3:
> > - cover rmnet_add_bridge() and rmnet_del_bridge() with the same gate;
> >   they mutate the same real-device port state via ndo_add_slave/
> >   ndo_del_slave and have no capability check of their own
> > - correct the impact wording: rmnet_vnd_update_dev_mtu() only reads
> >   real_dev->mtu; the MTU store lands on the rmnet endpoint netdevs via
> >   rmnet_vnd_change_mtu(), not on the real device
> > v2:
> > - drop Reported-by: (implied for the author), per Jakub Kicinski
> > ---
> >  .../ethernet/qualcomm/rmnet/rmnet_config.c    | 30
> > ++++++++++++++++++-
> >  1 file changed, 29 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
> > b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
> > index 78d4df55740a1..50c60e553d09f 100644
> > --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
> > +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
> > @@ -312,6 +312,14 @@ static int rmnet_changelink(struct net_device *dev,
> > struct nlattr *tb[],
> >       if (!rmnet_is_real_dev_registered(real_dev))
> >               return -ENODEV;
> >
> > +     /*
> > +      * The rtnl path only checks CAP_NET_ADMIN against dev_net(dev),
> > +      * but the port state mutated below is attached to real_dev, which
> > +      * may live in a different netns.
> > +      */
> > +     if (!rtnl_dev_link_net_capable(dev, dev_net(real_dev)))
> > +             return -EPERM;
> > +
> >       port = rmnet_get_port_rtnl(real_dev);
> >
> >       if (data[IFLA_RMNET_MUX_ID]) {
> > @@ -440,6 +448,14 @@ int rmnet_add_bridge(struct net_device
> > *rmnet_dev,
> >       struct rmnet_port *port, *slave_port;
> >       int err;
> >
> > +     /*
> > +      * The rtnl path only checks CAP_NET_ADMIN against dev_net(dev),
> > +      * but the port state mutated below is attached to real_dev, which
> > +      * may live in a different netns.
> > +      */
> > +     if (!rtnl_dev_link_net_capable(rmnet_dev, dev_net(real_dev)))
> > +             return -EPERM;
> > +
> >       port = rmnet_get_port_rtnl(real_dev);
> >
> >       /* If there is more than one rmnet dev attached, its probably being
> > @@ -488,7 +504,19 @@ int rmnet_add_bridge(struct net_device
> > *rmnet_dev,  int rmnet_del_bridge(struct net_device *rmnet_dev,
> >                    struct net_device *slave_dev)
> >  {
> > -     struct rmnet_port *port = rmnet_get_port_rtnl(slave_dev);
> > +     struct rmnet_priv *priv = netdev_priv(rmnet_dev);
> > +     struct net_device *real_dev = priv->real_dev;
> > +     struct rmnet_port *port;
> > +
> > +     /*
> > +      * The rtnl path only checks CAP_NET_ADMIN against dev_net(dev),
> > +      * but rmnet_unregister_bridge() below clears the bridge state of
> > +      * the real device's port, which may live in a different netns.
> > +      */
> > +     if (!rtnl_dev_link_net_capable(rmnet_dev, dev_net(real_dev)))
> > +             return -EPERM;
> > +
> > +     port = rmnet_get_port_rtnl(slave_dev);
> >
> >       rmnet_unregister_bridge(port);
> >
> > --
> > 2.53.0
>
> The change itself is fine though you might need to update the comment style
> to match the networking convention
>
> https://www.kernel.org/doc/html/v5.7/networking/netdev-FAQ.html#q-is-the-com
> ment-style-convention-different-for-the-networking-content
> <https://www.kernel.org/doc/html/v5.7/networking/netdev-FAQ.html#q-is-the-comment-style-convention-different-for-the-networking-content>
>
> diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
> b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
> index bed6f63facf2..5d0a4a428e97 100644
> --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
> +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
> @@ -312,6 +312,13 @@ static int rmnet_changelink(struct net_device *dev,
> struct nlattr *tb[],
>         if (!rmnet_is_real_dev_registered(real_dev))
>                 return -ENODEV;
>
> +       /* The rtnl path only checks CAP_NET_ADMIN against dev_net(dev),
> +        * but the port state mutated below is attached to real_dev, which
> +        * may live in a different netns.
> +        */
> +       if (!rtnl_dev_link_net_capable(dev, dev_net(real_dev)))
> +               return -EPERM;
> +
>         port = rmnet_get_port_rtnl(real_dev);
>
>         if (data[IFLA_RMNET_MUX_ID]) {
> @@ -441,6 +448,13 @@ int rmnet_add_bridge(struct net_device *rmnet_dev,
>         struct rmnet_port *port, *slave_port;
>         int err;
>
> +       /* The rtnl path only checks CAP_NET_ADMIN against dev_net(dev),
> +        * but the port state mutated below is attached to real_dev, which
> +        * may live in a different netns.
> +        */
> +       if (!rtnl_dev_link_net_capable(rmnet_dev, dev_net(real_dev)))
> +               return -EPERM;
> +
>         port = rmnet_get_port_rtnl(real_dev);
>
>         /* If there is more than one rmnet dev attached, its probably being
> @@ -489,7 +503,18 @@ int rmnet_add_bridge(struct net_device *rmnet_dev,
>  int rmnet_del_bridge(struct net_device *rmnet_dev,
>                      struct net_device *slave_dev)
>  {
> -       struct rmnet_port *port = rmnet_get_port_rtnl(slave_dev);
> +       struct rmnet_priv *priv = netdev_priv(rmnet_dev);
> +       struct net_device *real_dev = priv->real_dev;
> +       struct rmnet_port *port;
> +
> +       /* The rtnl path only checks CAP_NET_ADMIN against dev_net(dev),
> +        * but rmnet_unregister_bridge() below clears the bridge state of
> +        * the real device's port, which may live in a different netns.
> +        */
> +       if (!rtnl_dev_link_net_capable(rmnet_dev, dev_net(real_dev)))
> +               return -EPERM;
> +
> +       port = rmnet_get_port_rtnl(slave_dev);
>
>         rmnet_unregister_bridge(port);
>
>
>

[-- Attachment #1.2: Type: text/html, Size: 10176 bytes --]

[-- Attachment #2: 0001-net-qualcomm-rmnet-require-CAP_NET_ADMIN-in-the-real.patch --]
[-- Type: application/octet-stream, Size: 4259 bytes --]

From 7e15c2d86f7d8f1383e0cfb2699c2f2e7ca0b2fb Mon Sep 17 00:00:00 2001
From: Abdifatah Suruur <suruurism@gmail.com>
Date: Sat, 29 Aug 2026 20:01:27 +0300
Subject: [PATCH net v4] net: qualcomm: rmnet: require CAP_NET_ADMIN in the
 real device netns for config ops

An rmnet device may be created with its real device in a different
netns than the rmnet device itself (rmnet_newlink() resolves it in
link_net), and the rtnl config paths below only check CAP_NET_ADMIN
against dev_net(dev), while mutating rmnet port state attached to the
real device:

- rmnet_changelink() rewrites the endpoint mux table and
  port->data_format and, via rmnet_vnd_update_dev_mtu(), can shrink the
  MTU of the rmnet endpoint netdevs.
- rmnet_add_bridge() and rmnet_del_bridge(), reachable via
  ndo_add_slave/ndo_del_slave through RTM_SETLINK IFLA_MASTER, flip
  port->rmnet_mode and port->bridge_ep on the real device's port; with
  bridge_ep pointing at a caller-owned device, rmnet_rx_handler() then
  forwards real-device ingress frames to it.

A caller privileged only in the rmnet device's netns can therefore
rewrite the shared cellular data-path state owned by another netns, and
steer its ingress traffic.

Gate all three with rtnl_dev_link_net_capable(), matching the "require
CAP_NET_ADMIN in the device netns for changelink" series (vxlan/geneve,
CVE-2026-68432).

Fixes: 2abb5792387e ("net: qualcomm: rmnet: Allow configuration updates to existing devices")
Fixes: 60d58f971c1077 ("net: qualcomm: rmnet: Implement bridge mode")
Cc: stable@vger.kernel.org
Signed-off-by: Abdifatah Suruur <suruurism@gmail.com>
---
v4:
- use the netdev comment style, per Subash Abhinav Kasiviswanathan
v3:
- cover rmnet_add_bridge() and rmnet_del_bridge() with the same gate;
  they mutate the same real-device port state via ndo_add_slave/
  ndo_del_slave and have no capability check of their own
- correct the impact wording: rmnet_vnd_update_dev_mtu() only reads
  real_dev->mtu; the MTU store lands on the rmnet endpoint netdevs via
  rmnet_vnd_change_mtu(), not on the real device
v2:
- drop Reported-by: (implied for the author), per Jakub Kicinski
---
 .../ethernet/qualcomm/rmnet/rmnet_config.c    | 27 ++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
index 78d4df55740a1..73bd5419cb136 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
@@ -312,6 +312,13 @@ static int rmnet_changelink(struct net_device *dev, struct nlattr *tb[],
 	if (!rmnet_is_real_dev_registered(real_dev))
 		return -ENODEV;
 
+	/* The rtnl path only checks CAP_NET_ADMIN against dev_net(dev),
+	 * but the port state mutated below is attached to real_dev, which
+	 * may live in a different netns.
+	 */
+	if (!rtnl_dev_link_net_capable(dev, dev_net(real_dev)))
+		return -EPERM;
+
 	port = rmnet_get_port_rtnl(real_dev);
 
 	if (data[IFLA_RMNET_MUX_ID]) {
@@ -440,6 +447,13 @@ int rmnet_add_bridge(struct net_device *rmnet_dev,
 	struct rmnet_port *port, *slave_port;
 	int err;
 
+	/* The rtnl path only checks CAP_NET_ADMIN against dev_net(dev),
+	 * but the port state mutated below is attached to real_dev, which
+	 * may live in a different netns.
+	 */
+	if (!rtnl_dev_link_net_capable(rmnet_dev, dev_net(real_dev)))
+		return -EPERM;
+
 	port = rmnet_get_port_rtnl(real_dev);
 
 	/* If there is more than one rmnet dev attached, its probably being
@@ -488,7 +502,18 @@ int rmnet_add_bridge(struct net_device *rmnet_dev,
 int rmnet_del_bridge(struct net_device *rmnet_dev,
 		     struct net_device *slave_dev)
 {
-	struct rmnet_port *port = rmnet_get_port_rtnl(slave_dev);
+	struct rmnet_priv *priv = netdev_priv(rmnet_dev);
+	struct net_device *real_dev = priv->real_dev;
+	struct rmnet_port *port;
+
+	/* The rtnl path only checks CAP_NET_ADMIN against dev_net(dev),
+	 * but rmnet_unregister_bridge() below clears the bridge state of
+	 * the real device's port, which may live in a different netns.
+	 */
+	if (!rtnl_dev_link_net_capable(rmnet_dev, dev_net(real_dev)))
+		return -EPERM;
+
+	port = rmnet_get_port_rtnl(slave_dev);
 
 	rmnet_unregister_bridge(port);
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH net v3] net: qualcomm: rmnet: require CAP_NET_ADMIN in the real device netns for config ops
  2026-08-31 20:47   ` Suruur
@ 2026-09-01  6:27     ` subash.a.kasiviswanathan
  0 siblings, 0 replies; 4+ messages in thread
From: subash.a.kasiviswanathan @ 2026-09-01  6:27 UTC (permalink / raw)
  To: 'Suruur'; +Cc: netdev, linux-kernel, sean.tranchetti, horms

> From: Suruur <suruurism@gmail.com> 
> Sent: Monday, August 31, 2026 2:48 PM
> To: subash.a.kasiviswanathan@oss.qualcomm.com
> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; sean.tranchetti@oss.qualcomm.com; horms@kernel.org
> Subject: Re: [PATCH net v3] net: qualcomm: rmnet: require CAP_NET_ADMIN in the real device netns for config ops
> 
> Hi Subash,
> 
> Thanks for the review. Here is v4 with the comment blocks switched to
> the networking style per the netdev FAQ; no other changes.
> 
> Thanks,
> Abdifatah

Thanks, please send the updated patch in a new mail thread.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-01  6:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-29 17:06 [PATCH net v3] net: qualcomm: rmnet: require CAP_NET_ADMIN in the real device netns for config ops user.email
2026-08-31 20:22 ` subash.a.kasiviswanathan
2026-08-31 20:47   ` Suruur
2026-09-01  6:27     ` subash.a.kasiviswanathan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).