Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0389387e authored by Subash Abhinov Kasiviswanathan's avatar Subash Abhinov Kasiviswanathan Committed by Greg Kroah-Hartman
Browse files

net: qualcomm: rmnet: Allow configuration updates to existing devices



commit 2abb5792387eb188b12051337d5dcd2cba615cb0 upstream.

This allows the changelink operation to succeed if the mux_id was
specified as an argument. Note that the mux_id must match the
existing mux_id of the rmnet device or should be an unused mux_id.

Fixes: 1dc49e9d164c ("net: rmnet: do not allow to change mux id if mux id is duplicated")
Reported-and-tested-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarSean Tranchetti <stranche@codeaurora.org>
Signed-off-by: default avatarSubash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 69598616
Loading
Loading
Loading
Loading
+19 −12
Original line number Diff line number Diff line
@@ -288,7 +288,6 @@ static int rmnet_changelink(struct net_device *dev, struct nlattr *tb[],
{
	struct rmnet_priv *priv = netdev_priv(dev);
	struct net_device *real_dev;
	struct rmnet_endpoint *ep;
	struct rmnet_port *port;
	u16 mux_id;

@@ -303,20 +302,28 @@ 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;
		}

		if (mux_id != priv->mux_id) {
			struct rmnet_endpoint *ep;

			ep = rmnet_get_endpoint(port, priv->mux_id);
			if (!ep)
				return -ENODEV;

			if (rmnet_get_endpoint(port, mux_id)) {
				NL_SET_ERR_MSG_MOD(extack,
						   "MUX ID already exists");
				return -EINVAL;
			}

			hlist_del_init_rcu(&ep->hlnode);
		hlist_add_head_rcu(&ep->hlnode, &port->muxed_ep[mux_id]);
			hlist_add_head_rcu(&ep->hlnode,
					   &port->muxed_ep[mux_id]);

			ep->mux_id = mux_id;
			priv->mux_id = mux_id;
		}
	}

	if (data[IFLA_RMNET_FLAGS]) {
		struct ifla_rmnet_flags *flags;