Skip to contentSkip to conversation

net: rmnet: do not allow to change mux id if mux id is duplicated

PATCH Superseded Taehee Yoo 1 participant 1 message Feb 26, 2020

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Taehee Yoo

author
#0 lore raw

PATCH 7/10 net: rmnet: do not allow to change mux id if mux id is duplicated

Basically, duplicate mux id isn't be allowed.
So, the creation of rmnet will be failed if there is duplicate mux id is existing.
But, changelink routine doesn't check duplicate mux id.

Test commands:
ip link add dummy0 type dummy
ip link add rmnet0 link dummy0 type rmnet mux_id 1 ip link add rmnet1 link dummy0 type rmnet mux_id 2 ip link set rmnet1 type rmnet mux_id 1

Fixes 23790ef12082 ("net: qualcomm: rmnet: Allow to configure flags for existing devices")
---
 drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c +4 -0
index 93745cd45c29..bdb88472a0a0 100644
@@ -309,6 +309,10 @@ static int rmnet_changelink(struct net_device *dev, struct nlattr *tb[],
 
 	if (data[IFLA_RMNET_MUX_ID]) {
 		mux_id = nla_get_u16(data[IFLA_RMNET_MUX_ID]);
+		if (rmnet_get_endpoint(port, mux_id)) {
+			NL_SET_ERR_MSG_MOD(extack, "MUX ID already exists");
+			return -EINVAL;
+		}
 		ep = rmnet_get_endpoint(port, priv->mux_id);
 		if (!ep)
 			return -ENODEV;
Signature · 1 line
2.17.1