netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.9 01/11] xfrm: Fix xfrm migrate issues when address family changes
@ 2022-03-09 16:27 Sasha Levin
  2022-03-09 16:27 ` [PATCH AUTOSEL 4.9 05/11] can: rcar_canfd: rcar_canfd_channel_probe(): register the CAN device when fully ready Sasha Levin
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Sasha Levin @ 2022-03-09 16:27 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Yan Yan, Steffen Klassert, Sasha Levin, davem, kuba, netdev

From: Yan Yan <evitayan@google.com>

[ Upstream commit e03c3bba351f99ad932e8f06baa9da1afc418e02 ]

xfrm_migrate cannot handle address family change of an xfrm_state.
The symptons are the xfrm_state will be migrated to a wrong address,
and sending as well as receiving packets wil be broken.

This commit fixes it by breaking the original xfrm_state_clone
method into two steps so as to update the props.family before
running xfrm_init_state. As the result, xfrm_state's inner mode,
outer mode, type and IP header length in xfrm_state_migrate can
be updated with the new address family.

Tested with additions to Android's kernel unit test suite:
https://android-review.googlesource.com/c/kernel/tests/+/1885354

Signed-off-by: Yan Yan <evitayan@google.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/xfrm/xfrm_state.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 4d19f2ff6e05..73b4e7c0d336 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -1238,9 +1238,6 @@ static struct xfrm_state *xfrm_state_clone(struct xfrm_state *orig)
 
 	memcpy(&x->mark, &orig->mark, sizeof(x->mark));
 
-	if (xfrm_init_state(x) < 0)
-		goto error;
-
 	x->props.flags = orig->props.flags;
 	x->props.extra_flags = orig->props.extra_flags;
 
@@ -1317,6 +1314,11 @@ struct xfrm_state *xfrm_state_migrate(struct xfrm_state *x,
 	if (!xc)
 		return NULL;
 
+	xc->props.family = m->new_family;
+
+	if (xfrm_init_state(xc) < 0)
+		goto error;
+
 	memcpy(&xc->id.daddr, &m->new_daddr, sizeof(xc->id.daddr));
 	memcpy(&xc->props.saddr, &m->new_saddr, sizeof(xc->props.saddr));
 
-- 
2.34.1


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

* [PATCH AUTOSEL 4.9 05/11] can: rcar_canfd: rcar_canfd_channel_probe(): register the CAN device when fully ready
  2022-03-09 16:27 [PATCH AUTOSEL 4.9 01/11] xfrm: Fix xfrm migrate issues when address family changes Sasha Levin
@ 2022-03-09 16:27 ` Sasha Levin
  2022-03-09 16:27 ` [PATCH AUTOSEL 4.9 06/11] atm: firestream: check the return value of ioremap() in fs_init() Sasha Levin
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2022-03-09 16:27 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Lad Prabhakar, Pavel Machek, Ulrich Hecht, Marc Kleine-Budde,
	Sasha Levin, wg, davem, kuba, stefan.maetje, mailhol.vincent,
	linux-can, netdev

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

[ Upstream commit c5048a7b2c23ab589f3476a783bd586b663eda5b ]

Register the CAN device only when all the necessary initialization is
completed. This patch makes sure all the data structures and locks are
initialized before registering the CAN device.

Link: https://lore.kernel.org/all/20220221225935.12300-1-prabhakar.mahadev-lad.rj@bp.renesas.com
Reported-by: Pavel Machek <pavel@denx.de>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Pavel Machek <pavel@denx.de>
Reviewed-by: Ulrich Hecht <uli+renesas@fpond.eu>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/can/rcar/rcar_canfd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index 43cdd5544b0c..a127c853a4e9 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -1601,15 +1601,15 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch,
 
 	netif_napi_add(ndev, &priv->napi, rcar_canfd_rx_poll,
 		       RCANFD_NAPI_WEIGHT);
+	spin_lock_init(&priv->tx_lock);
+	devm_can_led_init(ndev);
+	gpriv->ch[priv->channel] = priv;
 	err = register_candev(ndev);
 	if (err) {
 		dev_err(&pdev->dev,
 			"register_candev() failed, error %d\n", err);
 		goto fail_candev;
 	}
-	spin_lock_init(&priv->tx_lock);
-	devm_can_led_init(ndev);
-	gpriv->ch[priv->channel] = priv;
 	dev_info(&pdev->dev, "device registered (channel %u)\n", priv->channel);
 	return 0;
 
-- 
2.34.1


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

* [PATCH AUTOSEL 4.9 06/11] atm: firestream: check the return value of ioremap() in fs_init()
  2022-03-09 16:27 [PATCH AUTOSEL 4.9 01/11] xfrm: Fix xfrm migrate issues when address family changes Sasha Levin
  2022-03-09 16:27 ` [PATCH AUTOSEL 4.9 05/11] can: rcar_canfd: rcar_canfd_channel_probe(): register the CAN device when fully ready Sasha Levin
