All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH AUTOSEL for 4.4 02/17] net: systemport: Pad packet before inserting TSB
  2017-11-22 22:24 [PATCH AUTOSEL for 4.4 01/17] net: systemport: Utilize skb_put_padto() alexander.levin
@ 2017-11-22 22:24 ` alexander.levin
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 06/17] ravb: Remove Rx overflow log messages alexander.levin
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: alexander.levin @ 2017-11-22 22:24 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Florian Fainelli, David S . Miller, alexander.levin

From: Florian Fainelli <f.fainelli@gmail.com>

[ Upstream commit 38e5a85562a6cd911fc26d951d576551a688574c ]

Inserting the TSB means adding an extra 8 bytes in front the of packet
that is going to be used as metadata information by the TDMA engine, but
stripped off, so it does not really help with the packet padding.

For some odd packet sizes that fall below the 60 bytes payload (e.g: ARP)
we can end-up padding them after the TSB insertion, thus making them 64
bytes, but with the TDMA stripping off the first 8 bytes, they could
still be smaller than 64 bytes which is required to ingress the switch.

Fix this by swapping the padding and TSB insertion, guaranteeing that
the packets have the right sizes.

Fixes: 80105befdb4b ("net: systemport: add Broadcom SYSTEMPORT Ethernet MAC driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 drivers/net/ethernet/broadcom/bcmsysport.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index fae1a1ff53ab..027705117086 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -1045,15 +1045,6 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb,
 		goto out;
 	}
 
-	/* Insert TSB and checksum infos */
-	if (priv->tsb_en) {
-		skb = bcm_sysport_insert_tsb(skb, dev);
-		if (!skb) {
-			ret = NETDEV_TX_OK;
-			goto out;
-		}
-	}
-
 	/* The Ethernet switch we are interfaced with needs packets to be at
 	 * least 64 bytes (including FCS) otherwise they will be discarded when
 	 * they enter the switch port logic. When Broadcom tags are enabled, we
@@ -1066,6 +1057,15 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb,
 		goto out;
 	}
 
+	/* Insert TSB and checksum infos */
+	if (priv->tsb_en) {
+		skb = bcm_sysport_insert_tsb(skb, dev);
+		if (!skb) {
+			ret = NETDEV_TX_OK;
+			goto out;
+		}
+	}
+
 	skb_len = skb->len;
 
 	mapping = dma_map_single(kdev, skb->data, skb_len, DMA_TO_DEVICE);
-- 
2.11.0

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

* [PATCH AUTOSEL for 4.4 01/17] net: systemport: Utilize skb_put_padto()
@ 2017-11-22 22:24 alexander.levin
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 02/17] net: systemport: Pad packet before inserting TSB alexander.levin
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: alexander.levin @ 2017-11-22 22:24 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Florian Fainelli, David S . Miller, alexander.levin

From: Florian Fainelli <f.fainelli@gmail.com>

[ Upstream commit bb7da333d0a9f3bddc08f84187b7579a3f68fd24 ]

Since we need to pad our packets, utilize skb_put_padto() which
increases skb->len by how much we need to pad, allowing us to eliminate
the test on skb->len right below.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 drivers/net/ethernet/broadcom/bcmsysport.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 8860e74aa28f..fae1a1ff53ab 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -1061,13 +1061,12 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb,
 	 * (including FCS and tag) because the length verification is done after
 	 * the Broadcom tag is stripped off the ingress packet.
 	 */
-	if (skb_padto(skb, ETH_ZLEN + ENET_BRCM_TAG_LEN)) {
+	if (skb_put_padto(skb, ETH_ZLEN + ENET_BRCM_TAG_LEN)) {
 		ret = NETDEV_TX_OK;
 		goto out;
 	}
 
-	skb_len = skb->len < ETH_ZLEN + ENET_BRCM_TAG_LEN ?
-			ETH_ZLEN + ENET_BRCM_TAG_LEN : skb->len;
+	skb_len = skb->len;
 
 	mapping = dma_map_single(kdev, skb->data, skb_len, DMA_TO_DEVICE);
 	if (dma_mapping_error(kdev, mapping)) {
-- 
2.11.0

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

* [PATCH AUTOSEL for 4.4 03/17] ARM: OMAP1: DMA: Correct the number of logical channels
  2017-11-22 22:24 [PATCH AUTOSEL for 4.4 01/17] net: systemport: Utilize skb_put_padto() alexander.levin
                   ` (4 preceding siblings ...)
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 05/17] net/appletalk: Fix kernel memory disclosure alexander.levin
@ 2017-11-22 22:24 ` alexander.levin
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 11/17] net: sctp: fix array overrun read on sctp_timer_tbl alexander.levin
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: alexander.levin @ 2017-11-22 22:24 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Peter Ujfalusi, Tony Lindgren, alexander.levin

From: Peter Ujfalusi <peter.ujfalusi@ti.com>

[ Upstream commit 657279778af54f35e54b07b6687918f254a2992c ]

OMAP1510, OMAP5910 and OMAP310 have only 9 logical channels.
OMAP1610, OMAP5912, OMAP1710, OMAP730, and OMAP850 have 16 logical channels
available.

The wired 17 for the lch_count must have been used to cover the 16 + 1
dedicated LCD channel, in reality we can only use 9 or 16 channels.

The d->chan_count is not used by the omap-dma stack, so we can skip the
setup. chan_count was configured to the number of logical channels and not
the actual number of physical channels anyways.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 arch/arm/mach-omap1/dma.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-omap1/dma.c b/arch/arm/mach-omap1/dma.c
index 7b02ed218a42..0c120b2ea2f9 100644
--- a/arch/arm/mach-omap1/dma.c
+++ b/arch/arm/mach-omap1/dma.c
@@ -31,7 +31,6 @@
 #include "soc.h"
 
 #define OMAP1_DMA_BASE			(0xfffed800)
-#define OMAP1_LOGICAL_DMA_CH_COUNT	17
 
 static u32 enable_1510_mode;
 
@@ -311,8 +310,6 @@ static int __init omap1_system_dma_init(void)
 		goto exit_iounmap;
 	}
 
-	d->lch_count		= OMAP1_LOGICAL_DMA_CH_COUNT;
-
 	/* Valid attributes for omap1 plus processors */
 	if (cpu_is_omap15xx())
 		d->dev_caps = ENABLE_1510_MODE;
@@ -329,13 +326,14 @@ static int __init omap1_system_dma_init(void)
 	d->dev_caps		|= CLEAR_CSR_ON_READ;
 	d->dev_caps		|= IS_WORD_16;
 
-	if (cpu_is_omap15xx())
-		d->chan_count = 9;
-	else if (cpu_is_omap16xx() || cpu_is_omap7xx()) {
-		if (!(d->dev_caps & ENABLE_1510_MODE))
-			d->chan_count = 16;
+	/* available logical channels */
+	if (cpu_is_omap15xx()) {
+		d->lch_count = 9;
+	} else {
+		if (d->dev_caps & ENABLE_1510_MODE)
+			d->lch_count = 9;
 		else
-			d->chan_count = 9;
+			d->lch_count = 16;
 	}
 
 	p = dma_plat_info;
-- 
2.11.0

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

* [PATCH AUTOSEL for 4.4 04/17] vti6: fix device register to report IFLA_INFO_KIND
  2017-11-22 22:24 [PATCH AUTOSEL for 4.4 01/17] net: systemport: Utilize skb_put_padto() alexander.levin
                   ` (2 preceding siblings ...)
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 07/17] nfs: Don't take a reference on fl->fl_file for LOCK operation alexander.levin
@ 2017-11-22 22:24 ` alexander.levin
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 05/17] net/appletalk: Fix kernel memory disclosure alexander.levin
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: alexander.levin @ 2017-11-22 22:24 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: David Forster, David S . Miller, alexander.levin

From: David Forster <dforster@brocade.com>

[ Upstream commit 93e246f783e6bd1bc64fdfbfe68b18161f69b28e ]

vti6 interface is registered before the rtnl_link_ops block
is attached. As a result the resulting RTM_NEWLINK is missing
IFLA_INFO_KIND. Re-order attachment of rtnl_link_ops block to fix.

Signed-off-by: Dave Forster <dforster@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 net/ipv6/ip6_vti.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index 7ebb14def2cb..f58ad70f693e 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -189,12 +189,12 @@ static int vti6_tnl_create2(struct net_device *dev)
 	struct vti6_net *ip6n = net_generic(net, vti6_net_id);
 	int err;
 
+	dev->rtnl_link_ops = &vti6_link_ops;
 	err = register_netdevice(dev);
 	if (err < 0)
 		goto out;
 
 	strcpy(t->parms.name, dev->name);
-	dev->rtnl_link_ops = &vti6_link_ops;
 
 	dev_hold(dev);
 	vti6_tnl_link(ip6n, t);
-- 
2.11.0

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

* [PATCH AUTOSEL for 4.4 05/17] net/appletalk: Fix kernel memory disclosure
  2017-11-22 22:24 [PATCH AUTOSEL for 4.4 01/17] net: systemport: Utilize skb_put_padto() alexander.levin
                   ` (3 preceding siblings ...)
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 04/17] vti6: fix device register to report IFLA_INFO_KIND alexander.levin
@ 2017-11-22 22:24 ` alexander.levin
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 03/17] ARM: OMAP1: DMA: Correct the number of logical channels alexander.levin
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: alexander.levin @ 2017-11-22 22:24 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Vlad Tsyrklevich, David S . Miller, alexander.levin

From: Vlad Tsyrklevich <vlad@tsyrklevich.net>

[ Upstream commit ce7e40c432ba84da104438f6799d460a4cad41bc ]

ipddp_route structs contain alignment padding so kernel heap memory
is leaked when they are copied to user space in
ipddp_ioctl(SIOCFINDIPDDPRT). Change kmalloc() to kzalloc() to clear
that memory.

Signed-off-by: Vlad Tsyrklevich <vlad@tsyrklevich.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 drivers/net/appletalk/ipddp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/appletalk/ipddp.c b/drivers/net/appletalk/ipddp.c
index e90c6a7333d7..2e4649655181 100644
--- a/drivers/net/appletalk/ipddp.c
+++ b/drivers/net/appletalk/ipddp.c
@@ -191,7 +191,7 @@ static netdev_tx_t ipddp_xmit(struct sk_buff *skb, struct net_device *dev)
  */
 static int ipddp_create(struct ipddp_route *new_rt)
 {
-        struct ipddp_route *rt = kmalloc(sizeof(*rt), GFP_KERNEL);
+        struct ipddp_route *rt = kzalloc(sizeof(*rt), GFP_KERNEL);
 
         if (rt == NULL)
                 return -ENOMEM;
-- 
2.11.0

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

* [PATCH AUTOSEL for 4.4 06/17] ravb: Remove Rx overflow log messages
  2017-11-22 22:24 [PATCH AUTOSEL for 4.4 01/17] net: systemport: Utilize skb_put_padto() alexander.levin
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 02/17] net: systemport: Pad packet before inserting TSB alexander.levin
@ 2017-11-22 22:24 ` alexander.levin
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 07/17] nfs: Don't take a reference on fl->fl_file for LOCK operation alexander.levin
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: alexander.levin @ 2017-11-22 22:24 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Kazuya Mizuguchi, Simon Horman, David S . Miller, alexander.levin

