linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>,
	Alex Elder <elder@linaro.org>,
	Sean Tranchetti <stranche@codeaurora.org>,
	"David S . Miller" <davem@davemloft.net>,
	Sasha Levin <sashal@kernel.org>,
	netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 4.19 18/40] net: qualcomm: rmnet: Allow configuration updates to existing devices
Date: Wed, 15 Apr 2020 07:46:01 -0400	[thread overview]
Message-ID: <20200415114623.14972-18-sashal@kernel.org> (raw)
In-Reply-To: <20200415114623.14972-1-sashal@kernel.org>

From: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>

[ Upstream commit 2abb5792387eb188b12051337d5dcd2cba615cb0 ]

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: Alex Elder <elder@linaro.org>
Signed-off-by: Sean Tranchetti <stranche@codeaurora.org>
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 .../ethernet/qualcomm/rmnet/rmnet_config.c    | 31 ++++++++++++-------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
index 37786affa9750..7389648d0feaf 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
@@ -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,19 +302,27 @@ 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;
 
-		hlist_del_init_rcu(&ep->hlnode);
-		hlist_add_head_rcu(&ep->hlnode, &port->muxed_ep[mux_id]);
+		if (mux_id != priv->mux_id) {
+			struct rmnet_endpoint *ep;
+
+			ep = rmnet_get_endpoint(port, priv->mux_id);
+			if (!ep)
+				return -ENODEV;
 
-		ep->mux_id = mux_id;
-		priv->mux_id = mux_id;
+			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]);
+
+			ep->mux_id = mux_id;
+			priv->mux_id = mux_id;
+		}
 	}
 
 	if (data[IFLA_RMNET_FLAGS]) {
-- 
2.20.1


  parent reply	other threads:[~2020-04-15 11:58 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-15 11:45 [PATCH AUTOSEL 4.19 01/40] clk: at91: usb: continue if clk_hw_round_rate() return zero Sasha Levin
2020-04-15 11:45 ` [PATCH AUTOSEL 4.19 02/40] power: supply: bq27xxx_battery: Silence deferred-probe error Sasha Levin
2020-04-15 11:45 ` [PATCH AUTOSEL 4.19 03/40] clk: tegra: Fix Tegra PMC clock out parents Sasha Levin
2020-04-15 11:45 ` [PATCH AUTOSEL 4.19 04/40] soc: imx: gpc: fix power up sequencing Sasha Levin
2020-04-15 11:45 ` [PATCH AUTOSEL 4.19 05/40] rtc: 88pm860x: fix possible race condition Sasha Levin
2020-04-15 11:45 ` [PATCH AUTOSEL 4.19 06/40] NFSv4/pnfs: Return valid stateids in nfs_layout_find_inode_by_stateid() Sasha Levin
2020-04-15 11:45 ` [PATCH AUTOSEL 4.19 07/40] NFS: direct.c: Fix memory leak of dreq when nfs_get_lock_context fails Sasha Levin
2020-04-15 11:45 ` [PATCH AUTOSEL 4.19 08/40] s390/cpuinfo: fix wrong output when CPU0 is offline Sasha Levin
2020-04-15 11:45 ` [PATCH AUTOSEL 4.19 09/40] btrfs: handle NULL roots in btrfs_put/btrfs_grab_fs_root Sasha Levin
2020-04-15 11:45 ` [PATCH AUTOSEL 4.19 10/40] powerpc/maple: Fix declaration made after definition Sasha Levin
2020-04-15 11:45 ` [PATCH AUTOSEL 4.19 11/40] s390/cpum_sf: Fix wrong page count in error message Sasha Levin
2020-04-15 11:45 ` [PATCH AUTOSEL 4.19 12/40] ext4: do not commit super on read-only bdev Sasha Levin
2020-04-15 11:45 ` [PATCH AUTOSEL 4.19 13/40] ext4: fix incorrect group count in ext4_fill_super error message Sasha Levin
2020-04-15 11:45 ` [PATCH AUTOSEL 4.19 14/40] ext4: fix incorrect inodes per group in " Sasha Levin
2020-04-15 11:45 ` [PATCH AUTOSEL 4.19 15/40] um: ubd: Prevent buffer overrun on command completion Sasha Levin
2020-04-15 11:45 ` [PATCH AUTOSEL 4.19 16/40] cifs: Allocate encryption header through kmalloc Sasha Levin
2020-04-15 11:46 ` [PATCH AUTOSEL 4.19 17/40] slcan: Don't transmit uninitialized stack data in padding Sasha Levin
2020-04-15 11:46 ` Sasha Levin [this message]
2020-04-15 11:46 ` [PATCH AUTOSEL 4.19 19/40] net: stmmac: dwmac1000: fix out-of-bounds mac address reg setting Sasha Levin
2020-04-15 11:46 ` [PATCH AUTOSEL 4.19 20/40] net: dsa: bcm_sf2: Do not register slave MDIO bus with OF Sasha Levin
2020-04-15 11:46 ` [PATCH AUTOSEL 4.19 21/40] include/linux/swapops.h: correct guards for non_swap_entry() Sasha Levin
2020-04-15 11:46 ` [PATCH AUTOSEL 4.19 22/40] percpu_counter: fix a data race at vm_committed_as Sasha Levin
2020-04-15 11:46 ` [PATCH AUTOSEL 4.19 23/40] compiler.h: fix error in BUILD_BUG_ON() reporting Sasha Levin
2020-04-15 11:46 ` [PATCH AUTOSEL 4.19 24/40] KVM: s390: vsie: Fix possible race when shadowing region 3 tables Sasha Levin
2020-04-15 11:46 ` [PATCH AUTOSEL 4.19 25/40] net: dsa: bcm_sf2: Ensure correct sub-node is parsed Sasha Levin
2020-04-15 11:46 ` [PATCH AUTOSEL 4.19 26/40] x86: ACPI: fix CPU hotplug deadlock Sasha Levin
2020-04-15 11:46 ` [PATCH AUTOSEL 4.19 27/40] net: phy: micrel: kszphy_resume(): add delay after genphy_resume() before accessing PHY registers Sasha Levin
2020-04-15 11:46 ` [PATCH AUTOSEL 4.19 28/40] drm/amdkfd: kfree the wrong pointer Sasha Levin
2020-04-15 11:46 ` [PATCH AUTOSEL 4.19 29/40] NFS: Fix memory leaks in nfs_pageio_stop_mirroring() Sasha Levin
2020-04-15 11:46 ` [PATCH AUTOSEL 4.19 30/40] f2fs: fix NULL pointer dereference in f2fs_write_begin() Sasha Levin
2020-04-15 11:46 ` [PATCH AUTOSEL 4.19 31/40] mfd: dln2: Fix sanity checking for endpoints Sasha Levin
2020-04-15 11:46 ` [PATCH AUTOSEL 4.19 32/40] drm/vc4: Fix HDMI mode validation Sasha Levin
2020-04-15 11:46 ` [PATCH AUTOSEL 4.19 33/40] iommu/vt-d: Fix mm reference leak Sasha Levin
2020-04-15 11:46 ` [PATCH AUTOSEL 4.19 34/40] ext2: fix empty body warnings when -Wextra is used Sasha Levin
2020-04-15 11:46 ` [PATCH AUTOSEL 4.19 35/40] ovl: fix value of i_ino for lower hardlink corner case Sasha Levin
2020-04-15 11:46 ` [PATCH AUTOSEL 4.19 36/40] ext2: fix debug reference to ext2_xattr_cache Sasha Levin
2020-04-15 11:46 ` [PATCH AUTOSEL 4.19 37/40] power: supply: axp288_fuel_gauge: Broaden vendor check for Intel Compute Sticks Sasha Levin
2020-04-15 11:46 ` [PATCH AUTOSEL 4.19 38/40] libnvdimm: Out of bounds read in __nd_ioctl() Sasha Levin
2020-04-15 11:46 ` [PATCH AUTOSEL 4.19 39/40] iommu/amd: Fix the configuration of GCR3 table root pointer Sasha Levin
2020-04-15 11:46 ` [PATCH AUTOSEL 4.19 40/40] f2fs: fix to wait all node page writeback Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200415114623.14972-18-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=davem@davemloft.net \
    --cc=elder@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=stranche@codeaurora.org \
    --cc=subashab@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).