@ 2022-03-09 16:27 ` Sasha Levin
  2022-03-09 16:27 ` [PATCH AUTOSEL 4.9 07/11] nl80211: Update bss channel on channel switch for P2P_CLIENT Sasha Levin
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2022-03-09 16:27 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Jia-Ju Bai, TOTE Robot, David S . Miller, Sasha Levin, 3chas3,
	linux-atm-general, netdev

From: Jia-Ju Bai <baijiaju1990@gmail.com>

[ Upstream commit d4e26aaea7f82ba884dcb4acfe689406bc092dc3 ]

The function ioremap() in fs_init() can fail, so its return value should
be checked.

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/atm/firestream.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index 7cb2b863e653..7d74b7e1a837 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -1692,6 +1692,8 @@ static int fs_init(struct fs_dev *dev)
 	dev->hw_base = pci_resource_start(pci_dev, 0);
 
 	dev->base = ioremap(dev->hw_base, 0x1000);
+	if (!dev->base)
+		return 1;
 
 	reset_chip (dev);
   
-- 
2.34.1


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

* [PATCH AUTOSEL 4.9 07/11] nl80211: Update bss channel on channel switch for P2P_CLIENT
  2022-03-09 16:27 [PATCH AUTOSEL 4.9 01/11] xfrm: Fix xfrm migrate issues when address family changes Sasha Levin
  2022-03-09 16:27 ` [PATCH AUTOSEL 4.9 05/11] can: rcar_canfd: rcar_canfd_channel_probe(): register the CAN device when fully ready Sasha Levin
  2022-03-09 16:27 ` [PATCH AUTOSEL 4.9 06/11] atm: firestream: check the return value of ioremap() in fs_init() Sasha Levin
@ 2022-03-09 16:27 ` Sasha Levin
  2022-03-09 16:27 ` [PATCH AUTOSEL 4.9 08/11] tcp: make tcp_read_sock() more robust Sasha Levin
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2022-03-09 16:27 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Sreeramya Soratkal, Johannes Berg, Sasha Levin, johannes, davem,
	kuba, linux-wireless, netdev

From: Sreeramya Soratkal <quic_ssramya@quicinc.com>

[ Upstream commit e50b88c4f076242358b66ddb67482b96947438f2 ]

The wdev channel information is updated post channel switch only for
the station mode and not for the other modes. Due to this, the P2P client
still points to the old value though it moved to the new channel
when the channel change is induced from the P2P GO.

Update the bss channel after CSA channel switch completion for P2P client
interface as well.

Signed-off-by: Sreeramya Soratkal <quic_ssramya@quicinc.com>
Link: https://lore.kernel.org/r/1646114600-31479-1-git-send-email-quic_ssramya@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/wireless/nl80211.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index ab8bca39afa3..562e138deba2 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -14068,7 +14068,8 @@ void cfg80211_ch_switch_notify(struct net_device *dev,
 	wdev->chandef = *chandef;
 	wdev->preset_chandef = *chandef;
 