From: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>

[ Upstream commit 18a3ed59d09cf81a6447aadf6931bf0c9ffec5e0 ]

Remove Rx overflow log messages as in an environment where logging results
in network traffic logging may cause further overflows.

Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper")
Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
[simon: reworked changelog]
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Acked-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 drivers/net/ethernet/renesas/ravb_main.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 585e90f8341d..f735dfcb64ae 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -831,14 +831,10 @@ static int ravb_poll(struct napi_struct *napi, int budget)
 	/* Receive error message handling */
 	priv->rx_over_errors =  priv->stats[RAVB_BE].rx_over_errors;
 	priv->rx_over_errors += priv->stats[RAVB_NC].rx_over_errors;
-	if (priv->rx_over_errors != ndev->stats.rx_over_errors) {
+	if (priv->rx_over_errors != ndev->stats.rx_over_errors)
 		ndev->stats.rx_over_errors = priv->rx_over_errors;
-		netif_err(priv, rx_err, ndev, "Receive Descriptor Empty\n");
-	}
-	if (priv->rx_fifo_errors != ndev->stats.rx_fifo_errors) {
+	if (priv->rx_fifo_errors != ndev->stats.rx_fifo_errors)
 		ndev->stats.rx_fifo_errors = priv->rx_fifo_errors;
-		netif_err(priv, rx_err, ndev, "Receive FIFO Overflow\n");
-	}
 out:
 	return budget - quota;
 }
-- 
2.11.0

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

* [PATCH AUTOSEL for 4.4 07/17] nfs: Don't take a reference on fl->fl_file for LOCK operation
  2017-11-22 22:24 [PATCH AUTOSEL for 4.4 01/17] net: systemport: Utilize skb_put_padto() alexander.levin
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 02/17] net: systemport: Pad packet before inserting TSB alexander.levin
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 06/17] ravb: Remove Rx overflow log messages alexander.levin
@ 2017-11-22 22:24 ` alexander.levin
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 04/17] vti6: fix device register to report IFLA_INFO_KIND alexander.levin
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: alexander.levin @ 2017-11-22 22:24 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Benjamin Coddington, Trond Myklebust, alexander.levin

From: Benjamin Coddington <bcodding@redhat.com>

[ Upstream commit 4b09ec4b14a168bf2c687e1f598140c3c11e9222 ]

I have reports of a crash that look like __fput() was called twice for
a NFSv4.0 file.  It seems possible that the state manager could try to
reclaim a lock and take a reference on the fl->fl_file at the same time the
file is being released if, during the close(), a signal interrupts the wait
for outstanding IO while removing locks which then skips the removal
of that lock.

Since 83bfff23e9ed ("nfs4: have do_vfs_lock take an inode pointer") has
removed the need to traverse fl->fl_file->f_inode in nfs4_lock_done(),
taking that reference is no longer necessary.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 fs/nfs/nfs4proc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 8e425f2c5ddd..d3632d0f56a0 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -38,7 +38,6 @@
 #include <linux/mm.h>
 #include <linux/delay.h>
 #include <linux/errno.h>
-#include <linux/file.h>
 #include <linux/string.h>
 #include <linux/ratelimit.h>
 #include <linux/printk.h>
@@ -5741,7 +5740,6 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl,
 	p->server = server;
 	atomic_inc(&lsp->ls_count);
 	p->ctx = get_nfs_open_context(ctx);
-	get_file(fl->fl_file);
 	memcpy(&p->fl, fl, sizeof(p->fl));
 	return p;
 out_free_seqid:
@@ -5854,7 +5852,6 @@ static void nfs4_lock_release(void *calldata)
 		nfs_free_seqid(data->arg.lock_seqid);
 	nfs4_put_lock_state(data->lsp);
 	put_nfs_open_context(data->ctx);
-	fput(data->fl.fl_file);
 	kfree(data);
 	dprintk("%s: done!\n", __func__);
 }
-- 
2.11.0

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

* [PATCH AUTOSEL for 4.4 11/17] net: sctp: fix array overrun read on sctp_timer_tbl
  2017-11-22 22:24 [PATCH AUTOSEL for 4.4 01/17] net: systemport: Utilize skb_put_padto() alexander.levin
                   ` (5 preceding siblings ...)
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 03/17] ARM: OMAP1: DMA: Correct the number of logical channels alexander.levin
@ 2017-11-22 22:24 ` alexander.levin
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 10/17] drm/exynos/decon5433: set STANDALONE_UPDATE_F on output enablement alexander.levin
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: alexander.levin @ 2017-11-22 22:24 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Colin Ian King, David S . Miller, alexander.levin

From: Colin Ian King <colin.king@canonical.com>

[ Upstream commit 0e73fc9a56f22f2eec4d2b2910c649f7af67b74d ]

The comparison on the timeout can lead to an array overrun
read on sctp_timer_tbl because of an off-by-one error. Fix
this by using < instead of <= and also compare to the array
size rather than SCTP_EVENT_TIMEOUT_MAX.

Fixes CoverityScan CID#1397639 ("Out-of-bounds read")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 net/sctp/debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sctp/debug.c b/net/sctp/debug.c
index 95d7b15dad21..e371a0d90068 100644
--- a/net/sctp/debug.c
+++ b/net/sctp/debug.c
@@ -166,7 +166,7 @@ static const char *const sctp_timer_tbl[] = {
 /* Lookup timer debug name. */
 const char *sctp_tname(const sctp_subtype_t id)
 {
-	if (id.timeout <= SCTP_EVENT_TIMEOUT_MAX)
+	if (id.timeout < ARRAY_SIZE(sctp_timer_tbl))
 		return sctp_timer_tbl[id.timeout];
 	return "unknown_timer";
 }
-- 
2.11.0

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

* [PATCH AUTOSEL for 4.4 10/17] drm/exynos/decon5433: set STANDALONE_UPDATE_F on output enablement
  2017-11-22 22:24 [PATCH AUTOSEL for 4.4 01/17] net: systemport: Utilize skb_put_padto() alexander.levin
                   ` (6 preceding siblings ...)
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 11/17] net: sctp: fix array overrun read on sctp_timer_tbl alexander.levin
@ 2017-11-22 22:24 ` alexander.levin
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 09/17] NFSv4: Fix client recovery when server reboots multiple times alexander.levin
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: alexander.levin @ 2017-11-22 22:24 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Andrzej Hajda, Inki Dae, alexander.levin

From: Andrzej Hajda <a.hajda@samsung.com>

[ Upstream commit 11d8bcef7a0399e1d2519f207fd575fc404306b4 ]

DECON_TV requires STANDALONE_UPDATE after output enabling, otherwise it does
not start. This change is neutral for DECON.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
index fbe1b3174f75..34cebcdc2fc4 100644
--- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
@@ -180,6 +180,8 @@ static void decon_commit(struct exynos_drm_crtc *crtc)
 
 	/* enable output and display signal */
 	decon_set_bits(ctx, DECON_VIDCON0, VIDCON0_ENVID | VIDCON0_ENVID_F, ~0);
+
+	decon_set_bits(ctx, DECON_UPDATE, STANDALONE_UPDATE_F, ~0);
 }
 
 static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win,
-- 
2.11.0

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

* [PATCH AUTOSEL for 4.4 09/17] NFSv4: Fix client recovery when server reboots multiple times
  2017-11-22 22:24 [PATCH AUTOSEL for 4.4 01/17] net: systemport: Utilize skb_put_padto() alexander.levin
                   ` (7 preceding siblings ...)
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 10/17] drm/exynos/decon5433: set STANDALONE_UPDATE_F on output enablement alexander.levin
@ 2017-11-22 22:24 ` alexander.levin
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 08/17] KVM: arm/arm64: Fix occasional warning from the timer work function alexander.levin
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: alexander.levin @ 2017-11-22 22:24 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Trond Myklebust, alexander.levin

From: Trond Myklebust <trond.myklebust@primarydata.com>

[ Upstream commit c6180a6237174f481dc856ed6e890d8196b6f0fb ]

If the server reboots multiple times, the client should rely on the
server to tell it that it cannot reclaim state as per section 9.6.3.4
in RFC7530 and section 8.4.2.1 in RFC5661.
Currently, the client is being to conservative, and is assuming that
if the server reboots while state recovery is in progress, then it must
ignore state that was not recovered before the reboot.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 fs/nfs/nfs4state.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index e8d1d6c5000c..9a0b219ff74d 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1680,7 +1680,6 @@ static int nfs4_recovery_handle_error(struct nfs_client *clp, int error)
 			break;
 		case -NFS4ERR_STALE_CLIENTID:
 			set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
-			nfs4_state_clear_reclaim_reboot(clp);
 			nfs4_state_start_reclaim_reboot(clp);
 			break;
 		case -NFS4ERR_EXPIRED:
-- 
2.11.0

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

* [PATCH AUTOSEL for 4.4 08/17] KVM: arm/arm64: Fix occasional warning from the timer work function
  2017-11-22 22:24 [PATCH AUTOSEL for 4.4 01/17] net: systemport: Utilize skb_put_padto() alexander.levin
                   ` (8 preceding siblings ...)
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 09/17] NFSv4: Fix client recovery when server reboots multiple times alexander.levin
@ 2017-11-22 22:24 ` alexander.levin
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 14/17] tcp: correct memory barrier usage in tcp_check_space() alexander.levin
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: alexander.levin @ 2017-11-22 22:24 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Christoffer Dall, Marc Zyngier, alexander.levin

From: Christoffer Dall <christoffer.dall@linaro.org>

[ Upstream commit 63e41226afc3f7a044b70325566fa86ac3142538 ]

When a VCPU blocks (WFI) and has programmed the vtimer, we program a
soft timer to expire in the future to wake up the vcpu thread when
appropriate.  Because such as wake up involves a vcpu kick, and the
timer expire function can get called from interrupt context, and the
kick may sleep, we have to schedule the kick in the work function.

The work function currently has a warning that gets raised if it turns
out that the timer shouldn't fire when it's run, which was added because
the idea was that in that case the work should never have been cancelled.

However, it turns out that this whole thing is racy and we can get
spurious warnings.  The problem is that we clear the armed flag in the
work function, which may run in parallel with the
kvm_timer_unschedule->timer_disarm() call.  This results in a possible
situation where the timer_disarm() call does not call
cancel_work_sync(), which effectively synchronizes the completion of the
work function with running the VCPU.  As a result, the VCPU thread
proceeds before the work function completees, causing changes to the
timer state such that kvm_timer_should_fire(vcpu) returns false in the
work function.

All we do in the work function is to kick the VCPU, and an occasional
rare extra kick never harmed anyone.  Since the race above is extremely
rare, we don't bother checking if the race happens but simply remove the
check and the clearing of the armed flag from the work function.

Reported-by: Matthias Brugger <mbrugger@suse.com>
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 virt/kvm/arm/arch_timer.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c
index a7b9022b5c8f..7f38db2a46c8 100644
--- a/virt/kvm/arm/arch_timer.c
+++ b/virt/kvm/arm/arch_timer.c
@@ -84,9 +84,6 @@ static void kvm_timer_inject_irq_work(struct work_struct *work)
 	struct kvm_vcpu *vcpu;
 
 	vcpu = container_of(work, struct kvm_vcpu, arch.timer_cpu.expired);
-	vcpu->arch.timer_cpu.armed = false;
-
-	WARN_ON(!kvm_timer_should_fire(vcpu));
 
 	/*
 	 * If the vcpu is blocked we want to wake it up so that it will see
-- 
2.11.0

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

* [PATCH AUTOSEL for 4.4 14/17] tcp: correct memory barrier usage in tcp_check_space()
  2017-11-22 22:24 [PATCH AUTOSEL for 4.4 01/17] net: systemport: Utilize skb_put_padto() alexander.levin
                   ` (9 preceding siblings ...)
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 08/17] KVM: arm/arm64: Fix occasional warning from the timer work function alexander.levin
@ 2017-11-22 22:24 ` alexander.levin
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 12/17] tipc: fix cleanup at module unload alexander.levin
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: alexander.levin @ 2017-11-22 22:24 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Jason Baron, Eric Dumazet, Oleg Nesterov, David S . Miller,
	alexander.levin

From: Jason Baron <jbaron@akamai.com>

[ Upstream commit 56d806222ace4c3aeae516cd7a855340fb2839d8 ]

sock_reset_flag() maps to __clear_bit() not the atomic version clear_bit().
Thus, we need smp_mb(), smp_mb__after_atomic() is not sufficient.

Fixes: 3c7151275c0c ("tcp: add memory barriers to write space paths")
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Jason Baron <jbaron@akamai.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Reported-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 net/ipv4/tcp_input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 9e8d70160d20..71290fb7d500 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4942,7 +4942,7 @@ static void tcp_check_space(struct sock *sk)
 	if (sock_flag(sk, SOCK_QUEUE_SHRUNK)) {
 		sock_reset_flag(sk, SOCK_QUEUE_SHRUNK);
 		/* pairs with tcp_poll() */
-		smp_mb__after_atomic();
+		smp_mb();
 		if (sk->sk_socket &&
 		    test_bit(SOCK_NOSPACE, &sk->sk_socket->flags))
 			tcp_new_space(sk);
-- 
2.11.0

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

* [PATCH AUTOSEL for 4.4 15/17] mm: avoid returning VM_FAULT_RETRY from ->page_mkwrite handlers
  2017-11-22 22:24 [PATCH AUTOSEL for 4.4 01/17] net: systemport: Utilize skb_put_padto() alexander.levin
                   ` (12 preceding siblings ...)
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 13/17] dmaengine: pl330: fix double lock alexander.levin
@ 2017-11-22 22:24 ` alexander.levin
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 17/17] net: fec: fix multicast filtering hardware setup alexander.levin
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 16/17] xen-netfront: Improve error handling during initialization alexander.levin
  15 siblings, 0 replies; 17+ messages in thread
From: alexander.levin @ 2017-11-22 22:24 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Jan Kara, Matthew Wilcox, Andrew Morton, Linus Torvalds, alexander.levin

From: Jan Kara <jack@suse.cz>

[ Upstream commit 0911d0041c22922228ca52a977d7b0b0159fee4b ]

Some ->page_mkwrite handlers may return VM_FAULT_RETRY as its return
code (GFS2 or Lustre can definitely do this).  However VM_FAULT_RETRY
from ->page_mkwrite is completely unhandled by the mm code and results
in locking and writeably mapping the page which definitely is not what
the caller wanted.

Fix Lustre and block_page_mkwrite_ret() used by other filesystems
(notably GFS2) to return VM_FAULT_NOPAGE instead which results in
bailing out from the fault code, the CPU then retries the access, and we
fault again effectively doing what the handler wanted.

Link: http://lkml.kernel.org/r/20170203150729.15863-1-jack@suse.cz
Signed-off-by: Jan Kara <jack@suse.cz>
Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 drivers/staging/lustre/lustre/llite/llite_mmap.c | 4 +---
 include/linux/buffer_head.h                      | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/llite_mmap.c b/drivers/staging/lustre/lustre/llite/llite_mmap.c
index 7df978371c9a..44fffbd1bc74 100644
--- a/drivers/staging/lustre/lustre/llite/llite_mmap.c
+++ b/drivers/staging/lustre/lustre/llite/llite_mmap.c
@@ -402,15 +402,13 @@ static int ll_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
 		result = VM_FAULT_LOCKED;
 		break;
 	case -ENODATA:
+	case -EAGAIN:
 	case -EFAULT:
 		result = VM_FAULT_NOPAGE;
 		break;
 	case -ENOMEM:
 		result = VM_FAULT_OOM;
 		break;
-	case -EAGAIN:
-		result = VM_FAULT_RETRY;
-		break;
 	default:
 		result = VM_FAULT_SIGBUS;
 		break;
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 89d9aa9e79bf..6fe974dbe741 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -234,12 +234,10 @@ static inline int block_page_mkwrite_return(int err)
 {
 	if (err == 0)
 		return VM_FAULT_LOCKED;
-	if (err == -EFAULT)
+	if (err == -EFAULT || err == -EAGAIN)
 		return VM_FAULT_NOPAGE;
 	if (err == -ENOMEM)
 		return VM_FAULT_OOM;
-	if (err == -EAGAIN)
-		return VM_FAULT_RETRY;
 	/* -ENOSPC, -EDQUOT, -EIO ... */
 	return VM_FAULT_SIGBUS;
 }
-- 
2.11.0

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

* [PATCH AUTOSEL for 4.4 13/17] dmaengine: pl330: fix double lock
  2017-11-22 22:24 [PATCH AUTOSEL for 4.4 01/17] net: systemport: Utilize skb_put_padto() alexander.levin
                   ` (11 preceding siblings ...)
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 12/17] tipc: fix cleanup at module unload alexander.levin
@ 2017-11-22 22:24 ` alexander.levin
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 15/17] mm: avoid returning VM_FAULT_RETRY from ->page_mkwrite handlers alexander.levin
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: alexander.levin @ 2017-11-22 22:24 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Iago Abal, Vinod Koul, alexander.levin

From: Iago Abal <mail@iagoabal.eu>

[ Upstream commit 91539eb1fda2d530d3b268eef542c5414e54bf1a ]

The static bug finder EBA (http://www.iagoabal.eu/eba/) reported the
following double-lock bug:

    Double lock:
    1. spin_lock_irqsave(pch->lock, flags) at pl330_free_chan_resources:2236;
    2. call to function `pl330_release_channel' immediately after;
    3. call to function `dma_pl330_rqcb' in line 1753;
    4. spin_lock_irqsave(pch->lock, flags) at dma_pl330_rqcb:1505.

I have fixed it as suggested by Marek Szyprowski.

First, I have replaced `pch->lock' with `pl330->lock' in functions
`pl330_alloc_chan_resources' and `pl330_free_chan_resources'. This avoids
the double-lock by acquiring a different lock than `dma_pl330_rqcb'.

NOTE that, as a result, `pl330_free_chan_resources' executes
`list_splice_tail_init' on `pch->work_list' under lock `pl330->lock',
whereas in the rest of the code `pch->work_list' is protected by
`pch->lock'. I don't know if this may cause race conditions. Similarly
`pch->cyclic' is written by `pl330_alloc_chan_resources' under
`pl330->lock' but read by `pl330_tx_submit' under `pch->lock'.