-	if (wdev->iftype == NL80211_IFTYPE_STATION &&
+	if ((wdev->iftype == NL80211_IFTYPE_STATION ||
+	     wdev->iftype == NL80211_IFTYPE_P2P_CLIENT) &&
 	    !WARN_ON(!wdev->current_bss))
 		wdev->current_bss->pub.channel = chandef->chan;
 
-- 
2.34.1


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

* [PATCH AUTOSEL 4.9 08/11] tcp: make tcp_read_sock() more robust
  2022-03-09 16:27 [PATCH AUTOSEL 4.9 01/11] xfrm: Fix xfrm migrate issues when address family changes Sasha Levin
                   ` (2 preceding siblings ...)
  2022-03-09 16:27 ` [PATCH AUTOSEL 4.9 07/11] nl80211: Update bss channel on channel switch for P2P_CLIENT Sasha Levin
@ 2022-03-09 16:27 ` Sasha Levin
  2022-03-09 16:27 ` [PATCH AUTOSEL 4.9 09/11] sfc: extend the locking on mcdi->seqno Sasha Levin
  2022-03-09 16:27 ` [PATCH AUTOSEL 4.9 10/11] bnx2: Fix an error message Sasha Levin
  5 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2022-03-09 16:27 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Eric Dumazet, John Fastabend, Jakub Sitnicki, Daniel Borkmann,
	Jakub Kicinski, Sasha Levin, davem, yoshfuji, dsahern, netdev

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit e3d5ea2c011ecb16fb94c56a659364e6b30fac94 ]

If recv_actor() returns an incorrect value, tcp_read_sock()
might loop forever.

Instead, issue a one time warning and make sure to make progress.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Jakub Sitnicki <jakub@cloudflare.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/r/20220302161723.3910001-2-eric.dumazet@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/ipv4/tcp.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index aeda018e4c49..6dfb964e1ad8 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1561,11 +1561,13 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
 				if (!copied)
 					copied = used;
 				break;
-			} else if (used <= len) {
-				seq += used;
-				copied += used;
-				offset += used;
 			}
+			if (WARN_ON_ONCE(used > len))
+				used = len;
+			seq += used;
+			copied += used;
+			offset += used;
+
 			/* If recv_actor drops the lock (e.g. TCP splice
 			 * receive) the skb pointer might be invalid when
 			 * getting here: tcp_collapse might have deleted it
-- 
2.34.1


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

* [PATCH AUTOSEL 4.9 09/11] sfc: extend the locking on mcdi->seqno
  2022-03-09 16:27 [PATCH AUTOSEL 4.9 01/11] xfrm: Fix xfrm migrate issues when address family changes Sasha Levin
                   ` (3 preceding siblings ...)
  2022-03-09 16:27 ` [PATCH AUTOSEL 4.9 08/11] tcp: make tcp_read_sock() more robust Sasha Levin
@ 2022-03-09 16:27 ` Sasha Levin
  2022-03-09 16:27 ` [PATCH AUTOSEL 4.9 10/11] bnx2: Fix an error message Sasha Levin
  5 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2022-03-09 16:27 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Niels Dossche, Martin Habets, David S . Miller, Sasha Levin,
	ecree.xilinx, kuba, netdev

From: Niels Dossche <dossche.niels@gmail.com>

[ Upstream commit f1fb205efb0ccca55626fd4ef38570dd16b44719 ]

seqno could be read as a stale value outside of the lock. The lock is
already acquired to protect the modification of seqno against a possible
race condition. Place the reading of this value also inside this locking
to protect it against a possible race condition.

Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
Acked-by: Martin Habets <habetsm.xilinx@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/sfc/mcdi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c
index 241520943ada..221798499e24 100644
--- a/drivers/net/ethernet/sfc/mcdi.c
+++ b/drivers/net/ethernet/sfc/mcdi.c
@@ -162,9 +162,9 @@ static void efx_mcdi_send_request(struct efx_nic *efx, unsigned cmd,
 	/* Serialise with efx_mcdi_ev_cpl() and efx_mcdi_ev_death() */
 	spin_lock_bh(&mcdi->iface_lock);
 	++mcdi->seqno;
+	seqno = mcdi->seqno & SEQ_MASK;
 	spin_unlock_bh(&mcdi->iface_lock);
 
-	seqno = mcdi->seqno & SEQ_MASK;
 	xflags = 0;
 	if (mcdi->mode == MCDI_MODE_EVENTS)
 		xflags |= MCDI_HEADER_XFLAGS_EVREQ;
-- 
2.34.1


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

* [PATCH AUTOSEL 4.9 10/11] bnx2: Fix an error message
  2022-03-09 16:27 [PATCH AUTOSEL 4.9 01/11] xfrm: Fix xfrm migrate issues when address family changes Sasha Levin
                   ` (4 preceding siblings ...)
  2022-03-09 16:27 ` [PATCH AUTOSEL 4.9 09/11] sfc: extend the locking on mcdi->seqno Sasha Levin
@ 2022-03-09 16:27 ` Sasha Levin
  5 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2022-03-09 16:27 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Christophe JAILLET, David S . Miller, Sasha Levin, rmody,
	GR-Linux-NIC-Dev, kuba, netdev

From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

[ Upstream commit 8ccffe9ac3239e549beaa0a9d5e1a1eac94e866c ]

Fix an error message and report the correct failing function.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/broadcom/bnx2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
index e15e487c14dd..94f8c2824649 100644
--- a/drivers/net/ethernet/broadcom/bnx2.c
+++ b/drivers/net/ethernet/broadcom/bnx2.c
@@ -8238,7 +8238,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
 		rc = pci_set_consistent_dma_mask(pdev, persist_dma_mask);
 		if (rc) {
 			dev_err(&pdev->dev,
-				"pci_set_consistent_dma_mask failed, aborting\n");
+				"dma_set_coherent_mask failed, aborting\n");
 			goto err_out_unmap;
 		}
 	} else if ((rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) != 0) {
-- 
2.34.1


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

end of thread, other threads:[~2022-03-09 16:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-09 16:27 [PATCH AUTOSEL 4.9 01/11] xfrm: Fix xfrm migrate issues when address family changes Sasha Levin
2022-03-09 16:27 ` [PATCH AUTOSEL 4.9 05/11] can: rcar_canfd: rcar_canfd_channel_probe(): register the CAN device when fully ready Sasha Levin
2022-03-09 16:27 ` [PATCH AUTOSEL 4.9 06/11] atm: firestream: check the return value of ioremap() in fs_init() Sasha Levin
2022-03-09 16:27 ` [PATCH AUTOSEL 4.9 07/11] nl80211: Update bss channel on channel switch for P2P_CLIENT Sasha Levin
2022-03-09 16:27 ` [PATCH AUTOSEL 4.9 08/11] tcp: make tcp_read_sock() more robust Sasha Levin
2022-03-09 16:27 ` [PATCH AUTOSEL 4.9 09/11] sfc: extend the locking on mcdi->seqno Sasha Levin
2022-03-09 16:27 ` [PATCH AUTOSEL 4.9 10/11] bnx2: Fix an error message Sasha Levin

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).