Second, I have removed locking from `pl330_request_channel' and
`pl330_release_channel' functions. Function `pl330_request_channel' is
only called from `pl330_alloc_chan_resources', so the lock is already
held. Function `pl330_release_channel' is called from
`pl330_free_chan_resources', which already holds the lock, and from
`pl330_del'. Function `pl330_del' is called in an error path of
`pl330_probe' and at the end of `pl330_remove', but I assume that there
cannot be concurrent accesses to the protected data at those points.

Signed-off-by: Iago Abal <mail@iagoabal.eu>
Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 drivers/dma/pl330.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 8250950aab8b..66d84bcf9bbf 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -1657,7 +1657,6 @@ static bool _chan_ns(const struct pl330_dmac *pl330, int i)
 static struct pl330_thread *pl330_request_channel(struct pl330_dmac *pl330)
 {
 	struct pl330_thread *thrd = NULL;
-	unsigned long flags;
 	int chans, i;
 
 	if (pl330->state == DYING)
@@ -1665,8 +1664,6 @@ static struct pl330_thread *pl330_request_channel(struct pl330_dmac *pl330)
 
 	chans = pl330->pcfg.num_chan;
 
-	spin_lock_irqsave(&pl330->lock, flags);
-
 	for (i = 0; i < chans; i++) {
 		thrd = &pl330->channels[i];
 		if ((thrd->free) && (!_manager_ns(thrd) ||
@@ -1684,8 +1681,6 @@ static struct pl330_thread *pl330_request_channel(struct pl330_dmac *pl330)
 		thrd = NULL;
 	}
 
-	spin_unlock_irqrestore(&pl330->lock, flags);
-
 	return thrd;
 }
 
@@ -1703,7 +1698,6 @@ static inline void _free_event(struct pl330_thread *thrd, int ev)
 static void pl330_release_channel(struct pl330_thread *thrd)
 {
 	struct pl330_dmac *pl330;
-	unsigned long flags;
 
 	if (!thrd || thrd->free)
 		return;
@@ -1715,10 +1709,8 @@ static void pl330_release_channel(struct pl330_thread *thrd)
 
 	pl330 = thrd->dmac;
 
-	spin_lock_irqsave(&pl330->lock, flags);
 	_free_event(thrd, thrd->ev);
 	thrd->free = true;
-	spin_unlock_irqrestore(&pl330->lock, flags);
 }
 
 /* Initialize the structure for PL330 configuration, that can be used
@@ -2085,20 +2077,20 @@ static int pl330_alloc_chan_resources(struct dma_chan *chan)
 	struct pl330_dmac *pl330 = pch->dmac;
 	unsigned long flags;
 
-	spin_lock_irqsave(&pch->lock, flags);
+	spin_lock_irqsave(&pl330->lock, flags);
 
 	dma_cookie_init(chan);
 	pch->cyclic = false;
 
 	pch->thread = pl330_request_channel(pl330);
 	if (!pch->thread) {
-		spin_unlock_irqrestore(&pch->lock, flags);
+		spin_unlock_irqrestore(&pl330->lock, flags);
 		return -ENOMEM;
 	}
 
 	tasklet_init(&pch->task, pl330_tasklet, (unsigned long) pch);
 
-	spin_unlock_irqrestore(&pch->lock, flags);
+	spin_unlock_irqrestore(&pl330->lock, flags);
 
 	return 1;
 }
@@ -2201,12 +2193,13 @@ static int pl330_pause(struct dma_chan *chan)
 static void pl330_free_chan_resources(struct dma_chan *chan)
 {
 	struct dma_pl330_chan *pch = to_pchan(chan);
+	struct pl330_dmac *pl330 = pch->dmac;
 	unsigned long flags;
 
 	tasklet_kill(&pch->task);
 
 	pm_runtime_get_sync(pch->dmac->ddma.dev);
-	spin_lock_irqsave(&pch->lock, flags);
+	spin_lock_irqsave(&pl330->lock, flags);
 
 	pl330_release_channel(pch->thread);
 	pch->thread = NULL;
@@ -2214,7 +2207,7 @@ static void pl330_free_chan_resources(struct dma_chan *chan)
 	if (pch->cyclic)
 		list_splice_tail_init(&pch->work_list, &pch->dmac->desc_pool);
 
-	spin_unlock_irqrestore(&pch->lock, flags);
+	spin_unlock_irqrestore(&pl330->lock, flags);
 	pm_runtime_mark_last_busy(pch->dmac->ddma.dev);
 	pm_runtime_put_autosuspend(pch->dmac->ddma.dev);
 }
-- 
2.11.0

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

* [PATCH AUTOSEL for 4.4 12/17] tipc: fix cleanup at module unload
  2017-11-22 22:24 [PATCH AUTOSEL for 4.4 01/17] net: systemport: Utilize skb_put_padto() alexander.levin
                   ` (10 preceding siblings ...)
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 14/17] tcp: correct memory barrier usage in tcp_check_space() alexander.levin
@ 2017-11-22 22:24 ` alexander.levin
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 13/17] dmaengine: pl330: fix double lock alexander.levin
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: alexander.levin @ 2017-11-22 22:24 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Parthasarathy Bhuvaragan, David S . Miller, alexander.levin

From: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>

[ Upstream commit 35e22e49a5d6a741ebe7f2dd280b2052c3003ef7 ]

In tipc_server_stop(), we iterate over the connections with limiting
factor as server's idr_in_use. We ignore the fact that this variable
is decremented in tipc_close_conn(), leading to premature exit.

In this commit, we iterate until the we have no connections left.

Acked-by: Ying Xue <ying.xue@windriver.com>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Tested-by: John Thompson <thompa.atl@gmail.com>
Signed-off-by: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 net/tipc/server.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/net/tipc/server.c b/net/tipc/server.c
index 50f5b0ca7b3c..c416e5184a3f 100644
--- a/net/tipc/server.c
+++ b/net/tipc/server.c
@@ -618,14 +618,12 @@ int tipc_server_start(struct tipc_server *s)
 void tipc_server_stop(struct tipc_server *s)
 {
 	struct tipc_conn *con;
-	int total = 0;
 	int id;
 
 	spin_lock_bh(&s->idr_lock);
-	for (id = 0; total < s->idr_in_use; id++) {
+	for (id = 0; s->idr_in_use; id++) {
 		con = idr_find(&s->conn_idr, id);
 		if (con) {
-			total++;
 			spin_unlock_bh(&s->idr_lock);
 			tipc_close_conn(con);
 			spin_lock_bh(&s->idr_lock);
-- 
2.11.0

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

* [PATCH AUTOSEL for 4.4 17/17] net: fec: fix multicast filtering hardware setup
  2017-11-22 22:24 [PATCH AUTOSEL for 4.4 01/17] net: systemport: Utilize skb_put_padto() alexander.levin
                   ` (13 preceding siblings ...)
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 15/17] mm: avoid returning VM_FAULT_RETRY from ->page_mkwrite handlers alexander.levin
@ 2017-11-22 22:24 ` alexander.levin
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 16/17] xen-netfront: Improve error handling during initialization alexander.levin
  15 siblings, 0 replies; 17+ messages in thread
From: alexander.levin @ 2017-11-22 22:24 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Rui Sousa, Fugang Duan, David S . Miller, alexander.levin

From: Rui Sousa <rui.sousa@nxp.com>

[ Upstream commit 01f8902bcf3ff124d0aeb88a774180ebcec20ace ]

Fix hardware setup of multicast address hash:
- Never clear the hardware hash (to avoid packet loss)
- Construct the hash register values in software and then write once
to hardware

Signed-off-by: Rui Sousa <rui.sousa@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 drivers/net/ethernet/freescale/fec_main.c | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index ab716042bdd2..458e2d97d096 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -2968,6 +2968,7 @@ static void set_multicast_list(struct net_device *ndev)
 	struct netdev_hw_addr *ha;
 	unsigned int i, bit, data, crc, tmp;
 	unsigned char hash;
+	unsigned int hash_high = 0, hash_low = 0;
 
 	if (ndev->flags & IFF_PROMISC) {
 		tmp = readl(fep->hwp + FEC_R_CNTRL);
@@ -2990,11 +2991,7 @@ static void set_multicast_list(struct net_device *ndev)
 		return;
 	}
 
-	/* Clear filter and add the addresses in hash register
-	 */
-	writel(0, fep->hwp + FEC_GRP_HASH_TABLE_HIGH);
-	writel(0, fep->hwp + FEC_GRP_HASH_TABLE_LOW);
-
+	/* Add the addresses in hash register */
 	netdev_for_each_mc_addr(ha, ndev) {
 		/* calculate crc32 value of mac address */
 		crc = 0xffffffff;
@@ -3012,16 +3009,14 @@ static void set_multicast_list(struct net_device *ndev)
 		 */
 		hash = (crc >> (32 - HASH_BITS)) & 0x3f;
 
-		if (hash > 31) {
-			tmp = readl(fep->hwp + FEC_GRP_HASH_TABLE_HIGH);
-			tmp |= 1 << (hash - 32);
-			writel(tmp, fep->hwp + FEC_GRP_HASH_TABLE_HIGH);
-		} else {
-			tmp = readl(fep->hwp + FEC_GRP_HASH_TABLE_LOW);
-			tmp |= 1 << hash;
-			writel(tmp, fep->hwp + FEC_GRP_HASH_TABLE_LOW);
-		}
+		if (hash > 31)
+			hash_high |= 1 << (hash - 32);
+		else
+			hash_low |= 1 << hash;
 	}
+
+	writel(hash_high, fep->hwp + FEC_GRP_HASH_TABLE_HIGH);
+	writel(hash_low, fep->hwp + FEC_GRP_HASH_TABLE_LOW);
 }
 
 /* Set a MAC change in hardware. */
-- 
2.11.0

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

* [PATCH AUTOSEL for 4.4 16/17] xen-netfront: Improve error handling during initialization
  2017-11-22 22:24 [PATCH AUTOSEL for 4.4 01/17] net: systemport: Utilize skb_put_padto() alexander.levin
                   ` (14 preceding siblings ...)
  2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 17/17] net: fec: fix multicast filtering hardware setup alexander.levin
@ 2017-11-22 22:24 ` alexander.levin
  15 siblings, 0 replies; 17+ messages in thread
From: alexander.levin @ 2017-11-22 22:24 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Ross Lagerwall, David S . Miller, alexander.levin

From: Ross Lagerwall <ross.lagerwall@citrix.com>

[ Upstream commit e2e004acc7cbe3c531e752a270a74e95cde3ea48 ]

This fixes a crash when running out of grant refs when creating many
queues across many netdevs.

* If creating queues fails (i.e. there are no grant refs available),
call xenbus_dev_fatal() to ensure that the xenbus device is set to the
closed state.
* If no queues are created, don't call xennet_disconnect_backend as
netdev->real_num_tx_queues will not have been set correctly.
* If setup_netfront() fails, ensure that all the queues created are
cleaned up, not just those that have been set up.
* If any queues were set up and an error occurs, call
xennet_destroy_queues() to clean up the napi context.
* If any fatal error occurs, unregister and destroy the netdev to avoid
leaving around a half setup network device.

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 drivers/net/xen-netfront.c | 29 +++++++++++------------------
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 34a062ccb11d..18263581d434 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1840,27 +1840,19 @@ static int talk_to_netback(struct xenbus_device *dev,
 		xennet_destroy_queues(info);
 
 	err = xennet_create_queues(info, &num_queues);
-	if (err < 0)
-		goto destroy_ring;
+	if (err < 0) {
+		xenbus_dev_fatal(dev, err, "creating queues");
+		kfree(info->queues);
+		info->queues = NULL;
+		goto out;
+	}
 
 	/* Create shared ring, alloc event channel -- for each queue */
 	for (i = 0; i < num_queues; ++i) {
 		queue = &info->queues[i];
 		err = setup_netfront(dev, queue, feature_split_evtchn);
-		if (err) {
-			/* setup_netfront() will tidy up the current
-			 * queue on error, but we need to clean up
-			 * those already allocated.
-			 */
-			if (i > 0) {
-				rtnl_lock();
-				netif_set_real_num_tx_queues(info->netdev, i);
-				rtnl_unlock();
-				goto destroy_ring;
-			} else {
-				goto out;
-			}
-		}
+		if (err)
+			goto destroy_ring;
 	}
 
 again:
@@ -1950,9 +1942,10 @@ static int talk_to_netback(struct xenbus_device *dev,
 	xenbus_transaction_end(xbt, 1);
  destroy_ring:
 	xennet_disconnect_backend(info);
-	kfree(info->queues);
-	info->queues = NULL;
+	xennet_destroy_queues(info);
  out:
+	unregister_netdev(info->netdev);
+	xennet_free_netdev(info->netdev);
 	return err;
 }
 
-- 
2.11.0

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

end of thread, other threads:[~2017-11-22 23:13 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-22 22:24 [PATCH AUTOSEL for 4.4 01/17] net: systemport: Utilize skb_put_padto() alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 02/17] net: systemport: Pad packet before inserting TSB alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 06/17] ravb: Remove Rx overflow log messages alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 07/17] nfs: Don't take a reference on fl->fl_file for LOCK operation alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 04/17] vti6: fix device register to report IFLA_INFO_KIND alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 05/17] net/appletalk: Fix kernel memory disclosure alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 03/17] ARM: OMAP1: DMA: Correct the number of logical channels alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 11/17] net: sctp: fix array overrun read on sctp_timer_tbl alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 10/17] drm/exynos/decon5433: set STANDALONE_UPDATE_F on output enablement alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 09/17] NFSv4: Fix client recovery when server reboots multiple times alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 08/17] KVM: arm/arm64: Fix occasional warning from the timer work function alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 14/17] tcp: correct memory barrier usage in tcp_check_space() alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 12/17] tipc: fix cleanup at module unload alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 13/17] dmaengine: pl330: fix double lock alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 15/17] mm: avoid returning VM_FAULT_RETRY from ->page_mkwrite handlers alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 17/17] net: fec: fix multicast filtering hardware setup alexander.levin
2017-11-22 22:24 ` [PATCH AUTOSEL for 4.4 16/17] xen-netfront: Improve error handling during initialization alexander.levin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.