Skip to contentSkip to conversation

4.17.19-stable review

PATCH In review Greg Kroah-Hartman 4 participants 309 messages Aug 23, 2018 – Aug 24, 2018 1 message not in the archive Page 1 of 2

Subsystems (9)
lore
Share & tools
lore
author maintainer
#5 lore raw

PATCH 5/324 IB/rxe: avoid double kfree skb

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Zhu Yanjun <[email protected]>

[ Upstream commit 828d810550abc1fffff9b20545fec4bc150d5e82 ]

In rxe_send, when network_type is not RDMA_NETWORK_IPV4 or RDMA_NETWORK_IPV6, skb is freed and -EINVAL is returned. Then rxe_xmit_packet will return -EINVAL, too. In rxe_requester, this skb is double freed.
In rxe_requester, kfree_skb is needed only after fill_packet fails. So kfree_skb is moved from label err to test fill_packet.

Fixes 5793b4652155 ("IB/rxe: remove unnecessary skb_clone in xmit")
---
 drivers/infiniband/sw/rxe/rxe_req.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/sw/rxe/rxe_req.c +1 -1
@@ -709,6 +709,7 @@ next_wqe:
 
 	if (fill_packet(qp, wqe, &pkt, skb, payload)) {
 		pr_debug("qp#%d Error during fill packet\n", qp_num(qp));
+		kfree_skb(skb);
 		goto err;
 	}
 
@@ -740,7 +741,6 @@ next_wqe:
 	goto next_wqe;
 
 err:
-	kfree_skb(skb);
 	wqe->status = IB_WC_LOC_PROT_ERR;
 	wqe->state = wqe_state_error;
 	__rxe_do_task(&qp->comp.task);
author maintainer
#6 lore raw

PATCH 6/324 RDMA/qedr: Fix NULL pointer dereference when running over iWARP without RDMA-CM

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: "Kalderon, Michal" <[email protected]>

[ Upstream commit 425cf5c1350a98b81f3ddda160b99c3be613a213 ]

Some RoCE specific code in qedr_modify_qp was run over an iWARP device when running perftest benchmarks without the -R option.

The commit 3e44e0ee0893 ("IB/providers: Avoid null netdev check for RoCE") exposed this. Dropping the check for NULL pointer on ndev in qedr_modify_qp lead to a null pointer dereference when running over iWARP. Before the code would identify ndev as being NULL and return an error.

Fixes 3e44e0ee0893 ("IB/providers: Avoid null netdev check for RoCE")
---
 drivers/infiniband/hw/qedr/verbs.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/infiniband/hw/qedr/verbs.c +3 -0
@@ -1957,6 +1957,9 @@ int qedr_modify_qp(struct ib_qp *ibqp, s
 	}
 
 	if (attr_mask & (IB_QP_AV | IB_QP_PATH_MTU)) {
+		if (rdma_protocol_iwarp(&dev->ibdev, 1))
+			return -EINVAL;
+
 		if (attr_mask & IB_QP_PATH_MTU) {
 			if (attr->path_mtu < IB_MTU_256 ||
 			    attr->path_mtu > IB_MTU_4096) {
author maintainer
#9 lore raw

PATCH 9/324 clocksource/drivers/stm32: Fix error return code

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Julia Lawall <[email protected]>

[ Upstream commit a26ed66c20f080c510fcf5bd448bce204f2c19d7 ]

Return an error code on failure.

Problem found using Coccinelle.

---
 drivers/clocksource/timer-stm32.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clocksource/timer-stm32.c +3 -1
@@ -304,8 +304,10 @@ static int __init stm32_timer_init(struc
 
 	to->private_data = kzalloc(sizeof(struct stm32_timer_private),
 				   GFP_KERNEL);
-	if (!to->private_data)
+	if (!to->private_data) {
+		ret = -ENOMEM;
 		goto deinit;
+	}
 
 	rstc = of_reset_control_get(node, NULL);
 	if (!IS_ERR(rstc)) {
author maintainer
#10 lore raw

PATCH 10/324 drm/bridge/sii8620: fix loops in EDID fetch logic

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Andrzej Hajda <[email protected]>

[ Upstream commit 8e627a1b1ce8feb3e1da4428b71b9b4905f04888 ]

Function should constantly check if cable is connected and finish in finite time.

---
 drivers/gpu/drm/bridge/sil-sii8620.c |   31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)
drivers/gpu/drm/bridge/sil-sii8620.c +20 -11
@@ -807,6 +807,7 @@ static void sii8620_burst_rx_all(struct
 static void sii8620_fetch_edid(struct sii8620 *ctx)
 {
 	u8 lm_ddc, ddc_cmd, int3, cbus;
+	unsigned long timeout;
 	int fetched, i;
 	int edid_len = EDID_LENGTH;
 	u8 *edid;
@@ -856,23 +857,31 @@ static void sii8620_fetch_edid(struct si
 			REG_DDC_CMD, ddc_cmd | VAL_DDC_CMD_ENH_DDC_READ_NO_ACK
 		);
 
-		do {
-			int3 = sii8620_readb(ctx, REG_INTR3);
+		int3 = 0;
+		timeout = jiffies + msecs_to_jiffies(200);
+		for (;;) {
 			cbus = sii8620_readb(ctx, REG_CBUS_STATUS);
-
-			if (int3 & BIT_DDC_CMD_DONE)
-				break;
-
-			if (!(cbus & BIT_CBUS_STATUS_CBUS_CONNECTED)) {
+			if (~cbus & BIT_CBUS_STATUS_CBUS_CONNECTED) {
+				kfree(edid);
+				edid = NULL;
+				goto end;
+			}
+			if (int3 & BIT_DDC_CMD_DONE) {
+				if (sii8620_readb(ctx, REG_DDC_DOUT_CNT)
+				    >= FETCH_SIZE)
+					break;
+			} else {
+				int3 = sii8620_readb(ctx, REG_INTR3);
+			}
+			if (time_is_before_jiffies(timeout)) {
+				ctx->error = -ETIMEDOUT;
+				dev_err(ctx->dev, "timeout during EDID read\n");
 				kfree(edid);
 				edid = NULL;
 				goto end;
 			}
-		} while (1);
-
-		sii8620_readb(ctx, REG_DDC_STATUS);
-		while (sii8620_readb(ctx, REG_DDC_DOUT_CNT) < FETCH_SIZE)
 			usleep_range(10, 20);
+		}
 
 		sii8620_read_buf(ctx, REG_DDC_DATA, edid + fetched, FETCH_SIZE);
 		if (fetched + FETCH_SIZE == EDID_LENGTH) {
author maintainer
#19 lore raw

PATCH 18/324 soc: imx: gpcv2: correct PGC offset

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Anson Huang <[email protected]>

[ Upstream commit 3637f12faf507b0a4b8ac1e7115fc99583ab1db3 ]

Correct MIPI/PCIe/USB_HSIC's PGC offset based on design RTL, the values in the Reference Manual (Rev. 1, 01/2018 and the older ones) are incorrect.

The correct offset values should be as below:

0x800 ~ 0x83F: PGC for core0 of A7 platform;
0x840 ~ 0x87F: PGC for core1 of A7 platform;
0x880 ~ 0x8BF: PGC for SCU of A7 platform;
0xA00 ~ 0xA3F: PGC for fastmix/megamix;
0xC00 ~ 0xC3F: PGC for MIPI PHY;
0xC40 ~ 0xC7F: PGC for PCIe_PHY;
0xC80 ~ 0xCBF: PGC for USB OTG1 PHY;
0xCC0 ~ 0xCFF: PGC for USB OTG2 PHY;
0xD00 ~ 0xD3F: PGC for USB HSIC PHY;

Fixes 03aa12629fc4 ("soc: imx: Add GPCv2 power gating driver")
---
 drivers/soc/imx/gpcv2.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/soc/imx/gpcv2.c +9 -4
@@ -39,10 +39,15 @@
 
 #define GPC_M4_PU_PDN_FLG		0x1bc
 
-
-#define PGC_MIPI			4
-#define PGC_PCIE			5
-#define PGC_USB_HSIC			8
+/*
+ * The PGC offset values in Reference Manual
+ * (Rev. 1, 01/2018 and the older ones) GPC chapter's
+ * GPC_PGC memory map are incorrect, below offset
+ * values are from design RTL.
+ */
+#define PGC_MIPI			16
+#define PGC_PCIE			17
+#define PGC_USB_HSIC			20
 #define GPC_PGC_CTRL(n)			(0x800 + (n) * 0x40)
 #define GPC_PGC_SR(n)			(GPC_PGC_CTRL(n) + 0xc)
 
author maintainer
#20 lore raw

PATCH 19/324 usb: dwc3: pci: add support for Intel IceLake

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Heikki Krogerus <[email protected]>

[ Upstream commit 00908693c481f7298adf8cf4d2ff3dfbea8c375f ]

PCI IDs for Intel IceLake.

---
 drivers/usb/dwc3/dwc3-pci.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/usb/dwc3/dwc3-pci.c +2 -0
@@ -34,6 +34,7 @@
 #define PCI_DEVICE_ID_INTEL_GLK			0x31aa
 #define PCI_DEVICE_ID_INTEL_CNPLP		0x9dee
 #define PCI_DEVICE_ID_INTEL_CNPH		0xa36e
+#define PCI_DEVICE_ID_INTEL_ICLLP		0x34ee
 
 #define PCI_INTEL_BXT_DSM_GUID		"732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511"
 #define PCI_INTEL_BXT_FUNC_PMU_PWR	4
@@ -289,6 +290,7 @@ static const struct pci_device_id dwc3_p
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_GLK), },
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CNPLP), },
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CNPH), },
+	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICLLP), },
 	{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), },
 	{  }	/* Terminating Entry */
 };
author maintainer
#21 lore raw

PATCH 20/324 usb: gadget: ffs: Fix BUG when userland exits with submitted AIO transfers

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Vincent Pelletier <[email protected]>

[ Upstream commit d52e4d0c0c428bf2ba35074a7495cdb28e2efbae ]

This bug happens only when the UDC needs to sleep during usb_ep_dequeue, as is the case for (at least) dwc3.

[  382.200896] BUG: scheduling while atomic: screen/1808/0x00000100
[  382.207124] 4 locks held by screen/1808:
[  382.211266]  #0:  (rcu_callback){....}, at: [<c10b4ff0>] rcu_process_callbacks+0x260/0x440
[  382.219949]  #1:  (rcu_read_lock_sched){....}, at: [<c1358ba0>] percpu_ref_switch_to_atomic_rcu+0xb0/0x130
[  382.230034]  #2:  (&(&ctx->ctx_lock)->rlock){....}, at: [<c11f0c73>] free_ioctx_users+0x23/0xd0
[  382.230096]  #3:  (&(&ffs->eps_lock)->rlock){....}, at: [<f81e7710>] ffs_aio_cancel+0x20/0x60 [usb_f_fs]
[  382.230160] Modules linked in: usb_f_fs libcomposite configfs bnep btsdio bluetooth ecdh_generic brcmfmac brcmutil intel_powerclamp coretemp dwc3 kvm_intel ulpi udc_core kvm irqbypass crc32_pclmul crc32c_intel pcbc dwc3_pci aesni_intel aes_i586 crypto_simd cryptd ehci_pci ehci_hcd gpio_keys usbcore basincove_gpadc industrialio usb_common
[  382.230407] CPU: 1 PID: 1808 Comm: screen Not tainted 4.14.0-edison+ #117
[  382.230416] Hardware name: Intel Corporation Merrifield/BODEGA BAY, BIOS 542 2015.01.21:18.19.48
[  382.230425] Call Trace:
[  382.230438]  <SOFTIRQ>
[  382.230466]  dump_stack+0x47/0x62
[  382.230498]  __schedule_bug+0x61/0x80
[  382.230522]  __schedule+0x43/0x7a0
[  382.230587]  schedule+0x5f/0x70
[  382.230625]  dwc3_gadget_ep_dequeue+0x14c/0x270 [dwc3]
[  382.230669]  ? do_wait_intr_irq+0x70/0x70
[  382.230724]  usb_ep_dequeue+0x19/0x90 [udc_core]
[  382.230770]  ffs_aio_cancel+0x37/0x60 [usb_f_fs]
[  382.230798]  kiocb_cancel+0x31/0x40
[  382.230822]  free_ioctx_users+0x4d/0xd0
[  382.230858]  percpu_ref_switch_to_atomic_rcu+0x10a/0x130
[  382.230881]  ? percpu_ref_exit+0x40/0x40
[  382.230904]  rcu_process_callbacks+0x2b3/0x440
[  382.230965]  __do_softirq+0xf8/0x26b
[  382.231011]  ? __softirqentry_text_start+0x8/0x8
[  382.231033]  do_softirq_own_stack+0x22/0x30
[  382.231042]  </SOFTIRQ>
[  382.231071]  irq_exit+0x45/0xc0
[  382.231089]  smp_apic_timer_interrupt+0x13c/0x150
[  382.231118]  apic_timer_interrupt+0x35/0x3c
[  382.231132] EIP: __copy_user_ll+0xe2/0xf0
[  382.231142] EFLAGS: 00210293 CPU: 1
[  382.231154] EAX: bfd4508c EBX: 00000004 ECX: 00000003 EDX: f3d8fe50
[  382.231165] ESI: f3d8fe51 EDI: bfd4508d EBP: f3d8fe14 ESP: f3d8fe08
[  382.231176]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
[  382.231265]  core_sys_select+0x25f/0x320
[  382.231346]  ? __wake_up_common_lock+0x62/0x80
[  382.231399]  ? tty_ldisc_deref+0x13/0x20
[  382.231438]  ? ldsem_up_read+0x1b/0x40
[  382.231459]  ? tty_ldisc_deref+0x13/0x20
[  382.231479]  ? tty_write+0x29f/0x2e0
[  382.231514]  ? n_tty_ioctl+0xe0/0xe0
[  382.231541]  ? tty_write_unlock+0x30/0x30
[  382.231566]  ? __vfs_write+0x22/0x110
[  382.231604]  ? security_file_permission+0x2f/0xd0
[  382.231635]  ? rw_verify_area+0xac/0x120
[  382.231677]  ? vfs_write+0x103/0x180
[  382.231711]  SyS_select+0x87/0xc0
[  382.231739]  ? SyS_write+0x42/0x90
[  382.231781]  do_fast_syscall_32+0xd6/0x1a0
[  382.231836]  entry_SYSENTER_32+0x47/0x71
[  382.231848] EIP: 0xb7f75b05
[  382.231857] EFLAGS: 00000246 CPU: 1
[  382.231868] EAX: ffffffda EBX: 00000400 ECX: bfd4508c EDX: bfd4510c
[  382.231878] ESI: 00000000 EDI: 00000000 EBP: 00000000 ESP: bfd45020
[  382.231889]  DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 007b
[  382.232281] softirq: huh, entered softirq 9 RCU c10b4d90 with preempt_count 00000100, exited with 00000000?
---
 drivers/usb/gadget/function/f_fs.c |   26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)
drivers/usb/gadget/function/f_fs.c +18 -8
@@ -215,6 +215,7 @@ struct ffs_io_data {
 
 	struct mm_struct *mm;
 	struct work_struct work;
+	struct work_struct cancellation_work;
 
 	struct usb_ep *ep;
 	struct usb_request *req;
@@ -1072,22 +1073,31 @@ ffs_epfile_open(struct inode *inode, str
 	return 0;
 }
 
+static void ffs_aio_cancel_worker(struct work_struct *work)
+{
+	struct ffs_io_data *io_data = container_of(work, struct ffs_io_data,
+						   cancellation_work);
+
+	ENTER();
+
+	usb_ep_dequeue(io_data->ep, io_data->req);
+}
+
 static int ffs_aio_cancel(struct kiocb *kiocb)
 {
 	struct ffs_io_data *io_data = kiocb->private;
-	struct ffs_epfile *epfile = kiocb->ki_filp->private_data;
+	struct ffs_data *ffs = io_data->ffs;
 	int value;
 
 	ENTER();
 
-	spin_lock_irq(&epfile->ffs->eps_lock);
-
-	if (likely(io_data && io_data->ep && io_data->req))
-		value = usb_ep_dequeue(io_data->ep, io_data->req);
-	else
+	if (likely(io_data && io_data->ep && io_data->req)) {
+		INIT_WORK(&io_data->cancellation_work, ffs_aio_cancel_worker);
+		queue_work(ffs->io_completion_wq, &io_data->cancellation_work);
+		value = -EINPROGRESS;
+	} else {
 		value = -EINVAL;
-
-	spin_unlock_irq(&epfile->ffs->eps_lock);
+	}
 
 	return value;
 }
author maintainer
#22 lore raw

PATCH 21/324 usb: dwc2: gadget: Fix issue in dwc2_gadget_start_isoc()

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Minas Harutyunyan <[email protected]>

[ Upstream commit 1ffba9058737af2ddeebc813faa8ea9b16bc892a ]

In case of requests queue is empty reset EP target_frame to initial value.

This allow restarting ISOC traffic in case when function driver queued requests with interruptions.

---
 drivers/usb/dwc2/gadget.c |    1 +
 1 file changed, 1 insertion(+)
drivers/usb/dwc2/gadget.c +1 -0
@@ -892,6 +892,7 @@ static void dwc2_gadget_start_isoc_ddma(
 	u32 ctrl;
 
 	if (list_empty(&hs_ep->queue)) {
+		hs_ep->target_frame = TARGET_FRAME_INITIAL;
 		dev_dbg(hsotg->dev, "%s: No requests in queue\n", __func__);
 		return;
 	}
author maintainer
#26 lore raw

PATCH 25/324 netfilter: nf_ct_helper: Fix possible panic after nf_conntrack_helper_unregister

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Gao Feng <[email protected]>

[ Upstream commit ad9852af97587b8abe8102f9ddcb05c9769656f6 ]

The helper module would be unloaded after nf_conntrack_helper_unregister, so it may cause a possible panic caused by race.

nf_ct_iterate_destroy(unhelp, me) reset the helper of conntrack as NULL, but maybe someone has gotten the helper pointer during this period. Then it would panic, when it accesses the helper and the module was unloaded.

Take an example as following:
CPU0 CPU1
ctnetlink_dump_helpinfo
helper = rcu_dereference(help->helper);
unhelp set helper as NULL unload helper module
helper->to_nlattr(skb, ct);

As above, the cpu0 tries to access the helper and its module is unloaded, then the panic happens.

---
 net/netfilter/nf_conntrack_helper.c |    5 +++++
 1 file changed, 5 insertions(+)
net/netfilter/nf_conntrack_helper.c +5 -0
@@ -465,6 +465,11 @@ void nf_conntrack_helper_unregister(stru
 
 	nf_ct_expect_iterate_destroy(expect_iter_me, NULL);
 	nf_ct_iterate_destroy(unhelp, me);
+
+	/* Maybe someone has gotten the helper already when unhelp above.
+	 * So need to wait it.
+	 */
+	synchronize_rcu();
 }
 EXPORT_SYMBOL_GPL(nf_conntrack_helper_unregister);
 
author maintainer
#27 lore raw

PATCH 26/324 selftests: pstore: return Kselftest Skip code for skipped tests

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: "Shuah Khan (Samsung OSG)" <[email protected]>

[ Upstream commit 856e7c4b619af622d56b3b454f7bec32a170ac99 ]

When pstore_post_reboot test gets skipped because of unmet dependencies and/or unsupported configuration, it returns 0 which is treated as a pass by the Kselftest framework. This leads to false positive result even when the test could not be run.

Change it to return kselftest skip code when a test gets skipped to clearly report that the test could not be run.

Kselftest framework SKIP code is 4 and the framework prints appropriate messages to indicate that the test is skipped.

---
 tools/testing/selftests/pstore/pstore_post_reboot_tests |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tools/testing/selftests/pstore/pstore_post_reboot_tests +4 -1
@@ -7,13 +7,16 @@
 #
 # Released under the terms of the GPL v2.
 
+# Kselftest framework requirement - SKIP code is 4.
+ksft_skip=4
+
 . ./common_tests
 
 if [ -e $REBOOT_FLAG  ]; then
     rm $REBOOT_FLAG
 else
     prlog "pstore_crash_test has not been executed yet. we skip further tests."
-    exit 0
+    exit $ksft_skip
 fi
 
 prlog -n "Mounting pstore filesystem ... "
author maintainer
#28 lore raw

PATCH 27/324 selftests: static_keys: return Kselftest Skip code for skipped tests

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: "Shuah Khan (Samsung OSG)" <[email protected]>

[ Upstream commit 8781578087b8fb8829558bac96c3c24e5ba26f82 ]

When static_keys test is skipped because of unmet dependencies and/or unsupported configuration, it exits with error which is treated as a fail by the Kselftest framework. This leads to false negative result even when the test could not be run.

Change it to return kselftest skip code when a test gets skipped to clearly report that the test could not be run.

Added an explicit searches for test_static_key_base and test_static_keys modules and return skip code if they aren't found to differentiate between the failure to load the module condition and module not found condition.

Kselftest framework SKIP code is 4 and the framework prints appropriate messages to indicate that the test is skipped.

---
 tools/testing/selftests/static_keys/test_static_keys.sh |   13 +++++++++++++
 1 file changed, 13 insertions(+)
tools/testing/selftests/static_keys/test_static_keys.sh +13 -0
@@ -2,6 +2,19 @@
 # SPDX-License-Identifier: GPL-2.0
 # Runs static keys kernel module tests
 
+# Kselftest framework requirement - SKIP code is 4.
+ksft_skip=4
+
+if ! /sbin/modprobe -q -n test_static_key_base; then
+	echo "static_key: module test_static_key_base is not found [SKIP]"
+	exit $ksft_skip
+fi
+
+if ! /sbin/modprobe -q -n test_static_keys; then
+	echo "static_key: module test_static_keys is not found [SKIP]"
+	exit $ksft_skip
+fi
+
 if /sbin/modprobe -q test_static_key_base; then
 	if /sbin/modprobe -q test_static_keys; then
 		echo "static_key: ok"
author maintainer
#32 lore raw

PATCH 31/324 selftests: vm: return Kselftest Skip code for skipped tests

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: "Shuah Khan (Samsung OSG)" <[email protected]>

[ Upstream commit a4d7537789724985cafbc9260a31ca4f2b7cf123 ]

When vm test is skipped because of unmet dependencies and/or unsupported configuration, it exits with error which is treated as a fail by the Kselftest framework. This leads to false negative result even when the test could not be run.

Change it to return kselftest skip code when a test gets skipped to clearly report that the test could not be run.

Kselftest framework SKIP code is 4 and the framework prints appropriate messages to indicate that the test is skipped.

---
 tools/testing/selftests/vm/compaction_test.c |    4 +++-
 tools/testing/selftests/vm/mlock2-tests.c    |   12 +++++++-----
 tools/testing/selftests/vm/run_vmtests       |    5 ++++-
 tools/testing/selftests/vm/userfaultfd.c     |    4 +++-
 4 files changed, 17 insertions(+), 8 deletions(-)
tools/testing/selftests/vm/compaction_test.c +3 -1
@@ -16,6 +16,8 @@
 #include <unistd.h>
 #include <string.h>
 
+#include "../kselftest.h"
+
 #define MAP_SIZE 1048576
 
 struct map_list {
@@ -169,7 +171,7 @@ int main(int argc, char **argv)
 		printf("Either the sysctl compact_unevictable_allowed is not\n"
 		       "set to 1 or couldn't read the proc file.\n"
 		       "Skipping the test\n");
-		return 0;
+		return KSFT_SKIP;
 	}
 
 	lim.rlim_cur = RLIM_INFINITY;
tools/testing/selftests/vm/mlock2-tests.c +7 -5
@@ -9,6 +9,8 @@
 #include <stdbool.h>
 #include "mlock2.h"
 
+#include "../kselftest.h"
+
 struct vm_boundaries {
 	unsigned long start;
 	unsigned long end;
@@ -303,7 +305,7 @@ static int test_mlock_lock()
 	if (mlock2_(map, 2 * page_size, 0)) {
 		if (errno == ENOSYS) {
 			printf("Cannot call new mlock family, skipping test\n");
-			_exit(0);
+			_exit(KSFT_SKIP);
 		}
 		perror("mlock2(0)");
 		goto unmap;
@@ -412,7 +414,7 @@ static int test_mlock_onfault()
 	if (mlock2_(map, 2 * page_size, MLOCK_ONFAULT)) {
 		if (errno == ENOSYS) {
 			printf("Cannot call new mlock family, skipping test\n");
-			_exit(0);
+			_exit(KSFT_SKIP);
 		}
 		perror("mlock2(MLOCK_ONFAULT)");
 		goto unmap;
@@ -425,7 +427,7 @@ static int test_mlock_onfault()
 	if (munlock(map, 2 * page_size)) {
 		if (errno == ENOSYS) {
 			printf("Cannot call new mlock family, skipping test\n");
-			_exit(0);
+			_exit(KSFT_SKIP);
 		}
 		perror("munlock()");
 		goto unmap;
@@ -457,7 +459,7 @@ static int test_lock_onfault_of_present(
 	if (mlock2_(map, 2 * page_size, MLOCK_ONFAULT)) {
 		if (errno == ENOSYS) {
 			printf("Cannot call new mlock family, skipping test\n");
-			_exit(0);
+			_exit(KSFT_SKIP);
 		}
 		perror("mlock2(MLOCK_ONFAULT)");
 		goto unmap;
@@ -583,7 +585,7 @@ static int test_vma_management(bool call
 	if (call_mlock && mlock2_(map, 3 * page_size, MLOCK_ONFAULT)) {
 		if (errno == ENOSYS) {
 			printf("Cannot call new mlock family, skipping test\n");
-			_exit(0);
+			_exit(KSFT_SKIP);
 		}
 		perror("mlock(ONFAULT)\n");
 		goto out;
tools/testing/selftests/vm/run_vmtests +4 -1
@@ -2,6 +2,9 @@
 # SPDX-License-Identifier: GPL-2.0
 #please run as root
 
+# Kselftest framework requirement - SKIP code is 4.
+ksft_skip=4
+
 mnt=./huge
 exitcode=0
 
@@ -36,7 +39,7 @@ if [ -n "$freepgs" ] && [ -n "$hpgsize_K
 		echo $(( $lackpgs + $nr_hugepgs )) > /proc/sys/vm/nr_hugepages
 		if [ $? -ne 0 ]; then
 			echo "Please run this test as root"
-			exit 1
+			exit $ksft_skip
 		fi
 		while read name size unit; do
 			if [ "$name" = "HugePages_Free:" ]; then
tools/testing/selftests/vm/userfaultfd.c +3 -1
@@ -69,6 +69,8 @@
 #include <setjmp.h>
 #include <stdbool.h>
 
+#include "../kselftest.h"
+
 #ifdef __NR_userfaultfd
 
 static unsigned long nr_cpus, nr_pages, nr_pages_per_cpu, page_size;
@@ -1322,7 +1324,7 @@ int main(int argc, char **argv)
 int main(void)
 {
 	printf("skip: Skipping userfaultfd test (missing __NR_userfaultfd)\n");
-	return 0;
+	return KSFT_SKIP;
 }
 
 #endif /* __NR_userfaultfd */
author maintainer
#34 lore raw

PATCH 33/324 ARM: dts: NSP: Fix i2c controller interrupt type

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Florian Fainelli <[email protected]>

[ Upstream commit a3e32e78a40017756c71ef6dad429ffe3301126a ]

The i2c controller should use IRQ_TYPE_LEVEL_HIGH instead of IRQ_TYPE_NONE.

Fixes 0f9f27a36d09 ("ARM: dts: NSP: Add I2C support to the DT")
---
 arch/arm/boot/dts/bcm-nsp.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/bcm-nsp.dtsi +1 -1
@@ -391,7 +391,7 @@
 			reg = <0x38000 0x50>;
 			#address-cells = <1>;
 			#size-cells = <0>;
-			interrupts = <GIC_SPI 89 IRQ_TYPE_NONE>;
+			interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
 			clock-frequency = <100000>;
 			dma-coherent;
 			status = "disabled";
author maintainer
#35 lore raw

PATCH 34/324 ARM: dts: NSP: Fix PCIe controllers interrupt types

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Florian Fainelli <[email protected]>

[ Upstream commit 403fde644855bc71318c8db65646383e22653b13 ]

The interrupts for the PCIe controllers should all be of type IRQ_TYPE_LEVEL_HIGH instead of IRQ_TYPE_NONE.

Fixes d71eb9412088 ("ARM: dts: NSP: Add MSI support on PCI")
Fixes 522199029fdc ("ARM: dts: NSP: Fix PCIE DT issue")
---
 arch/arm/boot/dts/bcm-nsp.dtsi |   30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)
arch/arm/boot/dts/bcm-nsp.dtsi +15 -15
@@ -496,7 +496,7 @@
 
 		#interrupt-cells = <1>;
 		interrupt-map-mask = <0 0 0 0>;
-		interrupt-map = <0 0 0 0 &gic GIC_SPI 131 IRQ_TYPE_NONE>;
+		interrupt-map = <0 0 0 0 &gic GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>;
 
 		linux,pci-domain = <0>;
 
@@ -519,10 +519,10 @@
 			compatible = "brcm,iproc-msi";
 			msi-controller;
 			interrupt-parent = <&gic>;
-			interrupts = <GIC_SPI 127 IRQ_TYPE_NONE>,
-				     <GIC_SPI 128 IRQ_TYPE_NONE>,
-				     <GIC_SPI 129 IRQ_TYPE_NONE>,
-				     <GIC_SPI 130 IRQ_TYPE_NONE>;
+			interrupts = <GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 128 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 129 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 130 IRQ_TYPE_LEVEL_HIGH>;
 			brcm,pcie-msi-inten;
 		};
 	};
@@ -533,7 +533,7 @@
 
 		#interrupt-cells = <1>;
 		interrupt-map-mask = <0 0 0 0>;
-		interrupt-map = <0 0 0 0 &gic GIC_SPI 137 IRQ_TYPE_NONE>;
+		interrupt-map = <0 0 0 0 &gic GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>;
 
 		linux,pci-domain = <1>;
 
@@ -556,10 +556,10 @@
 			compatible = "brcm,iproc-msi";
 			msi-controller;
 			interrupt-parent = <&gic>;
-			interrupts = <GIC_SPI 133 IRQ_TYPE_NONE>,
-				     <GIC_SPI 134 IRQ_TYPE_NONE>,
-				     <GIC_SPI 135 IRQ_TYPE_NONE>,
-				     <GIC_SPI 136 IRQ_TYPE_NONE>;
+			interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>;
 			brcm,pcie-msi-inten;
 		};
 	};
@@ -570,7 +570,7 @@
 
 		#interrupt-cells = <1>;
 		interrupt-map-mask = <0 0 0 0>;
-		interrupt-map = <0 0 0 0 &gic GIC_SPI 143 IRQ_TYPE_NONE>;
+		interrupt-map = <0 0 0 0 &gic GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
 
 		linux,pci-domain = <2>;
 
@@ -593,10 +593,10 @@
 			compatible = "brcm,iproc-msi";
 			msi-controller;
 			interrupt-parent = <&gic>;
-			interrupts = <GIC_SPI 139 IRQ_TYPE_NONE>,
-				     <GIC_SPI 140 IRQ_TYPE_NONE>,
-				     <GIC_SPI 141 IRQ_TYPE_NONE>,
-				     <GIC_SPI 142 IRQ_TYPE_NONE>;
+			interrupts = <GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>;
 			brcm,pcie-msi-inten;
 		};
 	};
author maintainer
#36 lore raw

PATCH 35/324 ARM: dts: HR2: Fix interrupt types for i2c and PCIe

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Florian Fainelli <[email protected]>

[ Upstream commit dbe4a39331b7aa8bcac8ef2da780724e1af1619a ]

The i2c and PCIe controllers had an incorrect type which should have been set to IRQ_TYPE_LEVEL_HIGH, fix that.

Fixes b9099ec754b5 ("ARM: dts: Add Broadcom Hurricane 2 DTS include file")
---
 arch/arm/boot/dts/bcm-hr2.dtsi |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
arch/arm/boot/dts/bcm-hr2.dtsi +12 -12
@@ -264,7 +264,7 @@
 			reg = <0x38000 0x50>;
 			#address-cells = <1>;
 			#size-cells = <0>;
-			interrupts = <GIC_SPI 95 IRQ_TYPE_NONE>;
+			interrupts = <GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>;
 			clock-frequency = <100000>;
 		};
 
@@ -279,7 +279,7 @@
 			reg = <0x3b000 0x50>;
 			#address-cells = <1>;
 			#size-cells = <0>;
-			interrupts = <GIC_SPI 96 IRQ_TYPE_NONE>;
+			interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
 			clock-frequency = <100000>;
 		};
 	};
@@ -300,7 +300,7 @@
 
 		#interrupt-cells = <1>;
 		interrupt-map-mask = <0 0 0 0>;
-		interrupt-map = <0 0 0 0 &gic GIC_SPI 186 IRQ_TYPE_NONE>;
+		interrupt-map = <0 0 0 0 &gic GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>;
 
 		linux,pci-domain = <0>;
 
@@ -322,10 +322,10 @@
 			compatible = "brcm,iproc-msi";
 			msi-controller;
 			interrupt-parent = <&gic>;
-			interrupts = <GIC_SPI 182 IRQ_TYPE_NONE>,
-				     <GIC_SPI 183 IRQ_TYPE_NONE>,
-				     <GIC_SPI 184 IRQ_TYPE_NONE>,
-				     <GIC_SPI 185 IRQ_TYPE_NONE>;
+			interrupts = <GIC_SPI 182 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 183 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 185 IRQ_TYPE_LEVEL_HIGH>;
 			brcm,pcie-msi-inten;
 		};
 	};
@@ -336,7 +336,7 @@
 
 		#interrupt-cells = <1>;
 		interrupt-map-mask = <0 0 0 0>;
-		interrupt-map = <0 0 0 0 &gic GIC_SPI 192 IRQ_TYPE_NONE>;
+		interrupt-map = <0 0 0 0 &gic GIC_SPI 192 IRQ_TYPE_LEVEL_HIGH>;
 
 		linux,pci-domain = <1>;
 
@@ -358,10 +358,10 @@
 			compatible = "brcm,iproc-msi";
 			msi-controller;
 			interrupt-parent = <&gic>;
-			interrupts = <GIC_SPI 188 IRQ_TYPE_NONE>,
-				     <GIC_SPI 189 IRQ_TYPE_NONE>,
-				     <GIC_SPI 190 IRQ_TYPE_NONE>,
-				     <GIC_SPI 191 IRQ_TYPE_NONE>;
+			interrupts = <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 189 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 190 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 191 IRQ_TYPE_LEVEL_HIGH>;
 			brcm,pcie-msi-inten;
 		};
 	};
author maintainer
#42 lore raw

PATCH 41/324 arm64: dts: ns2: Fix I2C controller interrupt type

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Ray Jui <[email protected]>

[ Upstream commit e605c287deed45624e8d35a15e3f0b4faab1a62d ]

Fix I2C controller interrupt to use IRQ_TYPE_LEVEL_HIGH for Broadcom NS2 SoC.

Fixes 7ac674e8df7a ("arm64: dts: Add I2C nodes for NS2")
---
 arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi +2 -2
@@ -566,7 +566,7 @@
 			reg = <0x66080000 0x100>;
 			#address-cells = <1>;
 			#size-cells = <0>;
-			interrupts = <GIC_SPI 394 IRQ_TYPE_NONE>;
+			interrupts = <GIC_SPI 394 IRQ_TYPE_LEVEL_HIGH>;
 			clock-frequency = <100000>;
 			status = "disabled";
 		};
@@ -594,7 +594,7 @@
 			reg = <0x660b0000 0x100>;
 			#address-cells = <1>;
 			#size-cells = <0>;
-			interrupts = <GIC_SPI 395 IRQ_TYPE_NONE>;
+			interrupts = <GIC_SPI 395 IRQ_TYPE_LEVEL_HIGH>;
 			clock-frequency = <100000>;
 			status = "disabled";
 		};
author maintainer
#43 lore raw

PATCH 42/324 arm64: dts: ns2: Fix PCIe controller interrupt type

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Ray Jui <[email protected]>

[ Upstream commit d0b8aed9e80ab526dbb04020bfc94ecea7bddb44 ]

Fix PCIe controller interrupt to use IRQ_TYPE_LEVEL_HIGH for Broadcom NS2 SoC.

Fixes fd5e5dd56a2f ("arm64: dts: Add PCIe0 and PCIe4 DT nodes for NS2")
---
 arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi +2 -2
@@ -118,7 +118,7 @@
 
 		#interrupt-cells = <1>;
 		interrupt-map-mask = <0 0 0 0>;
-		interrupt-map = <0 0 0 0 &gic 0 GIC_SPI 281 IRQ_TYPE_NONE>;
+		interrupt-map = <0 0 0 0 &gic 0 GIC_SPI 281 IRQ_TYPE_LEVEL_HIGH>;
 
 		linux,pci-domain = <0>;
 
@@ -149,7 +149,7 @@
 
 		#interrupt-cells = <1>;
 		interrupt-map-mask = <0 0 0 0>;
-		interrupt-map = <0 0 0 0 &gic 0 GIC_SPI 305 IRQ_TYPE_NONE>;
+		interrupt-map = <0 0 0 0 &gic 0 GIC_SPI 305 IRQ_TYPE_LEVEL_HIGH>;
 
 		linux,pci-domain = <4>;
 
author maintainer
#48 lore raw

PATCH 48/324 drm/mali-dp: Rectify the width and height passed to rotmem_required()

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Ayan Kumar Halder <[email protected]>

[ Upstream commit c6cf387ec56c19028333274747bbb4ae145a2d13 ]

The width and height needs to be swapped

---
 drivers/gpu/drm/arm/malidp_planes.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/arm/malidp_planes.c +2 -2
@@ -236,8 +236,8 @@ static int malidp_de_plane_check(struct
 	if (state->rotation & MALIDP_ROTATED_MASK) {
 		int val;
 
-		val = mp->hwdev->hw->rotmem_required(mp->hwdev, state->crtc_h,
-						     state->crtc_w,
+		val = mp->hwdev->hw->rotmem_required(mp->hwdev, state->crtc_w,
+						     state->crtc_h,
 						     fb->format->format);
 		if (val < 0)
 			return val;
author maintainer
#52 lore raw

PATCH 52/324 usb: dwc2: Fix host exit from hibernation flow.

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Artur Petrosyan <[email protected]>

[ Upstream commit 22bb5cfdf13ae70c6a34508a16cfeee48f162443 ]

In case when a hub is connected to DWC2 host
auto suspend occurs and host goes to
hibernation. When any device connected to hub
host hibernation exiting incorrectly.

- Added dwc2_hcd_rem_wakeup() function call to
exit from suspend state by remote wakeup.

- Increase timeout value for port suspend bit to be set.

---
 drivers/usb/dwc2/hcd.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/dwc2/hcd.c +3 -1
@@ -5437,7 +5437,7 @@ int dwc2_host_enter_hibernation(struct d
 	dwc2_writel(hprt0, hsotg->regs + HPRT0);
 
 	/* Wait for the HPRT0.PrtSusp register field to be set */
-	if (dwc2_hsotg_wait_bit_set(hsotg, HPRT0, HPRT0_SUSP, 300))
+	if (dwc2_hsotg_wait_bit_set(hsotg, HPRT0, HPRT0_SUSP, 3000))
 		dev_warn(hsotg->dev, "Suspend wasn't generated\n");
 
 	/*
@@ -5618,6 +5618,8 @@ int dwc2_host_exit_hibernation(struct dw
 		return ret;
 	}
 
+	dwc2_hcd_rem_wakeup(hsotg);
+
 	hsotg->hibernated = 0;
 	hsotg->bus_suspended = 0;
 	hsotg->lx_state = DWC2_L0;
author maintainer
#55 lore raw

PATCH 55/324 usb: gadget: composite: fix delayed_status race condition when set_interface

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Chunfeng Yun <[email protected]>

[ Upstream commit 980900d6318066b9f8314bfb87329a20fd0d1ca4 ]

It happens when enable debug log, if set_alt() returns USB_GADGET_DELAYED_STATUS and usb_composite_setup_continue() is called before increasing count of @delayed_status, so fix it by using spinlock of @cdev->lock.

---
 drivers/usb/gadget/composite.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/usb/gadget/composite.c +3 -0
@@ -1719,6 +1719,8 @@ composite_setup(struct usb_gadget *gadge
 		 */
 		if (w_value && !f->get_alt)
 			break;
+
+		spin_lock(&cdev->lock);
 		value = f->set_alt(f, w_index, w_value);
 		if (value == USB_GADGET_DELAYED_STATUS) {
 			DBG(cdev,
@@ -1728,6 +1730,7 @@ composite_setup(struct usb_gadget *gadge
 			DBG(cdev, "delayed_status count %d\n",
 					cdev->delayed_status);
 		}
+		spin_unlock(&cdev->lock);
 		break;
 	case USB_REQ_GET_INTERFACE:
 		if (ctrl->bRequestType != (USB_DIR_IN|USB_RECIP_INTERFACE))
author maintainer
#56 lore raw

PATCH 56/324 usb: gadget: dwc2: fix memory leak in gadget_init()

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Grigor Tovmasyan <[email protected]>

[ Upstream commit 9bb073a053f0464ea74a4d4c331fdb7da58568d6 ]

Freed allocated request for ep0 to prevent memory leak in case when dwc2_driver_probe() failed.

---
 drivers/usb/dwc2/gadget.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/dwc2/gadget.c +5 -2
@@ -4721,9 +4721,11 @@ int dwc2_gadget_init(struct dwc2_hsotg *
 	}
 
 	ret = usb_add_gadget_udc(dev, &hsotg->gadget);
-	if (ret)
+	if (ret) {
+		dwc2_hsotg_ep_free_request(&hsotg->eps_out[0]->ep,
+					   hsotg->ctrl_req);
 		return ret;
-
+	}
 	dwc2_hsotg_dump(hsotg);
 
 	return 0;
@@ -4736,6 +4738,7 @@ int dwc2_gadget_init(struct dwc2_hsotg *
 int dwc2_hsotg_remove(struct dwc2_hsotg *hsotg)
 {
 	usb_del_gadget_udc(&hsotg->gadget);
+	dwc2_hsotg_ep_free_request(&hsotg->eps_out[0]->ep, hsotg->ctrl_req);
 
 	return 0;
 }
author maintainer
#57 lore raw

PATCH 57/324 dwc2: gadget: Fix ISOC IN DDMA PID bitfield value calculation

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Minas Harutyunyan <[email protected]>

[ Upstream commit 1d8e5c00275825fc42aaa5597dab1d0b5b26bb64 ]

PID bitfield in descriptor should be set based on particular request length, not based on EP's mc value. PID value can't be set to 0 even request length is 0.

---
 drivers/usb/dwc2/gadget.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/usb/dwc2/gadget.c +6 -1
@@ -808,6 +808,7 @@ static int dwc2_gadget_fill_isoc_desc(st
 	u32 index;
 	u32 maxsize = 0;
 	u32 mask = 0;
+	u8 pid = 0;
 
 	maxsize = dwc2_gadget_get_desc_params(hs_ep, &mask);
 	if (len > maxsize) {
@@ -853,7 +854,11 @@ static int dwc2_gadget_fill_isoc_desc(st
 			 ((len << DEV_DMA_NBYTES_SHIFT) & mask));
 
 	if (hs_ep->dir_in) {
-		desc->status |= ((hs_ep->mc << DEV_DMA_ISOC_PID_SHIFT) &
+		if (len)
+			pid = DIV_ROUND_UP(len, hs_ep->ep.maxpacket);
+		else
+			pid = 1;
+		desc->status |= ((pid << DEV_DMA_ISOC_PID_SHIFT) &
 				 DEV_DMA_ISOC_PID_MASK) |
 				((len % hs_ep->ep.maxpacket) ?
 				 DEV_DMA_SHORT : 0) |
author maintainer
#64 lore raw

PATCH 64/324 arm64: make secondary_start_kernel() notrace

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Zhizhou Zhang <[email protected]>

[ Upstream commit b154886f7892499d0d3054026e19dfb9a731df61 ]

We can't call function trace hook before setup percpu offset. When entering secondary_start_kernel(), percpu offset has not been initialized. So this lead hotplug malfunction. Here is the flow to reproduce this bug:

echo 0 > /sys/devices/system/cpu/cpu1/online echo function > /sys/kernel/debug/tracing/current_tracer echo 1 > /sys/kernel/debug/tracing/tracing_on echo 1 > /sys/devices/system/cpu/cpu1/online

---
 arch/arm64/kernel/smp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/smp.c +1 -1
@@ -179,7 +179,7 @@ int __cpu_up(unsigned int cpu, struct ta
  * This is the secondary CPU boot entry.  We're using this CPUs
  * idle thread stack, but a set of temporary page tables.
  */
-asmlinkage void secondary_start_kernel(void)
+asmlinkage notrace void secondary_start_kernel(void)
 {
 	u64 mpidr = read_cpuid_mpidr() & MPIDR_HWID_BITMASK;
 	struct mm_struct *mm = &init_mm;
author maintainer
#65 lore raw

PATCH 65/324 qed: Fix possible memory leak in Rx error path handling.

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Sudarsana Reddy Kalluru <[email protected]>

[ Upstream commit 4f9de4df901fb84709fe3a864dfa4eaf35700f68 ]

Memory for packet buffers need to be freed in the error paths as there is no consumer (e.g., upper layer) for such packets and that memory will never get freed.
The issue was uncovered when port was attacked with flood of isatap packets, these are multicast packets hence were directed at all the PFs. For foce PF, this meant they were routed to the ll2 module which in turn drops such packets.

---
 drivers/net/ethernet/qlogic/qed/qed_ll2.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/net/ethernet/qlogic/qed/qed_ll2.c +9 -2
@@ -201,8 +201,9 @@ void qed_ll2b_complete_rx_packet(void *c
 
 	skb = build_skb(buffer->data, 0);
 	if (!skb) {
-		rc = -ENOMEM;
-		goto out_post;
+		DP_INFO(cdev, "Failed to build SKB\n");
+		kfree(buffer->data);
+		goto out_post1;
 	}
 
 	data->u.placement_offset += NET_SKB_PAD;
@@ -224,8 +225,14 @@ void qed_ll2b_complete_rx_packet(void *c
 		cdev->ll2->cbs->rx_cb(cdev->ll2->cb_cookie, skb,
 				      data->opaque_data_0,
 				      data->opaque_data_1);
+	} else {
+		DP_VERBOSE(p_hwfn, (NETIF_MSG_RX_STATUS | NETIF_MSG_PKTDATA |
+				    QED_MSG_LL2 | QED_MSG_STORAGE),
+			   "Dropping the packet\n");
+		kfree(buffer->data);
 	}
 
+out_post1:
 	/* Update Buffer information and update FW producer */
 	buffer->data = new_data;
 	buffer->phys_addr = new_phys_addr;
author maintainer
#67 lore raw

PATCH 67/324 qed: Do not advertise DCBX_LLD_MANAGED capability.

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Sudarsana Reddy Kalluru <[email protected]>

[ Upstream commit ff54d5cd9ec15546abc870452dd0b66eef4b4606 ]

Do not advertise DCBX_LLD_MANAGED capability i.e., do not allow external agent to manage the dcbx/lldp negotiation. MFW acts as lldp agent for qed* devices, and no other lldp agent is allowed to coexist with mfw.

Also updated a debug print, to not to display the redundant info.

---
 drivers/net/ethernet/qlogic/qed/qed_dcbx.c |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/net/ethernet/qlogic/qed/qed_dcbx.c +4 -7
@@ -255,9 +255,8 @@ qed_dcbx_get_app_protocol_type(struct qe
 		*type = DCBX_PROTOCOL_ROCE_V2;
 	} else {
 		*type = DCBX_MAX_PROTOCOL_TYPE;
-		DP_ERR(p_hwfn,
-		       "No action required, App TLV id = 0x%x app_prio_bitmap = 0x%x\n",
-		       id, app_prio_bitmap);
+		DP_ERR(p_hwfn, "No action required, App TLV entry = 0x%x\n",
+		       app_prio_bitmap);
 		return false;
 	}
 
@@ -1469,8 +1468,8 @@ static u8 qed_dcbnl_getcap(struct qed_de
 		*cap = 0x80;
 		break;
 	case DCB_CAP_ATTR_DCBX:
-		*cap = (DCB_CAP_DCBX_LLD_MANAGED | DCB_CAP_DCBX_VER_CEE |
-			DCB_CAP_DCBX_VER_IEEE | DCB_CAP_DCBX_STATIC);
+		*cap = (DCB_CAP_DCBX_VER_CEE | DCB_CAP_DCBX_VER_IEEE |
+			DCB_CAP_DCBX_STATIC);
 		break;
 	default:
 		*cap = false;
@@ -1538,8 +1537,6 @@ static u8 qed_dcbnl_getdcbx(struct qed_d
 	if (!dcbx_info)
 		return 0;
 
-	if (dcbx_info->operational.enabled)
-		mode |= DCB_CAP_DCBX_LLD_MANAGED;
 	if (dcbx_info->operational.ieee)
 		mode |= DCB_CAP_DCBX_VER_IEEE;
 	if (dcbx_info->operational.cee)
author maintainer
#68 lore raw

PATCH 68/324 enic: initialize enic->rfs_h.lock in enic_probe

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Govindarajulu Varadarajan <[email protected]>

[ Upstream commit 3256d29fc7aecdf99feb1cb9475ed2252769a8a7 ]

lockdep spotted that we are using rfs_h.lock in enic_get_rxnfc() without initializing. rfs_h.lock is initialized in enic_open(). But ethtool_ops can be called when interface is down.

Move enic_rfs_flw_tbl_init to enic_probe.

INFO: trying to register non-static key.
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.

CPU: 18 PID: 1189 Comm: ethtool Not tainted 4.17.0-rc7-devel+ #27
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-20171110_100015-anatol 04/01/2014
Call Trace:
dump_stack+0x85/0xc0
register_lock_class+0x550/0x560
? __handle_mm_fault+0xa8b/0x1100
__lock_acquire+0x81/0x670
lock_acquire+0xb9/0x1e0
?  enic_get_rxnfc+0x139/0x2b0 [enic]
_raw_spin_lock_bh+0x38/0x80
? enic_get_rxnfc+0x139/0x2b0 [enic]
enic_get_rxnfc+0x139/0x2b0 [enic]
ethtool_get_rxnfc+0x8d/0x1c0
dev_ethtool+0x16c8/0x2400
? __mutex_lock+0x64d/0xa00
? dev_load+0x6a/0x150
dev_ioctl+0x253/0x4b0
sock_do_ioctl+0x9a/0x130
sock_ioctl+0x1af/0x350
do_vfs_ioctl+0x8e/0x670
? syscall_trace_enter+0x1e2/0x380
ksys_ioctl+0x60/0x90
__x64_sys_ioctl+0x16/0x20
do_syscall_64+0x5a/0x170
entry_SYSCALL_64_after_hwframe+0x49/0xbe
---
 drivers/net/ethernet/cisco/enic/enic_clsf.c |    3 +--
 drivers/net/ethernet/cisco/enic/enic_main.c |    3 ++-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/cisco/enic/enic_clsf.c +1 -2
@@ -79,7 +79,6 @@ void enic_rfs_flw_tbl_init(struct enic *
 	enic->rfs_h.max = enic->config.num_arfs;
 	enic->rfs_h.free = enic->rfs_h.max;
 	enic->rfs_h.toclean = 0;
-	enic_rfs_timer_start(enic);
 }
 
 void enic_rfs_flw_tbl_free(struct enic *enic)
@@ -88,7 +87,6 @@ void enic_rfs_flw_tbl_free(struct enic *
 
 	enic_rfs_timer_stop(enic);
 	spin_lock_bh(&enic->rfs_h.lock);
-	enic->rfs_h.free = 0;
 	for (i = 0; i < (1 << ENIC_RFS_FLW_BITSHIFT); i++) {
 		struct hlist_head *hhead;
 		struct hlist_node *tmp;
@@ -99,6 +97,7 @@ void enic_rfs_flw_tbl_free(struct enic *
 			enic_delfltr(enic, n->fltr_id);
 			hlist_del(&n->node);
 			kfree(n);
+			enic->rfs_h.free++;
 		}
 	}
 	spin_unlock_bh(&enic->rfs_h.lock);
drivers/net/ethernet/cisco/enic/enic_main.c +2 -1
@@ -1971,7 +1971,7 @@ static int enic_open(struct net_device *
 		vnic_intr_unmask(&enic->intr[i]);
 
 	enic_notify_timer_start(enic);
-	enic_rfs_flw_tbl_init(enic);
+	enic_rfs_timer_start(enic);
 
 	return 0;
 
@@ -2895,6 +2895,7 @@ static int enic_probe(struct pci_dev *pd
 
 	timer_setup(&enic->notify_timer, enic_notify_timer, 0);
 
+	enic_rfs_flw_tbl_init(enic);
 	enic_set_rx_coal_setting(enic);
 	INIT_WORK(&enic->reset, enic_reset);
 	INIT_WORK(&enic->tx_hang_reset, enic_tx_hang_reset);
author maintainer
#69 lore raw

PATCH 69/324 net: hamradio: use eth_broadcast_addr

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Stefan Agner <[email protected]>

[ Upstream commit 4e8439aa34802deab11cee68b0ecb18f887fb153 ]

The array bpq_eth_addr is only used to get the size of an address, whereas the bcast_addr is used to set the broadcast address. This leads to a warning when using clang:
drivers/net/hamradio/bpqether.c:94:13: warning: variable 'bpq_eth_addr' is not
needed and will not be emitted [-Wunneeded-internal-declaration]

static char bpq_eth_addr[6];
            ^

Remove both variables and use the common eth_broadcast_addr to set the broadcast address.

---
 drivers/net/hamradio/bpqether.c |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/net/hamradio/bpqether.c +2 -6
@@ -89,10 +89,6 @@
 static const char banner[] __initconst = KERN_INFO \
 	"AX.25: bpqether driver version 004\n";
 
-static char bcast_addr[6]={0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
-
-static char bpq_eth_addr[6];
-
 static int bpq_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *);
 static int bpq_device_event(struct notifier_block *, unsigned long, void *);
 
@@ -515,8 +511,8 @@ static int bpq_new_device(struct net_dev
 	bpq->ethdev = edev;
 	bpq->axdev = ndev;
 
-	memcpy(bpq->dest_addr, bcast_addr, sizeof(bpq_eth_addr));
-	memcpy(bpq->acpt_addr, bcast_addr, sizeof(bpq_eth_addr));
+	eth_broadcast_addr(bpq->dest_addr);
+	eth_broadcast_addr(bpq->acpt_addr);
 
 	err = register_netdevice(ndev);
 	if (err)
author maintainer
#70 lore raw

PATCH 70/324 net: propagate dev_get_valid_name return code

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Li RongQing <[email protected]>

[ Upstream commit 7892bd081045222b9e4027fec279a28d6fe7aa66 ]

if dev_get_valid_name failed, propagate its return code

and remove the setting err to ENODEV, it will be set to 0 again before dev_change_net_namespace exits.

---
 net/core/dev.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/dev.c +2 -2
@@ -8608,7 +8608,8 @@ int dev_change_net_namespace(struct net_
 		/* We get here if we can't use the current device name */
 		if (!pat)
 			goto out;
-		if (dev_get_valid_name(net, dev, pat) < 0)
+		err = dev_get_valid_name(net, dev, pat);
+		if (err < 0)
 			goto out;
 	}
 
@@ -8620,7 +8621,6 @@ int dev_change_net_namespace(struct net_
 	dev_close(dev);
 
 	/* And unlink it from device chain */
-	err = -ENODEV;
 	unlist_netdevice(dev);
 
 	synchronize_net();
author maintainer
#71 lore raw

PATCH 71/324 net: stmmac: socfpga: add additional ocp reset line for Stratix10

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Dinh Nguyen <[email protected]>

[ Upstream commit bc8a2d9bcbf1ca548b1deb315d14e1da81945bea ]

The Stratix10 platform has an additional reset line, OCP(Open Core Protocol), that also needs to get deasserted for the stmmac ethernet controller to work. Thus we need to update the Kconfig to include ARCH_STRATIX10 in order to build dwmac-socfpga.

Also, remove the redundant check for the reset controller pointer. The reset driver already checks for the pointer and returns 0 if the pointer is NULL.

---
 drivers/net/ethernet/stmicro/stmmac/Kconfig         |    2 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c |   18 ++++++++++++++----
 2 files changed, 15 insertions(+), 5 deletions(-)
drivers/net/ethernet/stmicro/stmmac/Kconfig +1 -1
@@ -111,7 +111,7 @@ config DWMAC_ROCKCHIP
 config DWMAC_SOCFPGA
 	tristate "SOCFPGA dwmac support"
 	default ARCH_SOCFPGA
-	depends on OF && (ARCH_SOCFPGA || COMPILE_TEST)
+	depends on OF && (ARCH_SOCFPGA || ARCH_STRATIX10 || COMPILE_TEST)
 	select MFD_SYSCON
 	help
 	  Support for ethernet controller on Altera SOCFPGA
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +14 -4
@@ -55,6 +55,7 @@ struct socfpga_dwmac {
 	struct	device *dev;
 	struct regmap *sys_mgr_base_addr;
 	struct reset_control *stmmac_rst;
+	struct reset_control *stmmac_ocp_rst;
 	void __iomem *splitter_base;
 	bool f2h_ptp_ref_clk;
 	struct tse_pcs pcs;
@@ -262,8 +263,8 @@ static int socfpga_dwmac_set_phy_mode(st
 		val = SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII;
 
 	/* Assert reset to the enet controller before changing the phy mode */
-	if (dwmac->stmmac_rst)
-		reset_control_assert(dwmac->stmmac_rst);
+	reset_control_assert(dwmac->stmmac_ocp_rst);
+	reset_control_assert(dwmac->stmmac_rst);
 
 	regmap_read(sys_mgr_base_addr, reg_offset, &ctrl);
 	ctrl &= ~(SYSMGR_EMACGRP_CTRL_PHYSEL_MASK << reg_shift);
@@ -288,8 +289,8 @@ static int socfpga_dwmac_set_phy_mode(st
 	/* Deassert reset for the phy configuration to be sampled by
 	 * the enet controller, and operation to start in requested mode
 	 */
-	if (dwmac->stmmac_rst)
-		reset_control_deassert(dwmac->stmmac_rst);
+	reset_control_deassert(dwmac->stmmac_ocp_rst);
+	reset_control_deassert(dwmac->stmmac_rst);
 	if (phymode == PHY_INTERFACE_MODE_SGMII) {
 		if (tse_pcs_init(dwmac->pcs.tse_pcs_base, &dwmac->pcs) != 0) {
 			dev_err(dwmac->dev, "Unable to initialize TSE PCS");
@@ -324,6 +325,15 @@ static int socfpga_dwmac_probe(struct pl
 		goto err_remove_config_dt;
 	}
 
+	dwmac->stmmac_ocp_rst = devm_reset_control_get_optional(dev, "stmmaceth-ocp");
+	if (IS_ERR(dwmac->stmmac_ocp_rst)) {
+		ret = PTR_ERR(dwmac->stmmac_ocp_rst);
+		dev_err(dev, "error getting reset control of ocp %d\n", ret);
+		goto err_remove_config_dt;
+	}
+
+	reset_control_deassert(dwmac->stmmac_ocp_rst);
+
 	ret = socfpga_dwmac_parse_data(dwmac, dev);
 	if (ret) {
 		dev_err(dev, "Unable to parse OF data\n");
author maintainer
#73 lore raw

PATCH 73/324 nvme-rdma: Fix command completion race at error recovery

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Israel Rukshin <[email protected]>

[ Upstream commit c947657b15379505a9bba36a02005882b66abe57 ]

The race is between completing the request at error recovery work and rdma completions. If we cancel the request before getting the good rdma completion we get a NULL deref of the request MR at nvme_rdma_process_nvme_rsp().

When Canceling the request we return its mr to the mr pool (set mr to NULL) and also unmap its data. Canceling the requests while the rdma queues are active is not safe. Because rdma queues are active and we get good rdma completions that can use the mr pointer which may be NULL. Completing the request too soon may lead also to performing DMA to/from user buffers which might have been already unmapped.

The commit fixes the race by draining the QP before starting the abort commands mechanism.

---
 drivers/nvme/host/rdma.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/nvme/host/rdma.c +6 -2
@@ -734,7 +734,6 @@ out:
 static void nvme_rdma_destroy_admin_queue(struct nvme_rdma_ctrl *ctrl,
 		bool remove)
 {
-	nvme_rdma_stop_queue(&ctrl->queues[0]);
 	if (remove) {
 		blk_cleanup_queue(ctrl->ctrl.admin_q);
 		nvme_rdma_free_tagset(&ctrl->ctrl, ctrl->ctrl.admin_tagset);
@@ -819,7 +818,6 @@ out_free_queue:
 static void nvme_rdma_destroy_io_queues(struct nvme_rdma_ctrl *ctrl,
 		bool remove)
 {
-	nvme_rdma_stop_io_queues(ctrl);
 	if (remove) {
 		blk_cleanup_queue(ctrl->ctrl.connect_q);
 		nvme_rdma_free_tagset(&ctrl->ctrl, ctrl->ctrl.tagset);
@@ -949,6 +947,7 @@ static void nvme_rdma_reconnect_ctrl_wor
 	return;
 
 destroy_admin:
+	nvme_rdma_stop_queue(&ctrl->queues[0]);
 	nvme_rdma_destroy_admin_queue(ctrl, false);
 requeue:
 	dev_info(ctrl->ctrl.device, "Failed reconnect attempt %d\n",
@@ -965,12 +964,14 @@ static void nvme_rdma_error_recovery_wor
 
 	if (ctrl->ctrl.queue_count > 1) {
 		nvme_stop_queues(&ctrl->ctrl);
+		nvme_rdma_stop_io_queues(ctrl);
 		blk_mq_tagset_busy_iter(&ctrl->tag_set,
 					nvme_cancel_request, &ctrl->ctrl);
 		nvme_rdma_destroy_io_queues(ctrl, false);
 	}
 
 	blk_mq_quiesce_queue(ctrl->ctrl.admin_q);
+	nvme_rdma_stop_queue(&ctrl->queues[0]);
 	blk_mq_tagset_busy_iter(&ctrl->admin_tag_set,
 				nvme_cancel_request, &ctrl->ctrl);
 	nvme_rdma_destroy_admin_queue(ctrl, false);
@@ -1720,6 +1721,7 @@ static void nvme_rdma_shutdown_ctrl(stru
 {
 	if (ctrl->ctrl.queue_count > 1) {
 		nvme_stop_queues(&ctrl->ctrl);
+		nvme_rdma_stop_io_queues(ctrl);
 		blk_mq_tagset_busy_iter(&ctrl->tag_set,
 					nvme_cancel_request, &ctrl->ctrl);
 		nvme_rdma_destroy_io_queues(ctrl, shutdown);
@@ -1731,6 +1733,7 @@ static void nvme_rdma_shutdown_ctrl(stru
 		nvme_disable_ctrl(&ctrl->ctrl, ctrl->ctrl.cap);
 
 	blk_mq_quiesce_queue(ctrl->ctrl.admin_q);
+	nvme_rdma_stop_queue(&ctrl->queues[0]);
 	blk_mq_tagset_busy_iter(&ctrl->admin_tag_set,
 				nvme_cancel_request, &ctrl->ctrl);
 	blk_mq_unquiesce_queue(ctrl->ctrl.admin_q);
@@ -1996,6 +1999,7 @@ static struct nvme_ctrl *nvme_rdma_creat
 	return &ctrl->ctrl;
 
 out_remove_admin_queue:
+	nvme_rdma_stop_queue(&ctrl->queues[0]);
 	nvme_rdma_destroy_admin_queue(ctrl, true);
 out_uninit_ctrl:
 	nvme_uninit_ctrl(&ctrl->ctrl);
author maintainer
#74 lore raw

PATCH 74/324 nvmet: reset keep alive timer in controller enable

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Max Gurtuvoy <[email protected]>

[ Upstream commit d68a90e148f5a82aa67654c5012071e31c0e4baa ]

Controllers that are not yet enabled should not really enforce keep alive timeouts, but we still want to track a timeout and cleanup in case a host died before it enabled the controller. Hence, simply reset the keep alive timer when the controller is enabled.

---
 drivers/nvme/target/core.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/nvme/target/core.c +8 -0
@@ -624,6 +624,14 @@ static void nvmet_start_ctrl(struct nvme
 	}
 
 	ctrl->csts = NVME_CSTS_RDY;
+
+	/*
+	 * Controllers that are not yet enabled should not really enforce the
+	 * keep alive timeout, but we still want to track a timeout and cleanup
+	 * in case a host died before it enabled the controller.  Hence, simply
+	 * reset the keep alive timer when the controller is enabled.
+	 */
+	mod_delayed_work(system_wq, &ctrl->ka_work, ctrl->kato * HZ);
 }
 
 static void nvmet_clear_ctrl(struct nvmet_ctrl *ctrl)
author maintainer
#76 lore raw

PATCH 76/324 block: sed-opal: Fix a couple off by one bugs

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <[email protected]>

[ Upstream commit ce042c183bcb94eb2919e8036473a1fc203420f9 ]

resp->num is the number of tokens in resp->tok[]. It gets set in response_parse(). So if n == resp->num then we're reading beyond the end of the data.

---
 block/sed-opal.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
block/sed-opal.c +2 -2
@@ -877,7 +877,7 @@ static size_t response_get_string(const
 		return 0;
 	}
 
-	if (n > resp->num) {
+	if (n >= resp->num) {
 		pr_debug("Response has %d tokens. Can't access %d\n",
 			 resp->num, n);
 		return 0;
@@ -916,7 +916,7 @@ static u64 response_get_u64(const struct
 		return 0;
 	}
 
-	if (n > resp->num) {
+	if (n >= resp->num) {
 		pr_debug("Response has %d tokens. Can't access %d\n",
 			 resp->num, n);
 		return 0;
author maintainer
#80 lore raw

PATCH 80/324 net: davinci_emac: match the mdio device against its compatible if possible

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Bartosz Golaszewski <[email protected]>

[ Upstream commit ea0820bb771175c7d4192fc6f5b5c56b3c6d5239 ]

Device tree based systems without of_dev_auxdata will have the mdio device named differently than "davinci_mdio(.0)". In this case use the device's parent's compatible string for matching

---
 drivers/net/ethernet/ti/davinci_emac.c |    4 ++++
 1 file changed, 4 insertions(+)
drivers/net/ethernet/ti/davinci_emac.c +4 -0
@@ -1387,6 +1387,10 @@ static int emac_devioctl(struct net_devi
 
 static int match_first_device(struct device *dev, void *data)
 {
+	if (dev->parent && dev->parent->of_node)
+		return of_device_is_compatible(dev->parent->of_node,
+					       "ti,davinci_mdio");
+
 	return !strncmp(dev_name(dev), "davinci_mdio", 12);
 }
 
author maintainer
#81 lore raw

PATCH 81/324 sctp: fix erroneous inc of snmp SctpFragUsrMsgs

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Marcelo Ricardo Leitner <[email protected]>

[ Upstream commit fedb1bd3d274b33c432cb83c80c6b3cf54d509c8 ]

Currently it is incrementing SctpFragUsrMsgs when the user message size is of the exactly same size as the maximum fragment size, which is wrong.

The fix is to increment it only when user message is bigger than the maximum fragment size.

Fixes bfd2e4b8734d ("sctp: refactor sctp_datamsg_from_user")
---
 net/sctp/chunk.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/sctp/chunk.c +3 -1
@@ -247,7 +247,9 @@ struct sctp_datamsg *sctp_datamsg_from_u
 	/* Account for a different sized first fragment */
 	if (msg_len >= first_len) {
 		msg->can_delay = 0;
-		SCTP_INC_STATS(sock_net(asoc->base.sk), SCTP_MIB_FRAGUSRMSGS);
+		if (msg_len > first_len)
+			SCTP_INC_STATS(sock_net(asoc->base.sk),
+				       SCTP_MIB_FRAGUSRMSGS);
 	} else {
 		/* Which may be the only one... */
 		first_len = msg_len;
author maintainer
#82 lore raw

PATCH 82/324 KVM: arm/arm64: Drop resource size check for GICV window

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Ard Biesheuvel <[email protected]>

[ Upstream commit ba56bc3a0786992755e6804fbcbdc60ef6cfc24c ]

When booting a 64 KB pages kernel on a ACPI GICv3 system that implements support for v2 emulation, the following warning is produced

GICV size 0x2000 not a multiple of page size 0x10000

and support for v2 emulation is disabled, preventing GICv2 VMs from being able to run on such hosts.

The reason is that vgic_v3_probe() performs a sanity check on the size of the window (it should be a multiple of the page size), while the ACPI MADT parsing code hardcodes the size of the window to 8 KB. This makes sense, considering that ACPI does not bother to describe the size in the first place, under the assumption that platforms implementing ACPI will follow the architecture and not put anything else in the same 64 KB window.

So let's just drop the sanity check altogether, and assume that the window is at least 64 KB in size.

Fixes 909777324588 ("KVM: arm/arm64: vgic-new: vgic_init: implement kvm_vgic_hyp_init")
---
 virt/kvm/arm/vgic/vgic-v3.c |    5 -----
 1 file changed, 5 deletions(-)
virt/kvm/arm/vgic/vgic-v3.c +0 -5
@@ -552,11 +552,6 @@ int vgic_v3_probe(const struct gic_kvm_i
 		pr_warn("GICV physical address 0x%llx not page aligned\n",
 			(unsigned long long)info->vcpu.start);
 		kvm_vgic_global_state.vcpu_base = 0;
-	} else if (!PAGE_ALIGNED(resource_size(&info->vcpu))) {
-		pr_warn("GICV size 0x%llx not a multiple of page size 0x%lx\n",
-			(unsigned long long)resource_size(&info->vcpu),
-			PAGE_SIZE);
-		kvm_vgic_global_state.vcpu_base = 0;
 	} else {
 		kvm_vgic_global_state.vcpu_base = info->vcpu.start;
 		kvm_vgic_global_state.can_emulate_gicv2 = true;
author maintainer
#85 lore raw

PATCH 85/324 clk: sunxi-ng: replace lib-y with obj-y

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Masahiro Yamada <[email protected]>

[ Upstream commit 12f8c553a503d98b519cca650b188bf51ebdbdbf ]

We had commit 06e226c7fb23 ("clk: sunxi-ng: Move all clock types to a library") and commit 799c43415442 ("kbuild: thin archives make default for all archs") in the same development cycle, from different trees.

With migration to the thin archive, the entire drivers/clk/sunxi-ng/lib.a is linked to the vmlinux. This does not break build, but we do not get any size saving.

However, we do not need to go back to the individual Kconfig options. The default configuration pulls in all (or most) of the CCU parts anyway. Also, once we enable CONFIG_LD_DEAD_CODE_DATA_ELIMINATION, we can simply list all files with obj-y, and the linker will drop all unused functions by itself.

After the long discussion [1], people there agreed to fix this, but nobody sent a patch after all. I am doing it now.

I lifted up CONFIG_SUNXI_CCU to drivers/clk/Makefile because everything in drivers/clk/sunxi-ng/ depends on SUNXI_CCU.

[1] https://patchwork.kernel.org/patch/9796521/

---
 drivers/clk/Makefile          |    2 +-
 drivers/clk/sunxi-ng/Makefile |   39 +++++++++++++++------------------------
 2 files changed, 16 insertions(+), 25 deletions(-)
drivers/clk/Makefile +1 -1
@@ -94,7 +94,7 @@ obj-$(CONFIG_ARCH_SPRD)			+= sprd/
 obj-$(CONFIG_ARCH_STI)			+= st/
 obj-$(CONFIG_ARCH_STRATIX10)		+= socfpga/
 obj-$(CONFIG_ARCH_SUNXI)		+= sunxi/
-obj-$(CONFIG_ARCH_SUNXI)		+= sunxi-ng/
+obj-$(CONFIG_SUNXI_CCU)			+= sunxi-ng/
 obj-$(CONFIG_ARCH_TEGRA)		+= tegra/
 obj-y					+= ti/
 obj-$(CONFIG_CLK_UNIPHIER)		+= uniphier/
drivers/clk/sunxi-ng/Makefile +15 -24
@@ -1,24 +1,24 @@
 # SPDX-License-Identifier: GPL-2.0
 # Common objects
-lib-$(CONFIG_SUNXI_CCU)		+= ccu_common.o
-lib-$(CONFIG_SUNXI_CCU)		+= ccu_mmc_timing.o
-lib-$(CONFIG_SUNXI_CCU)		+= ccu_reset.o
+obj-y				+= ccu_common.o
+obj-y				+= ccu_mmc_timing.o
+obj-y				+= ccu_reset.o
 
 # Base clock types
-lib-$(CONFIG_SUNXI_CCU)		+= ccu_div.o
-lib-$(CONFIG_SUNXI_CCU)		+= ccu_frac.o
-lib-$(CONFIG_SUNXI_CCU)		+= ccu_gate.o
-lib-$(CONFIG_SUNXI_CCU)		+= ccu_mux.o
-lib-$(CONFIG_SUNXI_CCU)		+= ccu_mult.o
-lib-$(CONFIG_SUNXI_CCU)		+= ccu_phase.o
-lib-$(CONFIG_SUNXI_CCU)		+= ccu_sdm.o
+obj-y				+= ccu_div.o
+obj-y				+= ccu_frac.o
+obj-y				+= ccu_gate.o
+obj-y				+= ccu_mux.o
+obj-y				+= ccu_mult.o
+obj-y				+= ccu_phase.o
+obj-y				+= ccu_sdm.o
 
 # Multi-factor clocks
-lib-$(CONFIG_SUNXI_CCU)		+= ccu_nk.o
-lib-$(CONFIG_SUNXI_CCU)		+= ccu_nkm.o
-lib-$(CONFIG_SUNXI_CCU)		+= ccu_nkmp.o
-lib-$(CONFIG_SUNXI_CCU)		+= ccu_nm.o
-lib-$(CONFIG_SUNXI_CCU)		+= ccu_mp.o
+obj-y				+= ccu_nk.o
+obj-y				+= ccu_nkm.o
+obj-y				+= ccu_nkmp.o
+obj-y				+= ccu_nm.o
+obj-y				+= ccu_mp.o
 
 # SoC support
 obj-$(CONFIG_SUN50I_A64_CCU)	+= ccu-sun50i-a64.o
@@ -37,12 +37,3 @@ obj-$(CONFIG_SUN8I_R40_CCU)	+= ccu-sun8i
 obj-$(CONFIG_SUN9I_A80_CCU)	+= ccu-sun9i-a80.o
 obj-$(CONFIG_SUN9I_A80_CCU)	+= ccu-sun9i-a80-de.o
 obj-$(CONFIG_SUN9I_A80_CCU)	+= ccu-sun9i-a80-usb.o
-
-# The lib-y file goals is supposed to work only in arch/*/lib or lib/. In our
-# case, we want to use that goal, but even though lib.a will be properly
-# generated, it will not be linked in, eventually resulting in a linker error
-# for missing symbols.
-#
-# We can work around that by explicitly adding lib.a to the obj-y goal. This is
-# an undocumented behaviour, but works well for now.
-obj-$(CONFIG_SUNXI_CCU)		+= lib.a
author maintainer
#86 lore raw

PATCH 86/324 locking/lockdep: Do not record IRQ state within lockdep code

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: "Steven Rostedt (VMware)" <[email protected]>

[ Upstream commit fcc784be837714a9173b372ff9fb9b514590dad9 ]

While debugging where things were going wrong with mapping enabling/disabling interrupts with the lockdep state and actual real enabling and disabling interrupts, I had to silent the IRQ disabling/enabling in debug_check_no_locks_freed() because it was always showing up as it was called before the splat was.

Use raw_local_irq_save/restore() for not only debug_check_no_locks_freed() but for all internal lockdep functions, as they hide useful information about where interrupts were used incorrectly last.

---
 kernel/locking/lockdep.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
kernel/locking/lockdep.c +6 -6
@@ -1261,11 +1261,11 @@ unsigned long lockdep_count_forward_deps
 	this.parent = NULL;
 	this.class = class;
 
-	local_irq_save(flags);
+	raw_local_irq_save(flags);
 	arch_spin_lock(&lockdep_lock);
 	ret = __lockdep_count_forward_deps(&this);
 	arch_spin_unlock(&lockdep_lock);
-	local_irq_restore(flags);
+	raw_local_irq_restore(flags);
 
 	return ret;
 }
@@ -1288,11 +1288,11 @@ unsigned long lockdep_count_backward_dep
 	this.parent = NULL;
 	this.class = class;
 
-	local_irq_save(flags);
+	raw_local_irq_save(flags);
 	arch_spin_lock(&lockdep_lock);
 	ret = __lockdep_count_backward_deps(&this);
 	arch_spin_unlock(&lockdep_lock);
-	local_irq_restore(flags);
+	raw_local_irq_restore(flags);
 
 	return ret;
 }
@@ -4407,7 +4407,7 @@ void debug_check_no_locks_freed(const vo
 	if (unlikely(!debug_locks))
 		return;
 
-	local_irq_save(flags);
+	raw_local_irq_save(flags);
 	for (i = 0; i < curr->lockdep_depth; i++) {
 		hlock = curr->held_locks + i;
 
@@ -4418,7 +4418,7 @@ void debug_check_no_locks_freed(const vo
 		print_freed_lock_bug(curr, mem_from, mem_from + mem_len, hlock);
 		break;
 	}
-	local_irq_restore(flags);
+	raw_local_irq_restore(flags);
 }
 EXPORT_SYMBOL_GPL(debug_check_no_locks_freed);
 
author maintainer
#88 lore raw

PATCH 89/324 irqchip/gic-v2m: Fix SPI release on error path

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Marc Zyngier <[email protected]>

[ Upstream commit cbaf45a6be497c272e80500e4fd9bccdf20d5050 ]

On failing to allocate the required SPIs, the actual number of interrupts should be freed and not its log2 value.

Fixes de337ee30142 ("irqchip/gic-v2m: Add PCI Multi-MSI support")
Cc Jason Cooper <[email protected]>
Cc Alexandre Belloni <[email protected]>
Cc Yang Yingliang <[email protected]>
Cc Sumit Garg <[email protected]>
---
 drivers/irqchip/irq-gic-v2m.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-gic-v2m.c +1 -1
@@ -199,7 +199,7 @@ static int gicv2m_irq_domain_alloc(struc
 
 fail:
 	irq_domain_free_irqs_parent(domain, virq, nr_irqs);
-	gicv2m_unalloc_msi(v2m, hwirq, get_count_order(nr_irqs));
+	gicv2m_unalloc_msi(v2m, hwirq, nr_irqs);
 	return err;
 }
 
author maintainer
#89 lore raw

PATCH 90/324 irqchip/gic-v3-its: Fix reprogramming of redistributors on CPU hotplug

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Marc Zyngier <[email protected]>

[ Upstream commit 82f499c8811149069ec958b72a86643a7a289b25 ]

Enabling LPIs was made a lot stricter recently, by checking that they are disabled before enabling them. By doing so, the CPU hotplug case was missed altogether, which leaves LPIs enabled on hotplug off (expecting the CPU to eventually come back), and won't write a different value anyway on hotplug on.

So skip that check if that particular case is detected

Fixes 6eb486b66a30 ("irqchip/gic-v3: Ensure GICR_CTLR.EnableLPI=0 is observed before enabling")
Cc Jason Cooper <[email protected]>
Cc Alexandre Belloni <[email protected]>
Cc Yang Yingliang <[email protected]>
---
 drivers/irqchip/irq-gic-v3-its.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/irqchip/irq-gic-v3-its.c +10 -0
@@ -3405,6 +3405,16 @@ static int redist_disable_lpis(void)
 	u64 timeout = USEC_PER_SEC;
 	u64 val;
 
+	/*
+	 * If coming via a CPU hotplug event, we don't need to disable
+	 * LPIs before trying to re-enable them. They are already
+	 * configured and all is well in the world. Detect this case
+	 * by checking the allocation of the pending table for the
+	 * current CPU.
+	 */
+	if (gic_data_rdist()->pend_page)
+		return 0;
+
 	if (!gic_rdists_supports_plpis()) {
 		pr_info("CPU%d: LPIs not supported\n", smp_processor_id());
 		return -ENXIO;
author maintainer
#90 lore raw

PATCH 91/324 x86/microcode/intel: Fix memleak in save_microcode_patch()

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Zhenzhong Duan <[email protected]>

[ Upstream commit 0218c766263e70795c5eaa17d75ed54bca350950 ]

Free useless ucode_patch entry when it's replaced.

[ bp: Drop the memfree_patch() two-liner. ]

---
 arch/x86/kernel/cpu/microcode/intel.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/microcode/intel.c +4 -1
@@ -190,8 +190,11 @@ static void save_microcode_patch(void *d
 			p = memdup_patch(data, size);
 			if (!p)
 				pr_err("Error allocating buffer %p\n", data);
-			else
+			else {
 				list_replace(&iter->plist, &p->plist);
+				kfree(iter->data);
+				kfree(iter);
+			}
 		}
 	}
 
author maintainer
#91 lore raw

PATCH 92/324 ipv6: mcast: fix unsolicited report interval after receiving querys

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Hangbin Liu <[email protected]>

[ Upstream commit 6c6da92808442908287fae8ebb0ca041a52469f4 ]

After recieving MLD querys, we update idev->mc_maxdelay with max_delay from query header. This make the later unsolicited reports have the same interval with mc_maxdelay, which means we may send unsolicited reports with long interval time instead of default configured interval time.

Also as we will not call ipv6_mc_reset() after device up. This issue will be there even after leave the group and join other groups.

Fixes fc4eba58b4c14 ("ipv6: make unsolicited report intervals configurable for mld")
---
 net/ipv6/mcast.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
net/ipv6/mcast.c +6 -3
@@ -2081,7 +2081,8 @@ void ipv6_mc_dad_complete(struct inet6_d
 		mld_send_initial_cr(idev);
 		idev->mc_dad_count--;
 		if (idev->mc_dad_count)
-			mld_dad_start_timer(idev, idev->mc_maxdelay);
+			mld_dad_start_timer(idev,
+					    unsolicited_report_interval(idev));
 	}
 }
 
@@ -2093,7 +2094,8 @@ static void mld_dad_timer_expire(struct
 	if (idev->mc_dad_count) {
 		idev->mc_dad_count--;
 		if (idev->mc_dad_count)
-			mld_dad_start_timer(idev, idev->mc_maxdelay);
+			mld_dad_start_timer(idev,
+					    unsolicited_report_interval(idev));
 	}
 	in6_dev_put(idev);
 }
@@ -2451,7 +2453,8 @@ static void mld_ifc_timer_expire(struct
 	if (idev->mc_ifc_count) {
 		idev->mc_ifc_count--;
 		if (idev->mc_ifc_count)
-			mld_ifc_start_timer(idev, idev->mc_maxdelay);
+			mld_ifc_start_timer(idev,
+					    unsolicited_report_interval(idev));
 	}
 	in6_dev_put(idev);
 }
author maintainer
#92 lore raw

PATCH 93/324 Smack: Mark inode instant in smack_task_to_inode

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Casey Schaufler <[email protected]>

[ Upstream commit 7b4e88434c4e7982fb053c49657e1c8bbb8692d9 ]

Smack: Mark inode instant in smack_task_to_inode

/proc clean-up in commit 1bbc55131e59bd099fdc568d3aa0b42634dbd188 resulted in smack_task_to_inode() being called before smack_d_instantiate. This resulted in the smk_inode value being ignored, even while present for files in /proc/self. Marking the inode as instant here fixes that.

---
 security/smack/smack_lsm.c |    1 +
 1 file changed, 1 insertion(+)
security/smack/smack_lsm.c +1 -0
@@ -2296,6 +2296,7 @@ static void smack_task_to_inode(struct t
 	struct smack_known *skp = smk_of_task_struct(p);
 
 	isp->smk_inode = skp;
+	isp->smk_flags |= SMK_INODE_INSTANT;
 }
 
 /*
author maintainer
#93 lore raw

PATCH 94/324 arm64: dts: msm8916: fix Coresight ETF graph connections

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Rob Herring <[email protected]>

[ Upstream commit 6b4154a655a258c67bcfabbd4c3a06637e74ebcd ]

The ETF input should be connected to the funnel output, and the ETF output should be connected to the replicator input. The labels are wrong and these got swapped:

Warning (graph_endpoint): /soc/funnel@821000/ports/port@8/endpoint: graph connection to node '/soc/etf@825000/ports/port@1/endpoint' is not bidirectional Warning (graph_endpoint): /soc/replicator@824000/ports/port@2/endpoint: graph connection to node '/soc/etf@825000/ports/port@0/endpoint' is not bidirectional

Fixes 7c10da373698 ("arm64: dts: qcom: Add msm8916 CoreSight components")
Cc Ivan T. Ivanov <[email protected]>
Cc Mathieu Poirier <[email protected]>
Cc Andy Gross <[email protected]>
Cc David Brown <[email protected]>
---
 arch/arm64/boot/dts/qcom/msm8916.dtsi |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/msm8916.dtsi +2 -2
@@ -1191,14 +1191,14 @@
 
 				port@0 {
 					reg = <0>;
-					etf_out: endpoint {
+					etf_in: endpoint {
 						slave-mode;
 						remote-endpoint = <&funnel0_out>;
 					};
 				};
 				port@1 {
 					reg = <0>;
-					etf_in: endpoint {
+					etf_out: endpoint {
 						remote-endpoint = <&replicator_in>;
 					};
 				};
author maintainer
#96 lore raw

PATCH 97/324 batman-adv: Fix debugfs path for renamed hardif

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Sven Eckelmann <[email protected]>

[ Upstream commit 36dc621ceca1be3ec885aeade5fdafbbcc452a6d ]

batman-adv is creating special debugfs directories in the init net_namespace for each valid hard-interface (net_device). But it is possible to rename a net_device to a completely different name then the original one.

It can therefore happen that a user registers a new net_device which gets the name "wlan0" assigned by default. batman-adv is also adding a new directory under $debugfs/batman-adv/ with the name "wlan0".

The user then decides to rename this device to "wl_pri" and registers a different device. The kernel may now decide to use the name "wlan0" again for this new device. batman-adv will detect it as a valid net_device and tries to create a directory with the name "wlan0" under $debugfs/batman-adv/. But there already exists one with this name under this path and thus this fails. batman-adv will detect a problem and rollback the registering of this device.

batman-adv must therefore take care of renaming the debugfs directories for hard-interfaces whenever it detects such a net_device rename.

Fixes 5bc7c1eb44f2 ("batman-adv: add debugfs structure for information per interface")
---
 net/batman-adv/debugfs.c        |   20 ++++++++++++++++++++
 net/batman-adv/debugfs.h        |    6 ++++++
 net/batman-adv/hard-interface.c |    3 +++
 3 files changed, 29 insertions(+)
net/batman-adv/debugfs.c +20 -0
@@ -19,6 +19,7 @@
 #include "debugfs.h"
 #include "main.h"
 
+#include <linux/dcache.h>
 #include <linux/debugfs.h>
 #include <linux/err.h>
 #include <linux/errno.h>
@@ -344,6 +345,25 @@ out:
 }
 
 /**
+ * batadv_debugfs_rename_hardif() - Fix debugfs path for renamed hardif
+ * @hard_iface: hard interface which was renamed
+ */
+void batadv_debugfs_rename_hardif(struct batadv_hard_iface *hard_iface)
+{
+	const char *name = hard_iface->net_dev->name;
+	struct dentry *dir;
+	struct dentry *d;
+
+	dir = hard_iface->debug_dir;
+	if (!dir)
+		return;
+
+	d = debugfs_rename(dir->d_parent, dir, dir->d_parent, name);
+	if (!d)
+		pr_err("Can't rename debugfs dir to %s\n", name);
+}
+
+/**
  * batadv_debugfs_del_hardif() - delete the base directory for a hard interface
  *  in debugfs.
  * @hard_iface: hard interface which is deleted.
net/batman-adv/debugfs.h +6 -0
@@ -32,6 +32,7 @@ void batadv_debugfs_destroy(void);
 int batadv_debugfs_add_meshif(struct net_device *dev);
 void batadv_debugfs_del_meshif(struct net_device *dev);
 int batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface);
+void batadv_debugfs_rename_hardif(struct batadv_hard_iface *hard_iface);
 void batadv_debugfs_del_hardif(struct batadv_hard_iface *hard_iface);
 
 #else
@@ -60,6 +61,11 @@ int batadv_debugfs_add_hardif(struct bat
 }
 
 static inline
+void batadv_debugfs_rename_hardif(struct batadv_hard_iface *hard_iface)
+{
+}
+
+static inline
 void batadv_debugfs_del_hardif(struct batadv_hard_iface *hard_iface)
 {
 }
net/batman-adv/hard-interface.c +3 -0
@@ -1051,6 +1051,9 @@ static int batadv_hard_if_event(struct n
 		if (batadv_is_wifi_hardif(hard_iface))
 			hard_iface->num_bcasts = BATADV_NUM_BCASTS_WIRELESS;
 		break;
+	case NETDEV_CHANGENAME:
+		batadv_debugfs_rename_hardif(hard_iface);
+		break;
 	default:
 		break;
 	}
author maintainer
#97 lore raw

PATCH 98/324 batman-adv: Fix debugfs path for renamed softif

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Sven Eckelmann <[email protected]>

[ Upstream commit 6da7be7d24b2921f8215473ba7552796dff05fe1 ]

batman-adv is creating special debugfs directories in the init net_namespace for each created soft-interface (batadv net_device). But it is possible to rename a net_device to a completely different name then the original one.

It can therefore happen that a user registers a new batadv net_device with the name "bat0". batman-adv is then also adding a new directory under $debugfs/batman-adv/ with the name "wlan0".

The user then decides to rename this device to "bat1" and registers a different batadv device with the name "bat0". batman-adv will then try to create a directory with the name "bat0" under $debugfs/batman-adv/ again. But there already exists one with this name under this path and thus this fails. batman-adv will detect a problem and rollback the registering of this device.

batman-adv must therefore take care of renaming the debugfs directories for soft-interfaces whenever it detects such a net_device rename.

Fixes c6c8fea29769 ("net: Add batman-adv meshing protocol")
---
 net/batman-adv/debugfs.c        |   20 ++++++++++++++++++++
 net/batman-adv/debugfs.h        |    5 +++++
 net/batman-adv/hard-interface.c |   34 ++++++++++++++++++++++++++++------
 3 files changed, 53 insertions(+), 6 deletions(-)
net/batman-adv/debugfs.c +20 -0
@@ -434,6 +434,26 @@ out:
 }
 
 /**
+ * batadv_debugfs_rename_meshif() - Fix debugfs path for renamed softif
+ * @dev: net_device which was renamed
+ */
+void batadv_debugfs_rename_meshif(struct net_device *dev)
+{
+	struct batadv_priv *bat_priv = netdev_priv(dev);
+	const char *name = dev->name;
+	struct dentry *dir;
+	struct dentry *d;
+
+	dir = bat_priv->debug_dir;
+	if (!dir)
+		return;
+
+	d = debugfs_rename(dir->d_parent, dir, dir->d_parent, name);
+	if (!d)
+		pr_err("Can't rename debugfs dir to %s\n", name);
+}
+
+/**
  * batadv_debugfs_del_meshif() - Remove interface dependent debugfs entries
  * @dev: netdev struct of the soft interface
  */
net/batman-adv/debugfs.h +5 -0
@@ -30,6 +30,7 @@ struct net_device;
 void batadv_debugfs_init(void);
 void batadv_debugfs_destroy(void);
 int batadv_debugfs_add_meshif(struct net_device *dev);
+void batadv_debugfs_rename_meshif(struct net_device *dev);
 void batadv_debugfs_del_meshif(struct net_device *dev);
 int batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface);
 void batadv_debugfs_rename_hardif(struct batadv_hard_iface *hard_iface);
@@ -50,6 +51,10 @@ static inline int batadv_debugfs_add_mes
 	return 0;
 }
 
+static inline void batadv_debugfs_rename_meshif(struct net_device *dev)
+{
+}
+
 static inline void batadv_debugfs_del_meshif(struct net_device *dev)
 {
 }
net/batman-adv/hard-interface.c +28 -6
@@ -989,6 +989,32 @@ void batadv_hardif_remove_interfaces(voi
 	rtnl_unlock();
 }
 
+/**
+ * batadv_hard_if_event_softif() - Handle events for soft interfaces
+ * @event: NETDEV_* event to handle
+ * @net_dev: net_device which generated an event
+ *
+ * Return: NOTIFY_* result
+ */
+static int batadv_hard_if_event_softif(unsigned long event,
+				       struct net_device *net_dev)
+{
+	struct batadv_priv *bat_priv;
+
+	switch (event) {
+	case NETDEV_REGISTER:
+		batadv_sysfs_add_meshif(net_dev);
+		bat_priv = netdev_priv(net_dev);
+		batadv_softif_create_vlan(bat_priv, BATADV_NO_FLAGS);
+		break;
+	case NETDEV_CHANGENAME:
+		batadv_debugfs_rename_meshif(net_dev);
+		break;
+	}
+
+	return NOTIFY_DONE;
+}
+
 static int batadv_hard_if_event(struct notifier_block *this,
 				unsigned long event, void *ptr)
 {
@@ -997,12 +1023,8 @@ static int batadv_hard_if_event(struct n
 	struct batadv_hard_iface *primary_if = NULL;
 	struct batadv_priv *bat_priv;
 
-	if (batadv_softif_is_valid(net_dev) && event == NETDEV_REGISTER) {
-		batadv_sysfs_add_meshif(net_dev);
-		bat_priv = netdev_priv(net_dev);
-		batadv_softif_create_vlan(bat_priv, BATADV_NO_FLAGS);
-		return NOTIFY_DONE;
-	}
+	if (batadv_softif_is_valid(net_dev))
+		return batadv_hard_if_event_softif(event, net_dev);
 
 	hard_iface = batadv_hardif_get_by_netdev(net_dev);
 	if (!hard_iface && (event == NETDEV_REGISTER ||
author maintainer
#98 lore raw

PATCH 101/324 cxgb4: when disabling dcb set txq dcb priority to 0

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Ganesh Goudar <[email protected]>

[ Upstream commit 5ce36338a30f9814fc4824f9fe6c20cd83d872c7 ]

When we are disabling DCB, store "0" in txq->dcb_prio since that's used for future TX Work Request "OVLAN_IDX" values. Setting non zero priority upon disabling DCB would halt the traffic.

---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +1 -1
@@ -263,7 +263,7 @@ static void dcb_tx_queue_prio_enable(str
 				"Can't %s DCB Priority on port %d, TX Queue %d: err=%d\n",
 				enable ? "set" : "unset", pi->port_id, i, -err);
 		else
-			txq->dcb_prio = value;
+			txq->dcb_prio = enable ? value : 0;
 	}
 }
 
author maintainer
#99 lore raw

PATCH 102/324 iio: pressure: bmp280: fix relative humidity unit

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Tomasz Duszynski <[email protected]>

[ Upstream commit 13399ff25f179811ce9c1df1523eb39f9e4a4772 ]

According to IIO ABI relative humidity reading should be returned in milli percent.

This patch addresses that by applying proper scaling and returning integer instead of fractional format type specifier.

Note that the fixes tag is before the driver was heavily refactored to introduce spi support, so the patch won't apply that far back.

Fixes 14beaa8f5ab1 ("iio: pressure: bmp280: add humidity support")
---
 drivers/iio/pressure/bmp280-core.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/pressure/bmp280-core.c +2 -3
@@ -415,10 +415,9 @@ static int bmp280_read_humid(struct bmp2
 	}
 	comp_humidity = bmp280_compensate_humidity(data, adc_humidity);
 
-	*val = comp_humidity;
-	*val2 = 1024;
+	*val = comp_humidity * 1000 / 1024;
 
-	return IIO_VAL_FRACTIONAL;
+	return IIO_VAL_INT;
 }
 
 static int bmp280_read_raw(struct iio_dev *indio_dev,
author maintainer
#100 lore raw

PATCH 103/324 brcmfmac: stop watchdog before detach and free everything

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Michael Trimarchi <[email protected]>

[ Upstream commit 373c83a801f15b1e3d02d855fad89112bd4ccbe0 ]

Using built-in in kernel image without a firmware in filesystem or in the kernel image can lead to a kernel NULL pointer deference. Watchdog need to be stopped in brcmf_sdio_remove

The system is going down NOW!

[ 1348.110759] Unable to handle kernel NULL pointer dereference at virtual address 000002f8
Sent SIGTERM to all processes
[ 1348.121412] Mem abort info:
[ 1348.126962]   ESR = 0x96000004
[ 1348.130023]   Exception class = DABT (current EL), IL = 32 bits
[ 1348.135948]   SET = 0, FnV = 0
[ 1348.138997]   EA = 0, S1PTW = 0
[ 1348.142154] Data abort info:
[ 1348.145045]   ISV = 0, ISS = 0x00000004
[ 1348.148884]   CM = 0, WnR = 0
[ 1348.151861] user pgtable: 4k pages, 48-bit VAs, pgdp = (____ptrval____)
[ 1348.158475] [00000000000002f8] pgd=0000000000000000
[ 1348.163364] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[ 1348.168927] Modules linked in: ipv6
[ 1348.172421] CPU: 3 PID: 1421 Comm: brcmf_wdog/mmc0 Not tainted 4.17.0-rc5-next-20180517 #18
[ 1348.180757] Hardware name: Amarula A64-Relic (DT)
[ 1348.185455] pstate: 60000005 (nZCv daif -PAN -UAO)
[ 1348.190251] pc : brcmf_sdiod_freezer_count+0x0/0x20
[ 1348.195124] lr : brcmf_sdio_watchdog_thread+0x64/0x290
[ 1348.200253] sp : ffff00000b85be30
[ 1348.203561] x29: ffff00000b85be30 x28: 0000000000000000
[ 1348.208868] x27: ffff00000b6cb918 x26: ffff80003b990638
[ 1348.214176] x25: ffff0000087b1a20 x24: ffff80003b94f800
[ 1348.219483] x23: ffff000008e620c8 x22: ffff000008f0b660
[ 1348.224790] x21: ffff000008c6a858 x20: 00000000fffffe00
[ 1348.230097] x19: ffff80003b94f800 x18: 0000000000000001
[ 1348.235404] x17: 0000ffffab2e8a74 x16: ffff0000080d7de8
[ 1348.240711] x15: 0000000000000000 x14: 0000000000000400
[ 1348.246018] x13: 0000000000000400 x12: 0000000000000001
[ 1348.251324] x11: 00000000000002c4 x10: 0000000000000a10
[ 1348.256631] x9 : ffff00000b85bc40 x8 : ffff80003be11870
[ 1348.261937] x7 : ffff80003dfc7308 x6 : 000000078ff08b55
[ 1348.267243] x5 : 00000139e1058400 x4 : 0000000000000000
[ 1348.272550] x3 : dead000000000100 x2 : 958f2788d6618100
[ 1348.277856] x1 : 00000000fffffe00 x0 : 0000000000000000
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c |    7 +++++++
 1 file changed, 7 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +7 -0
@@ -4294,6 +4294,13 @@ void brcmf_sdio_remove(struct brcmf_sdio
 	brcmf_dbg(TRACE, "Enter\n");
 
 	if (bus) {
+		/* Stop watchdog task */
+		if (bus->watchdog_tsk) {
+			send_sig(SIGTERM, bus->watchdog_tsk, 1);
+			kthread_stop(bus->watchdog_tsk);
+			bus->watchdog_tsk = NULL;
+		}
+
 		/* De-register interrupt handler */
 		brcmf_sdiod_intr_unregister(bus->sdiodev);
 
author maintainer
#101 lore raw

PATCH 104/324 ipmi: kcs_bmc: fix IRQ exception if the channel is not open

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Haiyue Wang <[email protected]>

[ Upstream commit dc0f0a026d33819bb82d5c26ab2fca838e2004be ]

When kcs_bmc_handle_event calls kcs_force_abort function to handle the not open (no user running) KCS channel transaction, the returned status value -ENODEV causes the low level IRQ handler indicating that the irq was not for him by returning IRQ_NONE. After some time, this IRQ will be treated to be spurious one, and the exception dump happens.

irq 30: nobody cared (try booting with the "irqpoll" option)

   CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.10.15-npcm750 #1
   Hardware name: NPCMX50 Chip family
   [<c010b264>] (unwind_backtrace) from [<c0106930>] (show_stack+0x20/0x24)
   [<c0106930>] (show_stack) from [<c03dad38>] (dump_stack+0x8c/0xa0)
   [<c03dad38>] (dump_stack) from [<c0168810>] (__report_bad_irq+0x3c/0xdc)
   [<c0168810>] (__report_bad_irq) from [<c0168c34>] (note_interrupt+0x29c/0x2ec)
   [<c0168c34>] (note_interrupt) from [<c0165c80>] (handle_irq_event_percpu+0x5c/0x68)
   [<c0165c80>] (handle_irq_event_percpu) from [<c0165cd4>] (handle_irq_event+0x48/0x6c)
   [<c0165cd4>] (handle_irq_event) from [<c0169664>] (handle_fasteoi_irq+0xc8/0x198)
   [<c0169664>] (handle_fasteoi_irq) from [<c016529c>] (__handle_domain_irq+0x90/0xe8)
   [<c016529c>] (__handle_domain_irq) from [<c01014bc>] (gic_handle_irq+0x58/0x9c)
   [<c01014bc>] (gic_handle_irq) from [<c010752c>] (__irq_svc+0x6c/0x90)
   Exception stack(0xc0a01de8 to 0xc0a01e30)
   1de0:                   00002080 c0a6fbc0 00000000 00000000 00000000 c096d294
   1e00: 00000000 00000001 dc406400 f03ff100 00000082 c0a01e94 c0a6fbc0 c0a01e38
   1e20: 00200102 c01015bc 60000113 ffffffff
   [<c010752c>] (__irq_svc) from [<c01015bc>] (__do_softirq+0xbc/0x358)
   [<c01015bc>] (__do_softirq) from [<c011c798>] (irq_exit+0xb8/0xec)
   [<c011c798>] (irq_exit) from [<c01652a0>] (__handle_domain_irq+0x94/0xe8)
   [<c01652a0>] (__handle_domain_irq) from [<c01014bc>] (gic_handle_irq+0x58/0x9c)
   [<c01014bc>] (gic_handle_irq) from [<c010752c>] (__irq_svc+0x6c/0x90)
   Exception stack(0xc0a01ef8 to 0xc0a01f40)
   1ee0:                                                       00000000 000003ae
   1f00: dcc0f338 c0111060 c0a00000 c0a0cc44 c0a0cbe4 c0a1c22b c07bc218 00000001
   1f20: dcffca40 c0a01f54 c0a01f58 c0a01f48 c0103524 c0103528 60000013 ffffffff
   [<c010752c>] (__irq_svc) from [<c0103528>] (arch_cpu_idle+0x48/0x4c)
   [<c0103528>] (arch_cpu_idle) from [<c0681390>] (default_idle_call+0x30/0x3c)
   [<c0681390>] (default_idle_call) from [<c0156f24>] (do_idle+0xc8/0x134)
   [<c0156f24>] (do_idle) from [<c015722c>] (cpu_startup_entry+0x28/0x2c)
   [<c015722c>] (cpu_startup_entry) from [<c067ad74>] (rest_init+0x84/0x88)
   [<c067ad74>] (rest_init) from [<c0900d44>] (start_kernel+0x388/0x394)
   [<c0900d44>] (start_kernel) from [<0000807c>] (0x807c)
   handlers:
   [<c041c5dc>] npcm7xx_kcs_irq
   Disabling IRQ #30

It needs to change the returned status from -ENODEV to 0. The -ENODEV was originally used to tell the low level IRQ handler that no user was running, but not consider the IRQ handling desgin.

And multiple KCS channels share one IRQ handler, it needs to check the IBF flag before doing force abort. If the IBF is set, after handling, return 0 to low level IRQ handler to indicate that the IRQ is handled.

---
 drivers/char/ipmi/kcs_bmc.c |   31 ++++++++++---------------------
 1 file changed, 10 insertions(+), 21 deletions(-)
drivers/char/ipmi/kcs_bmc.c +10 -21
@@ -210,34 +210,23 @@ static void kcs_bmc_handle_cmd(struct kc
 int kcs_bmc_handle_event(struct kcs_bmc *kcs_bmc)
 {
 	unsigned long flags;
-	int ret = 0;
+	int ret = -ENODATA;
 	u8 status;
 
 	spin_lock_irqsave(&kcs_bmc->lock, flags);
 
-	if (!kcs_bmc->running) {
-		kcs_force_abort(kcs_bmc);
-		ret = -ENODEV;
-		goto out_unlock;
-	}
-
-	status = read_status(kcs_bmc) & (KCS_STATUS_IBF | KCS_STATUS_CMD_DAT);
-
-	switch (status) {
-	case KCS_STATUS_IBF | KCS_STATUS_CMD_DAT:
-		kcs_bmc_handle_cmd(kcs_bmc);
-		break;
-
-	case KCS_STATUS_IBF:
-		kcs_bmc_handle_data(kcs_bmc);
-		break;
+	status = read_status(kcs_bmc);
+	if (status & KCS_STATUS_IBF) {
+		if (!kcs_bmc->running)
+			kcs_force_abort(kcs_bmc);
+		else if (status & KCS_STATUS_CMD_DAT)
+			kcs_bmc_handle_cmd(kcs_bmc);
+		else
+			kcs_bmc_handle_data(kcs_bmc);
 
-	default:
-		ret = -ENODATA;
-		break;
+		ret = 0;
 	}
 
-out_unlock:
 	spin_unlock_irqrestore(&kcs_bmc->lock, flags);
 
 	return ret;
author maintainer
#104 lore raw

PATCH 107/324 nfp: bpf: dont stop offload if replace failed

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Jakub Kicinski <[email protected]>

[ Upstream commit 68d676a089625daed9d61df56ac63b5cd7189efe ]

Stopping offload completely if replace of program failed dates back to days of transparent offload. Back then we wanted to silently fall back to the in-driver processing. Today we mark programs for offload when they are loaded into the kernel, so the transparent offload is no longer a reality.

Flags check in the driver will only allow replace of a driver program with another driver program or an offload program with another offload program.

When driver program is replaced stopping offload is a no-op, because driver program isn't offloaded. When replacing offloaded program if the offload fails the entire operation will fail all the way back to user space and we should continue using the old program. IOW when replacing a driver program stopping offload is unnecessary and when replacing offloaded program - it's a bug, old program should continue to run.

In practice this bug would mean that if offload operation was to fail (either due to FW communication error, kernel OOM or new program being offloaded but for a different netdev) driver would continue reporting that previous XDP program is offloaded but in fact no program will be loaded in hardware. The failure is fairly unlikely (found by inspection, when working on the code) but it's unpleasant.

Backport note: even though the bug was introduced in commit cafa92ac2553 ("nfp: bpf: add support for XDP_FLAGS_HW_MODE"), this fix depends on commit 441a33031fe5 ("net: xdp: don't allow device-bound programs in driver mode"), so this fix is sufficient only in v4.15 or newer. Kernels v4.13.x and v4.14.x do need to stop offload if it was transparent/opportunistic, i.e. if XDP_FLAGS_HW_MODE was not set on running program.

Fixes cafa92ac2553 ("nfp: bpf: add support for XDP_FLAGS_HW_MODE")
---
 drivers/net/ethernet/netronome/nfp/bpf/main.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/netronome/nfp/bpf/main.c +3 -3
@@ -73,10 +73,10 @@ nfp_bpf_xdp_offload(struct nfp_app *app,
 
 	ret = nfp_net_bpf_offload(nn, prog, running, extack);
 	/* Stop offload if replace not possible */
-	if (ret && prog)
-		nfp_bpf_xdp_offload(app, nn, NULL, extack);
+	if (ret)
+		return ret;
 
-	nn->dp.bpf_offload_xdp = prog && !ret;
+	nn->dp.bpf_offload_xdp = !!prog;
 	return ret;
 }
 
author maintainer
#108 lore raw

PATCH 111/324 typec: tcpm: Fix a msecs vs jiffies bug

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <[email protected]>

[ Upstream commit 9578bcd0bb487b8ecef4b7eee799aafb678aa441 ]

The tcpm_set_state() function take msecs not jiffies.

Fixes f0690a25a140 ("staging: typec: USB Type-C Port Manager (tcpm)")
---
 drivers/usb/typec/tcpm.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/typec/tcpm.c +2 -1
@@ -2543,7 +2543,8 @@ static void run_state_machine(struct tcp
 		    tcpm_port_is_sink(port) &&
 		    time_is_after_jiffies(port->delayed_runtime)) {
 			tcpm_set_state(port, SNK_DISCOVERY,
-				       port->delayed_runtime - jiffies);
+				       jiffies_to_msecs(port->delayed_runtime -
+							jiffies));
 			break;
 		}
 		tcpm_set_state(port, unattached_state(port), 0);
author maintainer
#111 lore raw

PATCH 114/324 perf test session topology: Fix test on s390

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Thomas Richter <[email protected]>

[ Upstream commit b930e62ecd362843002bdf84c2940439822af321 ]

On s390 this test case fails because the socket identifiction numbers assigned to the CPU are higher than the CPU identification numbers.

F/ix this by adding the platform architecture into the perf data header flag information. This helps identifiing the test platform and handles s390 specifics in process_cpu_topology().

Before:

[root@p23lp27 perf]# perf test -vvvvv -F 39
39: Session topology :
--- start ---
templ file: /tmp/perf-test-iUv755
socket_id number is too big.You may need to upgrade the perf tool. ---- end ----
Session topology: Skip
[root@p23lp27 perf]#

After:

[root@p23lp27 perf]# perf test -vvvvv -F 39
39: Session topology :
--- start ---
templ file: /tmp/perf-test-8X8VTs
CPU 0, core 0, socket 6
CPU 1, core 1, socket 3
---- end ----
Session topology: Ok
[root@p23lp27 perf]#

---
 tools/perf/tests/topology.c |    1 +
 1 file changed, 1 insertion(+)
tools/perf/tests/topology.c +1 -0
@@ -45,6 +45,7 @@ static int session_write_header(char *pa
 
 	perf_header__set_feat(&session->header, HEADER_CPU_TOPOLOGY);
 	perf_header__set_feat(&session->header, HEADER_NRCPUS);
+	perf_header__set_feat(&session->header, HEADER_ARCH);
 
 	session->header.data_size += DATA_SIZE;
 
author maintainer
#112 lore raw

PATCH 115/324 perf report powerpc: Fix crash if callchain is empty

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Sandipan Das <[email protected]>

[ Upstream commit 143c99f6ac6812d23254e80844d6e34be897d3e1 ]

For some cases, the callchain provided by the kernel may be empty. So, the callchain ip filtering code will cause a crash if we do not check whether the struct ip_callchain pointer is NULL before accessing any members.

This can be observed on a powerpc64le system running Fedora 27 as shown below.

  # perf record -b -e cycles:u ls

Before:

  # perf report --branch-history

perf: Segmentation fault
-------- backtrace --------
perf[0x1027615c] linux-vdso64.so.1(__kernel_sigtramp_rt64+0x0)[0x7fff856304d8] perf(arch_skip_callchain_idx+0x44)[0x10257c58] perf[0x1017f2e4] perf(thread__resolve_callchain+0x124)[0x1017ff5c] perf(sample__resolve_callchain+0xf0)[0x10172788]
...

After:

  # perf report --branch-history

Samples: 25 of event 'cycles:u', Event count (approx.): 2306870

    Overhead  Source:Line            Symbol                   Shared Object
  +   11.60%  _init+35736            [.] _init                ls
  +    9.84%  strcoll_l.c:137        [.] __strcoll_l          libc-2.26.so
  +    9.16%  memcpy.S:175           [.] __memcpy_power7      libc-2.26.so
  +    9.01%  gconv_charset.h:54     [.] _nl_find_locale      libc-2.26.so
  +    8.87%  dl-addr.c:52           [.] _dl_addr             libc-2.26.so
  +    8.83%  _init+236              [.] _init                ls

...

---
 tools/perf/arch/powerpc/util/skip-callchain-idx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/arch/powerpc/util/skip-callchain-idx.c +1 -1
@@ -243,7 +243,7 @@ int arch_skip_callchain_idx(struct threa
 	u64 ip;
 	u64 skip_slot = -1;
 
-	if (chain->nr < 3)
+	if (!chain || chain->nr < 3)
 		return skip_slot;
 
 	ip = chain->ips[2];
author maintainer
#115 lore raw

PATCH 119/324 perf script: Fix crash because of missing evsel->priv

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Ravi Bangoria <[email protected]>

[ Upstream commit a3af66f51bd0bca72881ead4bf2bd19cb366582b ]

'perf script' in piped mode is crashing because evsel->priv is not set properly. Fix it.

Before:

  # perf record -o - -- ls | perf script
  <SNIP 'ls' output>
    Segmentation fault (core dumped)
  #

After:

  # perf record -o - -- ls | perf script
  <SNIP 'ls' output>
  ls 2282 1031.731974:  250000 cpu-clock:uhH:  7effe4b3d29e
  ls 2282 1031.732222:  250000 cpu-clock:uhH:  7effe4b3a650
  #
Cc Alexander Shishkin <[email protected]>
Cc Andi Kleen <[email protected]>
Cc David Ahern <[email protected]>
Cc David Carrillo-Cisneros <[email protected]>
Cc Jin Yao <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Fixes a14390fde64e ("perf script: Allow creating per-event dump files")
---
 tools/perf/builtin-script.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
tools/perf/builtin-script.c +14 -0
@@ -1832,6 +1832,7 @@ static int process_attr(struct perf_tool
 	struct perf_evlist *evlist;
 	struct perf_evsel *evsel, *pos;
 	int err;
+	static struct perf_evsel_script *es;
 
 	err = perf_event__process_attr(tool, event, pevlist);
 	if (err)
@@ -1840,6 +1841,19 @@ static int process_attr(struct perf_tool
 	evlist = *pevlist;
 	evsel = perf_evlist__last(*pevlist);
 
+	if (!evsel->priv) {
+		if (scr->per_event_dump) {
+			evsel->priv = perf_evsel_script__new(evsel,
+						scr->session->data);
+		} else {
+			es = zalloc(sizeof(*es));
+			if (!es)
+				return -ENOMEM;
+			es->fp = stdout;
+			evsel->priv = es;
+		}
+	}
+
 	if (evsel->attr.type >= PERF_TYPE_MAX &&
 	    evsel->attr.type != PERF_TYPE_SYNTH)
 		return 0;
author maintainer
#117 lore raw

PATCH 121/324 clk: davinci: cfgchip: testing the wrong variable

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <[email protected]>

[ Upstream commit 0613de37373bbbc747d434f643620472bd13303b ]

There is a copy and paste bug here. We should be testing "usb1" instead of "usb0".

Fixes 58e1e2d2cd89 ("clk: davinci: cfgchip: Add TI DA8XX USB PHY clocks")
---
 drivers/clk/davinci/da8xx-cfgchip.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/davinci/da8xx-cfgchip.c +1 -1
@@ -672,7 +672,7 @@ static int of_da8xx_usb_phy_clk_init(str
 
 	usb1 = da8xx_cfgchip_register_usb1_clk48(dev, regmap);
 	if (IS_ERR(usb1)) {
-		if (PTR_ERR(usb0) == -EPROBE_DEFER)
+		if (PTR_ERR(usb1) == -EPROBE_DEFER)
 			return -EPROBE_DEFER;
 
 		dev_warn(dev, "Failed to register usb1_clk48 (%ld)\n",
author maintainer
#118 lore raw

PATCH 122/324 usb: chipidea: host: fix disconnection detect issue

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Peter Chen <[email protected]>

[ Upstream commit 90f26cc6bb90b35040f4da0347f480ea9df6e2fc ]

The commit 4e88d4c08301 ("usb: add a flag to skip PHY initialization to struct usb_hcd") delete the assignment for hcd->usb_phy, it causes usb_phy_notify_connect{disconnect) are not called, the USB PHY driver is not notified of hot plug event, then the disconnection will not be detected by hardware.

Fixes 4e88d4c08301 ("usb: add a flag to skip PHY initialization

to struct usb_hcd")

---
 drivers/usb/chipidea/host.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/usb/chipidea/host.c +4 -1
@@ -124,8 +124,11 @@ static int host_start(struct ci_hdrc *ci
 
 	hcd->power_budget = ci->platdata->power_budget;
 	hcd->tpl_support = ci->platdata->tpl_support;
-	if (ci->phy || ci->usb_phy)
+	if (ci->phy || ci->usb_phy) {
 		hcd->skip_phy_initialization = 1;
+		if (ci->usb_phy)
+			hcd->usb_phy = ci->usb_phy;
+	}
 
 	ehci = hcd_to_ehci(hcd);
 	ehci->caps = ci->hw_bank.cap;
author maintainer
#120 lore raw

PATCH 124/324 netfilter: nf_log: fix uninit read in nf_log_proc_dostring

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Jann Horn <[email protected]>

[ Upstream commit dffd22aed2aa1e804bccf19b30a421e89ee2ae61 ]

When proc_dostring() is called with a non-zero offset in strict mode, it doesn't just write to the ->data buffer, it also reads. Make sure it doesn't read uninitialized data.

Fixes c6ac37d8d884 ("netfilter: nf_log: fix error on write NONE to [...]")
---
 net/netfilter/nf_log.c |    4 ++++
 1 file changed, 4 insertions(+)
net/netfilter/nf_log.c +4 -0
@@ -439,6 +439,10 @@ static int nf_log_proc_dostring(struct c
 	if (write) {
 		struct ctl_table tmp = *table;
 
+		/* proc_dostring() can append to existing strings, so we need to
+		 * initialize it as an empty string.
+		 */
+		buf[0] = '\0';
 		tmp.data = buf;
 		r = proc_dostring(&tmp, write, buffer, lenp, ppos);
 		if (r)
author maintainer
#121 lore raw

PATCH 125/324 ceph: fix dentry leak in splice_dentry()

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: "Yan, Zheng" <[email protected]>

[ Upstream commit 8b8f53af1ed9df88a4c0fbfdf3db58f62060edf3 ]

In any case, d_splice_alias() does not drop reference of original dentry.

---
 fs/ceph/inode.c |    1 +
 1 file changed, 1 insertion(+)
fs/ceph/inode.c +1 -0
@@ -1123,6 +1123,7 @@ static struct dentry *splice_dentry(stru
 	if (IS_ERR(realdn)) {
 		pr_err("splice_dentry error %ld %p inode %p ino %llx.%llx\n",
 		       PTR_ERR(realdn), dn, in, ceph_vinop(in));
+		dput(dn);
 		dn = realdn; /* note realdn contains the error */
 		goto out;
 	} else if (realdn) {
author maintainer
#124 lore raw

PATCH 128/324 nfp: cast sizeof() to int when comparing with error code

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Chengguang Xu <[email protected]>

[ Upstream commit 2d2595719a97c876f35b1e60e5768e58753b268c ]

sizeof() will return unsigned value so in the error check negative error code will be always larger than sizeof().

Fixes a0d8e02c35ff ("nfp: add support for reading nffw info")
---
 drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nffw.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nffw.c +1 -1
@@ -232,7 +232,7 @@ struct nfp_nffw_info *nfp_nffw_info_open
 	err = nfp_cpp_read(cpp, nfp_resource_cpp_id(state->res),
 			   nfp_resource_address(state->res),
 			   fwinf, sizeof(*fwinf));
-	if (err < sizeof(*fwinf))
+	if (err < (int)sizeof(*fwinf))
 		goto err_release;
 
 	if (!nffw_res_flg_init_get(fwinf))
author maintainer
#126 lore raw

PATCH 130/324 selftests/x86/sigreturn: Do minor cleanups

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Andy Lutomirski <[email protected]>

[ Upstream commit e8a445dea219c32727016af14f847d2e8f7ebec8 ]

We have short names for the requested and resulting register values. Use them instead of spelling out the whole register entry for each case.

---
 tools/testing/selftests/x86/sigreturn.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
tools/testing/selftests/x86/sigreturn.c +7 -6
@@ -610,6 +610,7 @@ static int test_valid_sigreturn(int cs_b
 	 */
 	for (int i = 0; i < NGREG; i++) {
 		greg_t req = requested_regs[i], res = resulting_regs[i];
+
 		if (i == REG_TRAPNO || i == REG_IP)
 			continue;	/* don't care */
 
@@ -673,18 +674,18 @@ static int test_valid_sigreturn(int cs_b
 #endif
 
 		/* Sanity check on the kernel */
-		if (i == REG_CX && requested_regs[i] != resulting_regs[i]) {
+		if (i == REG_CX && req != res) {
 			printf("[FAIL]\tCX (saved SP) mismatch: requested 0x%llx; got 0x%llx\n",
-			       (unsigned long long)requested_regs[i],
-			       (unsigned long long)resulting_regs[i]);
+			       (unsigned long long)req,
+			       (unsigned long long)res);
 			nerrs++;
 			continue;
 		}
 
-		if (requested_regs[i] != resulting_regs[i] && !ignore_reg) {
+		if (req != res && !ignore_reg) {
 			printf("[FAIL]\tReg %d mismatch: requested 0x%llx; got 0x%llx\n",
-			       i, (unsigned long long)requested_regs[i],
-			       (unsigned long long)resulting_regs[i]);
+			       i, (unsigned long long)req,
+			       (unsigned long long)res);
 			nerrs++;
 		}
 	}
author maintainer
#130 lore raw

PATCH 134/324 ARM64: dts: meson-axg: fix ethernet stability issue

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Jerome Brunet <[email protected]>

[ Upstream commit 6d28d577510f1a51f7ffbe830fdbf42077e0058b ]

Like the odroid-c2 and wetek, the s400 uses the RTL8211F and seems to suffer from the kind of stability issue.

Doing an iperf3 download test, we can see a significant number of LPI interrupts on the tx path. After a short while (5 to 15 seconds), the network connection dies. If using rootfs over NFS, the connection may also break during the boot sequence.

We still don't have a real explanation for this problem so let's disable EEE once again.

Fixes f6f6ac914b82 ("ARM64: dts: meson-axg: enable ethernet for A113D S400 board")
---
 arch/arm64/boot/dts/amlogic/meson-axg-s400.dts |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/amlogic/meson-axg-s400.dts +14 -1
@@ -19,9 +19,22 @@
 
 &ethmac {
 	status = "okay";
-	phy-mode = "rgmii";
 	pinctrl-0 = <&eth_rgmii_y_pins>;
 	pinctrl-names = "default";
+	phy-handle = <&eth_phy0>;
+	phy-mode = "rgmii";
+
+	mdio {
+		compatible = "snps,dwmac-mdio";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		eth_phy0: ethernet-phy@0 {
+			/* Realtek RTL8211F (0x001cc916) */
+			reg = <0>;
+			eee-broken-1000t;
+		};
+	};
 };
 
 &uart_A {
author maintainer
#131 lore raw

PATCH 135/324 ARM64: dts: meson-gxl: fix Mali GPU compatible string

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Martin Blumenstingl <[email protected]>

[ Upstream commit 1c38f4afd5d40234b67635b3c608a4093be04b96 ]

meson-gxl-mali.dtsi is only used on GXL SoCs. Thus it should use the GXL specific compatible string instead of the GXBB one.
For now this is purely cosmetic since the (out-of-tree) lima driver for this GPU currently uses the "arm,mali-450" match instead of the SoC specific one. However, update the .dts to match the documentation since this driver behavior might change in the future.

---
 arch/arm64/boot/dts/amlogic/meson-gxl-mali.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/amlogic/meson-gxl-mali.dtsi +1 -1
@@ -6,7 +6,7 @@
 
 &apb {
 	mali: gpu@c0000 {
-		compatible = "amlogic,meson-gxbb-mali", "arm,mali-450";
+		compatible = "amlogic,meson-gxl-mali", "arm,mali-450";
 		reg = <0x0 0xc0000 0x0 0x40000>;
 		interrupts = <GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>,
 			     <GIC_SPI 161 IRQ_TYPE_LEVEL_HIGH>,
author maintainer
#135 lore raw

PATCH 140/324 md/raid10: fix that replacement cannot complete recovery after reassemble

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: BingJing Chang <[email protected]>

[ Upstream commit bda3153998f3eb2cafa4a6311971143628eacdbc ]

During assemble, the spare marked for replacement is not checked. conf->fullsync cannot be updated to be 1. As a result, recovery will treat it as a clean array. All recovering sectors are skipped. Original device is replaced with the not-recovered spare.

mdadm -C /dev/md0 -l10 -n4 -pn2 /dev/loop[0123]
mdadm /dev/md0 -a /dev/loop4
mdadm /dev/md0 --replace /dev/loop0
mdadm -S /dev/md0 # stop array during recovery

mdadm -A /dev/md0 /dev/loop[01234]

After reassemble, you can see recovery go on, but it completes immediately. In fact, recovery is not actually processed.

To solve this problem, we just add the missing logics for replacment spares. (In raid1.c or raid5.c, they have already been checked.)

---
 drivers/md/raid10.c |    7 +++++++
 1 file changed, 7 insertions(+)
drivers/md/raid10.c +7 -0
@@ -3892,6 +3892,13 @@ static int raid10_run(struct mddev *mdde
 			    disk->rdev->saved_raid_disk < 0)
 				conf->fullsync = 1;
 		}
+
+		if (disk->replacement &&
+		    !test_bit(In_sync, &disk->replacement->flags) &&
+		    disk->replacement->saved_raid_disk < 0) {
+			conf->fullsync = 1;
+		}
+
 		disk->recovery_disabled = mddev->recovery_disabled - 1;
 	}
 
author maintainer
#136 lore raw

PATCH 141/324 dev-dax: check_vma: ratelimit dev_info-s

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Jeff Moyer <[email protected]>

[ Upstream commit 5a14e91d559aee5bdb0e002e1153fd9c4338a29e ]

This is easily triggered from userspace, so let's ratelimit the messages.

---
 drivers/dax/device.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/dax/device.c +8 -4
@@ -189,14 +189,16 @@ static int check_vma(struct dev_dax *dev
 
 	/* prevent private mappings from being established */
 	if ((vma->vm_flags & VM_MAYSHARE) != VM_MAYSHARE) {
-		dev_info(dev, "%s: %s: fail, attempted private mapping\n",
+		dev_info_ratelimited(dev,
+				"%s: %s: fail, attempted private mapping\n",
 				current->comm, func);
 		return -EINVAL;
 	}
 
 	mask = dax_region->align - 1;
 	if (vma->vm_start & mask || vma->vm_end & mask) {
-		dev_info(dev, "%s: %s: fail, unaligned vma (%#lx - %#lx, %#lx)\n",
+		dev_info_ratelimited(dev,
+				"%s: %s: fail, unaligned vma (%#lx - %#lx, %#lx)\n",
 				current->comm, func, vma->vm_start, vma->vm_end,
 				mask);
 		return -EINVAL;
@@ -204,13 +206,15 @@ static int check_vma(struct dev_dax *dev
 
 	if ((dax_region->pfn_flags & (PFN_DEV|PFN_MAP)) == PFN_DEV
 			&& (vma->vm_flags & VM_DONTCOPY) == 0) {
-		dev_info(dev, "%s: %s: fail, dax range requires MADV_DONTFORK\n",
+		dev_info_ratelimited(dev,
+				"%s: %s: fail, dax range requires MADV_DONTFORK\n",
 				current->comm, func);
 		return -EINVAL;
 	}
 
 	if (!vma_is_dax(vma)) {
-		dev_info(dev, "%s: %s: fail, vma is not DAX capable\n",
+		dev_info_ratelimited(dev,
+				"%s: %s: fail, vma is not DAX capable\n",
 				current->comm, func);
 		return -EINVAL;
 	}
author maintainer
#137 lore raw

PATCH 142/324 mac80211: disable BHs/preemption in ieee80211_tx_control_port()

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Denis Kenzior <[email protected]>

[ Upstream commit e7441c9274a6a5453e06f4c2b8b5f72eca0a3f17 ]

On pre-emption enabled kernels the following print was being seen due to missing local_bh_disable/local_bh_enable calls. mac80211 assumes that pre-emption is disabled in the data path.

    BUG: using smp_processor_id() in preemptible [00000000] code: iwd/517
    caller is __ieee80211_subif_start_xmit+0x144/0x210 [mac80211]
    [...]
    Call Trace:
    dump_stack+0x5c/0x80
    check_preemption_disabled.cold.0+0x46/0x51
    __ieee80211_subif_start_xmit+0x144/0x210 [mac80211]
Fixes 911806491425 ("mac80211: Add support for tx_control_port")
[commit message rewrite, fixes tag]
---
 net/mac80211/tx.c |    2 ++
 1 file changed, 2 insertions(+)
net/mac80211/tx.c +2 -0
@@ -4800,7 +4800,9 @@ int ieee80211_tx_control_port(struct wip
 	skb_reset_network_header(skb);
 	skb_reset_mac_header(skb);
 
+	local_bh_disable();
 	__ieee80211_subif_start_xmit(skb, skb->dev, flags);
+	local_bh_enable();
 
 	return 0;
 }
author maintainer
#138 lore raw

PATCH 143/324 nl80211: relax ht operation checks for mesh

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Bob Copeland <[email protected]>

[ Upstream commit 188f60ab8e787fcbb5ac9d64ede23a0070231f09 ]

Commit 9757235f451c, "nl80211: correct checks for NL80211_MESHCONF_HT_OPMODE value") relaxed the range for the HT operation field in meshconf, while also adding checks requiring the non-greenfield and non-ht-sta bits to be set in certain circumstances. The latter bit is actually reserved for mesh BSSes according to Table 9-168 in 802.11-2016, so in fact it should not be set.

wpa_supplicant sets these bits because the mesh and AP code share the same implementation, but authsae does not. As a result, some meshconf updates from authsae which set only the NONHT_MIXED protection bits were being rejected.

In order to avoid breaking userspace by changing the rules again, simply accept the values with or without the bits set, and mask off the reserved bit to match the spec.

While in here, update the 802.11-2012 reference to 802.11-2016.

Fixes 9757235f451c ("nl80211: correct checks for NL80211_MESHCONF_HT_OPMODE value")
Cc Masashi Honma <[email protected]>
---
 net/wireless/nl80211.c |   19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)
net/wireless/nl80211.c +3 -16
@@ -6061,7 +6061,7 @@ do {									    \
 				  nl80211_check_s32);
 	/*
 	 * Check HT operation mode based on
-	 * IEEE 802.11 2012 8.4.2.59 HT Operation element.
+	 * IEEE 802.11-2016 9.4.2.57 HT Operation element.
 	 */
 	if (tb[NL80211_MESHCONF_HT_OPMODE]) {
 		ht_opmode = nla_get_u16(tb[NL80211_MESHCONF_HT_OPMODE]);
@@ -6071,22 +6071,9 @@ do {									    \
 				  IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT))
 			return -EINVAL;
 
-		if ((ht_opmode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT) &&
-		    (ht_opmode & IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT))
-			return -EINVAL;
+		/* NON_HT_STA bit is reserved, but some programs set it */
+		ht_opmode &= ~IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT;
 
-		switch (ht_opmode & IEEE80211_HT_OP_MODE_PROTECTION) {
-		case IEEE80211_HT_OP_MODE_PROTECTION_NONE:
-		case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ:
-			if (ht_opmode & IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT)
-				return -EINVAL;
-			break;
-		case IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER:
-		case IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED:
-			if (!(ht_opmode & IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT))
-				return -EINVAL;
-			break;
-		}
 		cfg->ht_opmode = ht_opmode;
 		mask |= (1 << (NL80211_MESHCONF_HT_OPMODE - 1));
 	}
author maintainer
#139 lore raw

PATCH 144/324 nl80211: check nla_parse_nested() return values

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Johannes Berg <[email protected]>

[ Upstream commit 95bca62fb723a121954fc7ae5473bb2c1f0d5986 ]

At the very least we should check the return value if nla_parse_nested() is called with a non-NULL policy.

---
 net/wireless/nl80211.c |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
net/wireless/nl80211.c +11 -5
@@ -10703,9 +10703,12 @@ static int nl80211_set_wowlan(struct sk_
 				    rem) {
 			u8 *mask_pat;
 
-			nla_parse_nested(pat_tb, MAX_NL80211_PKTPAT, pat,
-					 nl80211_packet_pattern_policy,
-					 info->extack);
+			err = nla_parse_nested(pat_tb, MAX_NL80211_PKTPAT, pat,
+					       nl80211_packet_pattern_policy,
+					       info->extack);
+			if (err)
+				goto error;
+
 			err = -EINVAL;
 			if (!pat_tb[NL80211_PKTPAT_MASK] ||
 			    !pat_tb[NL80211_PKTPAT_PATTERN])
@@ -10954,8 +10957,11 @@ static int nl80211_parse_coalesce_rule(s
 			    rem) {
 		u8 *mask_pat;
 
-		nla_parse_nested(pat_tb, MAX_NL80211_PKTPAT, pat,
-				 nl80211_packet_pattern_policy, NULL);
+		err = nla_parse_nested(pat_tb, MAX_NL80211_PKTPAT, pat,
+				       nl80211_packet_pattern_policy, NULL);
+		if (err)
+			return err;
+
 		if (!pat_tb[NL80211_PKTPAT_MASK] ||
 		    !pat_tb[NL80211_PKTPAT_PATTERN])
 			return -EINVAL;
author maintainer
#140 lore raw

PATCH 145/324 drm/exynos: gsc: Fix support for NV16/61, YUV420/YVU420 and YUV422 modes

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Marek Szyprowski <[email protected]>

[ Upstream commit dd209ef809080ced903e7747ee3ef640c923a1d2 ]

Fix following issues related to planar YUV pixel format configuration:
- NV16/61 modes were incorrectly programmed as NV12/21,
- YVU420 was programmed as YUV420 on source,
- YVU420 and YUV422 were programmed as YUV420 on output.

---
 drivers/gpu/drm/exynos/exynos_drm_gsc.c |   29 ++++++++++++++++++++---------
 drivers/gpu/drm/exynos/regs-gsc.h       |    1 +
 2 files changed, 21 insertions(+), 9 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_gsc.c +20 -9
@@ -532,21 +532,25 @@ static int gsc_src_set_fmt(struct device
 			GSC_IN_CHROMA_ORDER_CRCB);
 		break;
 	case DRM_FORMAT_NV21:
+		cfg |= (GSC_IN_CHROMA_ORDER_CRCB | GSC_IN_YUV420_2P);
+		break;
 	case DRM_FORMAT_NV61:
-		cfg |= (GSC_IN_CHROMA_ORDER_CRCB |
-			GSC_IN_YUV420_2P);
+		cfg |= (GSC_IN_CHROMA_ORDER_CRCB | GSC_IN_YUV422_2P);
 		break;
 	case DRM_FORMAT_YUV422:
 		cfg |= GSC_IN_YUV422_3P;
 		break;
 	case DRM_FORMAT_YUV420:
+		cfg |= (GSC_IN_CHROMA_ORDER_CBCR | GSC_IN_YUV420_3P);
+		break;
 	case DRM_FORMAT_YVU420:
-		cfg |= GSC_IN_YUV420_3P;
+		cfg |= (GSC_IN_CHROMA_ORDER_CRCB | GSC_IN_YUV420_3P);
 		break;
 	case DRM_FORMAT_NV12:
+		cfg |= (GSC_IN_CHROMA_ORDER_CBCR | GSC_IN_YUV420_2P);
+		break;
 	case DRM_FORMAT_NV16:
-		cfg |= (GSC_IN_CHROMA_ORDER_CBCR |
-			GSC_IN_YUV420_2P);
+		cfg |= (GSC_IN_CHROMA_ORDER_CBCR | GSC_IN_YUV422_2P);
 		break;
 	default:
 		dev_err(ippdrv->dev, "invalid target yuv order 0x%x.\n", fmt);
@@ -806,18 +810,25 @@ static int gsc_dst_set_fmt(struct device
 			GSC_OUT_CHROMA_ORDER_CRCB);
 		break;
 	case DRM_FORMAT_NV21:
-	case DRM_FORMAT_NV61:
 		cfg |= (GSC_OUT_CHROMA_ORDER_CRCB | GSC_OUT_YUV420_2P);
 		break;
+	case DRM_FORMAT_NV61:
+		cfg |= (GSC_OUT_CHROMA_ORDER_CRCB | GSC_OUT_YUV422_2P);
+		break;
 	case DRM_FORMAT_YUV422:
+		cfg |= GSC_OUT_YUV422_3P;
+		break;
 	case DRM_FORMAT_YUV420:
+		cfg |= (GSC_OUT_CHROMA_ORDER_CBCR | GSC_OUT_YUV420_3P);
+		break;
 	case DRM_FORMAT_YVU420:
-		cfg |= GSC_OUT_YUV420_3P;
+		cfg |= (GSC_OUT_CHROMA_ORDER_CRCB | GSC_OUT_YUV420_3P);
 		break;
 	case DRM_FORMAT_NV12:
+		cfg |= (GSC_OUT_CHROMA_ORDER_CBCR | GSC_OUT_YUV420_2P);
+		break;
 	case DRM_FORMAT_NV16:
-		cfg |= (GSC_OUT_CHROMA_ORDER_CBCR |
-			GSC_OUT_YUV420_2P);
+		cfg |= (GSC_OUT_CHROMA_ORDER_CBCR | GSC_OUT_YUV422_2P);
 		break;
 	default:
 		dev_err(ippdrv->dev, "invalid target yuv order 0x%x.\n", fmt);
drivers/gpu/drm/exynos/regs-gsc.h +1 -0
@@ -138,6 +138,7 @@
 #define GSC_OUT_YUV420_3P		(3 << 4)
 #define GSC_OUT_YUV422_1P		(4 << 4)
 #define GSC_OUT_YUV422_2P		(5 << 4)
+#define GSC_OUT_YUV422_3P		(6 << 4)
 #define GSC_OUT_YUV444			(7 << 4)
 #define GSC_OUT_TILE_TYPE_MASK		(1 << 2)
 #define GSC_OUT_TILE_C_16x8		(0 << 2)
author maintainer
#143 lore raw

PATCH 148/324 blk-mq: dont queue more if we get a busy return

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Jens Axboe <[email protected]>

[ Upstream commit 1f57f8d442f8017587eeebd8617913bfc3661d3d ]

Some devices have different queue limits depending on the type of IO. A classic case is SATA NCQ, where some commands can queue, but others cannot. If we have NCQ commands inflight and encounter a non-queueable command, the driver returns busy. Currently we attempt to dispatch more from the scheduler, if we were able to queue some commands. But for the case where we ended up stopping due to BUSY, we should not attempt to retrieve more from the scheduler. If we do, we can get into a situation where we attempt to queue a non-queueable command, get BUSY, then successfully retrieve more commands from that scheduler and queue those. This can repeat forever, starving the non-queuable command indefinitely.

Fix this by NOT attempting to pull more commands from the scheduler, if we get a BUSY return. This should also be more optimal in terms of letting requests stay in the scheduler for as long as possible, if we get a BUSY due to the regular out-of-tags condition.

---
 block/blk-mq.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
block/blk-mq.c +12 -0
@@ -1174,6 +1174,9 @@ static bool blk_mq_mark_tag_wait(struct
 
 #define BLK_MQ_RESOURCE_DELAY	3		/* ms units */
 
+/*
+ * Returns true if we did some work AND can potentially do more.
+ */
 bool blk_mq_dispatch_rq_list(struct request_queue *q, struct list_head *list,
 			     bool got_budget)
 {
@@ -1304,8 +1307,17 @@ bool blk_mq_dispatch_rq_list(struct requ
 			blk_mq_run_hw_queue(hctx, true);
 		else if (needs_restart && (ret == BLK_STS_RESOURCE))
 			blk_mq_delay_run_hw_queue(hctx, BLK_MQ_RESOURCE_DELAY);
+
+		return false;
 	}
 
+	/*
+	 * If the host/device is unable to accept more work, inform the
+	 * caller of that.
+	 */
+	if (ret == BLK_STS_RESOURCE || ret == BLK_STS_DEV_RESOURCE)
+		return false;
+
 	return (queued + errors) != 0;
 }
 
author maintainer
#144 lore raw

PATCH 149/324 drbd: Fix drbd_request_prepare() discard handling

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Bart Van Assche <[email protected]>

[ Upstream commit fad2d4ef636654e926d374ef038f4cd4286661f6 ]

Fix the test that verifies whether bio_op(bio) represents a discard or write zeroes operation. Compile-tested only.

Cc Philipp Reisner <[email protected]>
Cc Lars Ellenberg <[email protected]>
Fixes 7435e9018f91 ("drbd: zero-out partial unaligned discards on local backend")
---
 drivers/block/drbd/drbd_req.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/block/drbd/drbd_req.c +2 -2
@@ -1244,8 +1244,8 @@ drbd_request_prepare(struct drbd_device
 	_drbd_start_io_acct(device, req);
 
 	/* process discards always from our submitter thread */
-	if ((bio_op(bio) & REQ_OP_WRITE_ZEROES) ||
-	    (bio_op(bio) & REQ_OP_DISCARD))
+	if (bio_op(bio) == REQ_OP_WRITE_ZEROES ||
+	    bio_op(bio) == REQ_OP_DISCARD)
 		goto queue_for_submitter_thread;
 
 	if (rw == WRITE && req->private_bio && req->i.size
author maintainer
#147 lore raw

PATCH 152/324 PCI: xilinx-nwl: Add missing of_node_put()

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Nicholas Mc Guire <[email protected]>

[ Upstream commit 342639d996f18bc0a4db2f42a84230c0a966dc94 ]

The call to of_get_next_child() returns a node pointer with refcount incremented thus it must be explicitly decremented here after the last usage.

Fixes ab597d35ef11 ("PCI: xilinx-nwl: Add support for Xilinx NWL PCIe Host Controller")
[[email protected]: updated commit log]
---
 drivers/pci/host/pcie-xilinx-nwl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/host/pcie-xilinx-nwl.c +1 -1
@@ -557,7 +557,7 @@ static int nwl_pcie_init_irq_domain(stru
 							PCI_NUM_INTX,
 							&legacy_domain_ops,
 							pcie);
-
+	of_node_put(legacy_intc_node);
 	if (!pcie->legacy_irq_domain) {
 		dev_err(dev, "failed to create IRQ domain\n");
 		return -ENOMEM;
author maintainer
#150 lore raw

PATCH 155/324 fsl/fman: fix parser reporting bad checksum on short frames

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Madalin Bucur <[email protected]>

[ Upstream commit b95f6fbc8e15803a596ca5e5e21008fba29694c6 ]

The FMan hardware parser needs to be configured to remove the short frame padding from the checksum calculation, otherwise short UDP and TCP frames are likely to be marked as having a bad checksum.

---
 drivers/net/ethernet/freescale/fman/fman_port.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/ethernet/freescale/fman/fman_port.c +8 -0
@@ -324,6 +324,10 @@ struct fman_port_qmi_regs {
 #define HWP_HXS_PHE_REPORT 0x00000800
 #define HWP_HXS_PCAC_PSTAT 0x00000100
 #define HWP_HXS_PCAC_PSTOP 0x00000001
+#define HWP_HXS_TCP_OFFSET 0xA
+#define HWP_HXS_UDP_OFFSET 0xB
+#define HWP_HXS_SH_PAD_REM 0x80000000
+
 struct fman_port_hwp_regs {
 	struct {
 		u32 ssa; /* Soft Sequence Attachment */
@@ -728,6 +732,10 @@ static void init_hwp(struct fman_port *p
 		iowrite32be(0xffffffff, &regs->pmda[i].lcv);
 	}
 
+	/* Short packet padding removal from checksum calculation */
+	iowrite32be(HWP_HXS_SH_PAD_REM, &regs->pmda[HWP_HXS_TCP_OFFSET].ssa);
+	iowrite32be(HWP_HXS_SH_PAD_REM, &regs->pmda[HWP_HXS_UDP_OFFSET].ssa);
+
 	start_port_hwp(port);
 }
 
author maintainer
#153 lore raw

PATCH 158/324 acpi/nfit: fix cmd_rc for acpi_nfit_ctl to always return a value

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Dave Jiang <[email protected]>

[ Upstream commit c1985cefd844e26bd19673a6df8d8f0b1918c2db ]

cmd_rc is passed in by reference to the acpi_nfit_ctl() function and the caller expects a value returned. However, when the package is pass through via the ND_CMD_CALL command, cmd_rc is not touched. Make sure cmd_rc is always set.

Fixes aef253382266 ("libnvdimm, nfit: centralize command status translation")
---
 drivers/acpi/nfit/core.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/acpi/nfit/core.c +2 -0
@@ -408,6 +408,7 @@ int acpi_nfit_ctl(struct nvdimm_bus_desc
 	const guid_t *guid;
 	int rc, i;
 
+	*cmd_rc = -EINVAL;
 	func = cmd;
 	if (cmd == ND_CMD_CALL) {
 		call_pkg = buf;
@@ -518,6 +519,7 @@ int acpi_nfit_ctl(struct nvdimm_bus_desc
 		 * If we return an error (like elsewhere) then caller wouldn't
 		 * be able to rely upon data returned to make calculation.
 		 */
+		*cmd_rc = 0;
 		return 0;
 	}
 
author maintainer
#158 lore raw

PATCH 164/324 ipvlan: call dev_change_flags when ipvlan mode is reset

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Hangbin Liu <[email protected]>

[ Upstream commit 5dc2d3996a8b221c20dd0900bdad45031a572530 ]

After we change the ipvlan mode from l3 to l2, or vice versa, we only reset IFF_NOARP flag, but don't flush the ARP table cache, which will cause eth->h_dest to be equal to eth->h_source in ipvlan_xmit_mode_l2(). Then the message will not come out of host.

Here is the reproducer on local host:

ip link set eth1 up
ip addr add 192.168.1.1/24 dev eth1
ip link add link eth1 ipvlan1 type ipvlan mode l3

ip netns add net1
ip link set ipvlan1 netns net1
ip netns exec net1 ip link set ipvlan1 up
ip netns exec net1 ip addr add 192.168.2.1/24 dev ipvlan1

ip route add 192.168.2.0/24 via 192.168.1.2
ping 192.168.2.2 -c 2

ip netns exec net1 ip link set ipvlan1 type ipvlan mode l2 ping 192.168.2.2 -c 2

Add the same configuration on remote host. After we set the mode to l2, we could find that the src/dst MAC addresses are the same on eth1:

21:26:06.648565 00:b7:13:ad:d3:05 > 00:b7:13:ad:d3:05, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 64, id 58356, offset 0, flags [DF], proto ICMP (1), length 84)

    192.168.2.1 > 192.168.2.2: ICMP echo request, id 22686, seq 1, length 64

Fix this by calling dev_change_flags(), which will call netdevice notifier with flag change info.

v2:
a) As pointed out by Wang Cong, check return value for dev_change_flags() when change dev flags.
b) As suggested by Stefano and Sabrina, move flags setting before l3mdev_ops. So we don't need to redo ipvlan_{, un}register_nf_hook() again in err path.

Fixes 2ad7bf3638411 ("ipvlan: Initial check-in of the IPVLAN driver.")
---
 drivers/net/ipvlan/ipvlan_main.c |   36 ++++++++++++++++++++++++++++--------
 1 file changed, 28 insertions(+), 8 deletions(-)
drivers/net/ipvlan/ipvlan_main.c +28 -8
@@ -75,10 +75,23 @@ static int ipvlan_set_port_mode(struct i
 {
 	struct ipvl_dev *ipvlan;
 	struct net_device *mdev = port->dev;
-	int err = 0;
+	unsigned int flags;
+	int err;
 
 	ASSERT_RTNL();
 	if (port->mode != nval) {
+		list_for_each_entry(ipvlan, &port->ipvlans, pnode) {
+			flags = ipvlan->dev->flags;
+			if (nval == IPVLAN_MODE_L3 || nval == IPVLAN_MODE_L3S) {
+				err = dev_change_flags(ipvlan->dev,
+						       flags | IFF_NOARP);
+			} else {
+				err = dev_change_flags(ipvlan->dev,
+						       flags & ~IFF_NOARP);
+			}
+			if (unlikely(err))
+				goto fail;
+		}
 		if (nval == IPVLAN_MODE_L3S) {
 			/* New mode is L3S */
 			err = ipvlan_register_nf_hook(read_pnet(&port->pnet));
@@ -86,21 +99,28 @@ static int ipvlan_set_port_mode(struct i
 				mdev->l3mdev_ops = &ipvl_l3mdev_ops;
 				mdev->priv_flags |= IFF_L3MDEV_MASTER;
 			} else
-				return err;
+				goto fail;
 		} else if (port->mode == IPVLAN_MODE_L3S) {
 			/* Old mode was L3S */
 			mdev->priv_flags &= ~IFF_L3MDEV_MASTER;
 			ipvlan_unregister_nf_hook(read_pnet(&port->pnet));
 			mdev->l3mdev_ops = NULL;
 		}
-		list_for_each_entry(ipvlan, &port->ipvlans, pnode) {
-			if (nval == IPVLAN_MODE_L3 || nval == IPVLAN_MODE_L3S)
-				ipvlan->dev->flags |= IFF_NOARP;
-			else
-				ipvlan->dev->flags &= ~IFF_NOARP;
-		}
 		port->mode = nval;
 	}
+	return 0;
+
+fail:
+	/* Undo the flags changes that have been done so far. */
+	list_for_each_entry_continue_reverse(ipvlan, &port->ipvlans, pnode) {
+		flags = ipvlan->dev->flags;
+		if (port->mode == IPVLAN_MODE_L3 ||
+		    port->mode == IPVLAN_MODE_L3S)
+			dev_change_flags(ipvlan->dev, flags | IFF_NOARP);
+		else
+			dev_change_flags(ipvlan->dev, flags & ~IFF_NOARP);
+	}
+
 	return err;
 }
 
author maintainer
#160 lore raw

PATCH 166/324 drm/amdgpu: fix swapped emit_ib_size in vce3

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Alex Deucher <[email protected]>

[ Upstream commit 0859df22ab7cfb3ad2df2caed76cadce6ac33a80 ]

The phys and vm versions had the values swapped.

---
 drivers/gpu/drm/amd/amdgpu/vce_v3_0.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +2 -2
@@ -899,7 +899,7 @@ static const struct amdgpu_ring_funcs vc
 	.emit_frame_size =
 		4 + /* vce_v3_0_emit_pipeline_sync */
 		6, /* amdgpu_vce_ring_emit_fence x1 no user fence */
-	.emit_ib_size = 5, /* vce_v3_0_ring_emit_ib */
+	.emit_ib_size = 4, /* amdgpu_vce_ring_emit_ib */
 	.emit_ib = amdgpu_vce_ring_emit_ib,
 	.emit_fence = amdgpu_vce_ring_emit_fence,
 	.test_ring = amdgpu_vce_ring_test_ring,
@@ -923,7 +923,7 @@ static const struct amdgpu_ring_funcs vc
 		6 + /* vce_v3_0_emit_vm_flush */
 		4 + /* vce_v3_0_emit_pipeline_sync */
 		6 + 6, /* amdgpu_vce_ring_emit_fence x2 vm fence */
-	.emit_ib_size = 4, /* amdgpu_vce_ring_emit_ib */
+	.emit_ib_size = 5, /* vce_v3_0_ring_emit_ib */
 	.emit_ib = vce_v3_0_ring_emit_ib,
 	.emit_vm_flush = vce_v3_0_emit_vm_flush,
 	.emit_pipeline_sync = vce_v3_0_emit_pipeline_sync,
author maintainer
#161 lore raw

PATCH 167/324 nds32: Fix the dts pointer is not passed correctly issue.

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Greentime Hu <[email protected]>

[ Upstream commit 6897e6ecb3167598cb45e1a1424dd4d5e3778837 ]

We found that the original implementation will only use the built-in dtb pointer instead of the pointer pass from bootloader. This bug is fixed by this patch.

---
 arch/nds32/kernel/setup.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/nds32/kernel/setup.c +2 -1
@@ -278,7 +278,8 @@ static void __init setup_memory(void)
 
 void __init setup_arch(char **cmdline_p)
 {
-	early_init_devtree( __dtb_start);
+	early_init_devtree(__atags_pointer ? \
+		phys_to_virt(__atags_pointer) : __dtb_start);
 
 	setup_cpuinfo();
 
author maintainer
#166 lore raw

PATCH 172/324 x86/mm/32: Initialize the CR4 shadow before __flush_tlb_all()

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Zhenzhong Duan <[email protected]>

[ Upstream commit 4fb5f58e8d191f7c81637ad81284e4848afb4244 ]

On 32-bit kernels, __flush_tlb_all() may have read the CR4 shadow before the initialization of CR4 shadow in cpu_init().

Fix it by adding an explicit cr4_init_shadow() call into start_secondary() which is the first function called on non-boot SMP CPUs - ahead of the __flush_tlb_all() call.

( This is somewhat of a layering violation, but start_secondary() does
CR4 bootstrap in the PCID case anyway. )

---
 arch/x86/kernel/smpboot.c |    5 +++++
 1 file changed, 5 insertions(+)
arch/x86/kernel/smpboot.c +5 -0
@@ -222,6 +222,11 @@ static void notrace start_secondary(void
 #ifdef CONFIG_X86_32
 	/* switch away from the initial page table */
 	load_cr3(swapper_pg_dir);
+	/*
+	 * Initialize the CR4 shadow before doing anything that could
+	 * try to read it.
+	 */
+	cr4_init_shadow();
 	__flush_tlb_all();
 #endif
 	load_current_idt();
author maintainer
#168 lore raw

PATCH 174/324 ARM: imx_v6_v7_defconfig: Select ULPI support

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Fabio Estevam <[email protected]>

[ Upstream commit 157bcc06094c3c5800d3f4676527047b79b618e7 ]

Select CONFIG_USB_CHIPIDEA_ULPI and CONFIG_USB_ULPI_BUS so that USB ULPI can be functional on some boards like imx51-babbge.

This fixes a kernel hang in 4.18-rc1 on i.mx51-babbage, caused by commit 03e6275ae381 ("usb: chipidea: Fix ULPI on imx51").

---
 arch/arm/configs/imx_v6_v7_defconfig |    2 ++
 1 file changed, 2 insertions(+)
arch/arm/configs/imx_v6_v7_defconfig +2 -0
@@ -294,6 +294,7 @@ CONFIG_USB_STORAGE=y
 CONFIG_USB_CHIPIDEA=y
 CONFIG_USB_CHIPIDEA_UDC=y
 CONFIG_USB_CHIPIDEA_HOST=y
+CONFIG_USB_CHIPIDEA_ULPI=y
 CONFIG_USB_SERIAL=m
 CONFIG_USB_SERIAL_GENERIC=y
 CONFIG_USB_SERIAL_FTDI_SIO=m
@@ -330,6 +331,7 @@ CONFIG_USB_GADGETFS=m
 CONFIG_USB_FUNCTIONFS=m
 CONFIG_USB_MASS_STORAGE=m
 CONFIG_USB_G_SERIAL=m
+CONFIG_USB_ULPI_BUS=y
 CONFIG_MMC=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_PLTFM=y
author maintainer
#169 lore raw

PATCH 175/324 ARM: imx_v4_v5_defconfig: Select ULPI support

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Fabio Estevam <[email protected]>

[ Upstream commit 2ceb2780b790b74bc408a949f6aedbad8afa693e ]

Select CONFIG_USB_CHIPIDEA_ULPI and CONFIG_USB_ULPI_BUS so that USB ULPI can be functional on some boards like that use ULPI interface.

---
 arch/arm/configs/imx_v4_v5_defconfig |    2 ++
 1 file changed, 2 insertions(+)
arch/arm/configs/imx_v4_v5_defconfig +2 -0
@@ -141,9 +141,11 @@ CONFIG_USB_STORAGE=y
 CONFIG_USB_CHIPIDEA=y
 CONFIG_USB_CHIPIDEA_UDC=y
 CONFIG_USB_CHIPIDEA_HOST=y
+CONFIG_USB_CHIPIDEA_ULPI=y
 CONFIG_NOP_USB_XCEIV=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_ETH=m
+CONFIG_USB_ULPI_BUS=y
 CONFIG_MMC=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_PLTFM=y
author maintainer
#172 lore raw

PATCH 178/324 bpf: hash map: decrement counter on error

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Mauricio Vasquez B <[email protected]>

[ Upstream commit ed2b82c03dc187018307c7c6bf9299705f3db383 ]

Decrement the number of elements in the map in case the allocation of a new node fails.

---
 kernel/bpf/hashtab.c |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
kernel/bpf/hashtab.c +11 -5
@@ -743,13 +743,15 @@ static struct htab_elem *alloc_htab_elem
 				 * old element will be freed immediately.
 				 * Otherwise return an error
 				 */
-				atomic_dec(&htab->count);
-				return ERR_PTR(-E2BIG);
+				l_new = ERR_PTR(-E2BIG);
+				goto dec_count;
 			}
 		l_new = kmalloc_node(htab->elem_size, GFP_ATOMIC | __GFP_NOWARN,
 				     htab->map.numa_node);
-		if (!l_new)
-			return ERR_PTR(-ENOMEM);
+		if (!l_new) {
+			l_new = ERR_PTR(-ENOMEM);
+			goto dec_count;
+		}
 	}
 
 	memcpy(l_new->key, key, key_size);
@@ -762,7 +764,8 @@ static struct htab_elem *alloc_htab_elem
 						  GFP_ATOMIC | __GFP_NOWARN);
 			if (!pptr) {
 				kfree(l_new);
-				return ERR_PTR(-ENOMEM);
+				l_new = ERR_PTR(-ENOMEM);
+				goto dec_count;
 			}
 		}
 
@@ -776,6 +779,9 @@ static struct htab_elem *alloc_htab_elem
 
 	l_new->hash = hash;
 	return l_new;
+dec_count:
+	atomic_dec(&htab->count);
+	return l_new;
 }
 
 static int check_flags(struct bpf_htab *htab, struct htab_elem *l_old,
author maintainer
#173 lore raw

PATCH 180/324 kasan: fix shadow_size calculation error in kasan_module_alloc

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Zhen Lei <[email protected]>

[ Upstream commit 1e8e18f694a52d703665012ca486826f64bac29d ]

There is a special case that the size is "(N << KASAN_SHADOW_SCALE_SHIFT) Pages plus X", the value of X is [1, KASAN_SHADOW_SCALE_SIZE-1]. The operation "size >> KASAN_SHADOW_SCALE_SHIFT" will drop X, and the roundup operation can not retrieve the missed one page. For example:
size=0x28006, PAGE_SIZE=0x1000, KASAN_SHADOW_SCALE_SHIFT=3, we will get shadow_size=0x5000, but actually we need 6 pages.

  shadow_size = round_up(size >> KASAN_SHADOW_SCALE_SHIFT, PAGE_SIZE);

This can lead to a kernel crash when kasan is enabled and the value of mod->core_layout.size or mod->init_layout.size is like above. Because the shadow memory of X has not been allocated and mapped.

move_module:
ptr = module_alloc(mod->core_layout.size);
...
memset(ptr, 0, mod->core_layout.size); //crashed

  Unable to handle kernel paging request at virtual address ffff0fffff97b000
  ......
  Call trace:
    __asan_storeN+0x174/0x1a8
    memset+0x24/0x48
    layout_and_allocate+0xcd8/0x1800
    load_module+0x190/0x23e8
    SyS_finit_module+0x148/0x180
---
 mm/kasan/kasan.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
mm/kasan/kasan.c +3 -2
@@ -619,12 +619,13 @@ void kasan_kfree_large(void *ptr, unsign
 int kasan_module_alloc(void *addr, size_t size)
 {
 	void *ret;
+	size_t scaled_size;
 	size_t shadow_size;
 	unsigned long shadow_start;
 
 	shadow_start = (unsigned long)kasan_mem_to_shadow(addr);
-	shadow_size = round_up(size >> KASAN_SHADOW_SCALE_SHIFT,
-			PAGE_SIZE);
+	scaled_size = (size + KASAN_SHADOW_MASK) >> KASAN_SHADOW_SCALE_SHIFT;
+	shadow_size = round_up(scaled_size, PAGE_SIZE);
 
 	if (WARN_ON(!PAGE_ALIGNED(shadow_start)))
 		return -EINVAL;
author maintainer
#175 lore raw

PATCH 182/324 smsc75xx: Add workaround for gigabit link up hardware errata.

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Yuiko Oshino <[email protected]>

[ Upstream commit d461e3da905332189aad546b2ad9adbe6071c7cc ]

In certain conditions, the device may not be able to link in gigabit mode. This software workaround ensures that the device will not enter the failure state.

Fixes d0cad871703b898a442e4049c532ec39168e5b57 ("SMSC75XX USB 2.0 Gigabit Ethernet Devices")
---
 drivers/net/usb/smsc75xx.c |   62 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
drivers/net/usb/smsc75xx.c +62 -0
@@ -82,6 +82,9 @@ static bool turbo_mode = true;
 module_param(turbo_mode, bool, 0644);
 MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction");
 
+static int smsc75xx_link_ok_nopm(struct usbnet *dev);
+static int smsc75xx_phy_gig_workaround(struct usbnet *dev);
+
 static int __must_check __smsc75xx_read_reg(struct usbnet *dev, u32 index,
 					    u32 *data, int in_pm)
 {
@@ -852,6 +855,9 @@ static int smsc75xx_phy_initialize(struc
 		return -EIO;
 	}
 
+	/* phy workaround for gig link */
+	smsc75xx_phy_gig_workaround(dev);
+
 	smsc75xx_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE,
 		ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP |
 		ADVERTISE_PAUSE_ASYM);
@@ -987,6 +993,62 @@ static int smsc75xx_wait_ready(struct us
 	return -EIO;
 }
 
+static int smsc75xx_phy_gig_workaround(struct usbnet *dev)
+{
+	struct mii_if_info *mii = &dev->mii;
+	int ret = 0, timeout = 0;
+	u32 buf, link_up = 0;
+
+	/* Set the phy in Gig loopback */
+	smsc75xx_mdio_write(dev->net, mii->phy_id, MII_BMCR, 0x4040);
+
+	/* Wait for the link up */
+	do {
+		link_up = smsc75xx_link_ok_nopm(dev);
+		usleep_range(10000, 20000);
+		timeout++;
+	} while ((!link_up) && (timeout < 1000));
+
+	if (timeout >= 1000) {
+		netdev_warn(dev->net, "Timeout waiting for PHY link up\n");
+		return -EIO;
+	}
+
+	/* phy reset */
+	ret = smsc75xx_read_reg(dev, PMT_CTL, &buf);
+	if (ret < 0) {
+		netdev_warn(dev->net, "Failed to read PMT_CTL: %d\n", ret);
+		return ret;
+	}
+
+	buf |= PMT_CTL_PHY_RST;
+
+	ret = smsc75xx_write_reg(dev, PMT_CTL, buf);
+	if (ret < 0) {
+		netdev_warn(dev->net, "Failed to write PMT_CTL: %d\n", ret);
+		return ret;
+	}
+
+	timeout = 0;
+	do {
+		usleep_range(10000, 20000);
+		ret = smsc75xx_read_reg(dev, PMT_CTL, &buf);
+		if (ret < 0) {
+			netdev_warn(dev->net, "Failed to read PMT_CTL: %d\n",
+				    ret);
+			return ret;
+		}
+		timeout++;
+	} while ((buf & PMT_CTL_PHY_RST) && (timeout < 100));
+
+	if (timeout >= 100) {
+		netdev_warn(dev->net, "timeout waiting for PHY Reset\n");
+		return -EIO;
+	}
+
+	return 0;
+}
+
 static int smsc75xx_reset(struct usbnet *dev)
 {
 	struct smsc75xx_priv *pdata = (struct smsc75xx_priv *)(dev->data[0]);
author maintainer
#176 lore raw

PATCH 183/324 drm/bridge/sii8620: Fix display of packed pixel modes

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Maciej Purski <[email protected]>

[ Upstream commit fdddc65ab35d575b42aab411b2dc687601eab680 ]

Current implementation does not guarantee packed pixel modes working with every dongle. There are some dongles, which require selecting the output mode explicitly.

Write proper values to registers in packed_pixel mode, based on how it is done in vendor's code. Select output color space: RGB (no packed pixel) or YCBCR422 (packed pixel).

This reverts commit e8b92efa629dac0e70ea4145c5e70616de5f89c8 ("drm/bridge/sii8620: fix display of packed pixel modes in MHL2").

---
 drivers/gpu/drm/bridge/sil-sii8620.c |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/sil-sii8620.c +16 -1
@@ -1060,21 +1060,36 @@ static void sii8620_stop_video(struct si
 
 static void sii8620_set_format(struct sii8620 *ctx)
 {
+	u8 out_fmt;
+
 	if (sii8620_is_mhl3(ctx)) {
 		sii8620_setbits(ctx, REG_M3_P0CTRL,
 				BIT_M3_P0CTRL_MHL3_P0_PIXEL_MODE_PACKED,
 				ctx->use_packed_pixel ? ~0 : 0);
 	} else {
+		if (ctx->use_packed_pixel) {
+			sii8620_write_seq_static(ctx,
+				REG_VID_MODE, BIT_VID_MODE_M1080P,
+				REG_MHL_TOP_CTL, BIT_MHL_TOP_CTL_MHL_PP_SEL | 1,
+				REG_MHLTX_CTL6, 0x60
+			);
+		} else {
 			sii8620_write_seq_static(ctx,
 				REG_VID_MODE, 0,
 				REG_MHL_TOP_CTL, 1,
 				REG_MHLTX_CTL6, 0xa0
 			);
+		}
 	}
 
+	if (ctx->use_packed_pixel)
+		out_fmt = VAL_TPI_FORMAT(YCBCR422, FULL);
+	else
+		out_fmt = VAL_TPI_FORMAT(RGB, FULL);
+
 	sii8620_write_seq(ctx,
 		REG_TPI_INPUT, VAL_TPI_FORMAT(RGB, FULL),
-		REG_TPI_OUTPUT, VAL_TPI_FORMAT(RGB, FULL),
+		REG_TPI_OUTPUT, out_fmt,
 	);
 }
 
author maintainer
#177 lore raw

PATCH 184/324 RISC-V: fix R_RISCV_ADD32/R_RISCV_SUB32 relocations

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Andreas Schwab <[email protected]>

[ Upstream commit 781c8fe2da3d2c7c95cd7ffddbab63b80a79da4d ]

The R_RISCV_ADD32/R_RISCV_SUB32 relocations should add/subtract the address of the symbol (without overflow check), not its contents.

---
 arch/riscv/kernel/module.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/kernel/module.c +2 -2
@@ -252,14 +252,14 @@ static int apply_r_riscv_align_rela(stru
 static int apply_r_riscv_add32_rela(struct module *me, u32 *location,
 				    Elf_Addr v)
 {
-	*(u32 *)location += (*(u32 *)v);
+	*(u32 *)location += (u32)v;
 	return 0;
 }
 
 static int apply_r_riscv_sub32_rela(struct module *me, u32 *location,
 				    Elf_Addr v)
 {
-	*(u32 *)location -= (*(u32 *)v);
+	*(u32 *)location -= (u32)v;
 	return 0;
 }
 
author maintainer
#181 lore raw

PATCH 189/324 samples/bpf: Check the error of write() and read()

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Taeung Song <[email protected]>

[ Upstream commit 02a2f000a3629274bfad60bfc4de9edec49e63e7 ]

test_task_rename() and test_urandom_read()
can be failed during write() and read(),
So check the result of them.

---
 samples/bpf/test_overhead_user.c |   19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
samples/bpf/test_overhead_user.c +15 -4
@@ -6,6 +6,7 @@
  */
 #define _GNU_SOURCE
 #include <sched.h>
+#include <errno.h>
 #include <stdio.h>
 #include <sys/types.h>
 #include <asm/unistd.h>
@@ -44,8 +45,13 @@ static void test_task_rename(int cpu)
 		exit(1);
 	}
 	start_time = time_get_ns();
-	for (i = 0; i < MAX_CNT; i++)
-		write(fd, buf, sizeof(buf));
+	for (i = 0; i < MAX_CNT; i++) {
+		if (write(fd, buf, sizeof(buf)) < 0) {
+			printf("task rename failed: %s\n", strerror(errno));
+			close(fd);
+			return;
+		}
+	}
 	printf("task_rename:%d: %lld events per sec\n",
 	       cpu, MAX_CNT * 1000000000ll / (time_get_ns() - start_time));
 	close(fd);
@@ -63,8 +69,13 @@ static void test_urandom_read(int cpu)
 		exit(1);
 	}
 	start_time = time_get_ns();
-	for (i = 0; i < MAX_CNT; i++)
-		read(fd, buf, sizeof(buf));
+	for (i = 0; i < MAX_CNT; i++) {
+		if (read(fd, buf, sizeof(buf)) < 0) {
+			printf("failed to read from /dev/urandom: %s\n", strerror(errno));
+			close(fd);
+			return;
+		}
+	}
 	printf("urandom_read:%d: %lld events per sec\n",
 	       cpu, MAX_CNT * 1000000000ll / (time_get_ns() - start_time));
 	close(fd);
author maintainer
#182 lore raw

PATCH 190/324 ieee802154: mcr20a: add missing includes

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Arnd Bergmann <[email protected]>

[ Upstream commit a6032120d341badd9b034cb64411e7089d8f4285 ]

Without CONFIG_GPIOLIB, some headers are not included implicitly, leading to a build failure:

drivers/net/ieee802154/mcr20a.c: In function 'mcr20a_probe':
drivers/net/ieee802154/mcr20a.c:1347:13: error: implicit declaration of function 'irq_get_trigger_type'; did you mean 'irq_get_irqchip_state'? [-Werror=implicit-function-declaration]

This includes gpio/consumer.h and irq.h directly rather through the gpiolib header.

Fixes 8c6ad9cc5157 ("ieee802154: Add NXP MCR20A IEEE 802.15.4 transceiver driver")
---
 drivers/net/ieee802154/mcr20a.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ieee802154/mcr20a.c +2 -1
@@ -15,10 +15,11 @@
  */
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/spi/spi.h>
 #include <linux/workqueue.h>
 #include <linux/interrupt.h>
+#include <linux/irq.h>
 #include <linux/skbuff.h>
 #include <linux/of_gpio.h>
 #include <linux/regmap.h>
author maintainer
#187 lore raw

PATCH 195/324 net: qrtr: Broadcast messages only from control port

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Arun Kumar Neelakantam <[email protected]>

[ Upstream commit fdf5fd3975666804118e62c69de25dc85cc0909c ]

The broadcast node id should only be sent with the control port id.

---
 net/qrtr/qrtr.c |    4 ++++
 1 file changed, 4 insertions(+)
net/qrtr/qrtr.c +4 -0
@@ -764,6 +764,10 @@ static int qrtr_sendmsg(struct socket *s
 	node = NULL;
 	if (addr->sq_node == QRTR_NODE_BCAST) {
 		enqueue_fn = qrtr_bcast_enqueue;
+		if (addr->sq_port != QRTR_PORT_CTRL) {
+			release_sock(sk);
+			return -ENOTCONN;
+		}
 	} else if (addr->sq_node == ipc->us.sq_node) {
 		enqueue_fn = qrtr_local_enqueue;
 	} else {
author maintainer
#189 lore raw

PATCH 197/324 sh_eth: fix invalid context bug while calling auto-negotiation by ethtool

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Vladimir Zapolskiy <[email protected]>

[ Upstream commit 53a710b5044d8475faa6813000b6dd659400ef7b ]

Since commit 35b5f6b1a82b ("PHYLIB: Locking fixes for PHY I/O potentially sleeping") phy_start_aneg() function utilizes a mutex to serialize changes to phy state, however the helper function is called in atomic context.

The bug can be reproduced by running "ethtool -r" command, the bug is reported if CONFIG_DEBUG_ATOMIC_SLEEP build option is enabled.

Fixes dc19e4e5e02f ("sh: sh_eth: Add support ethtool")
---
 drivers/net/ethernet/renesas/sh_eth.c |   10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/net/ethernet/renesas/sh_eth.c +1 -9
@@ -2193,18 +2193,10 @@ static void sh_eth_get_regs(struct net_d
 
 static int sh_eth_nway_reset(struct net_device *ndev)
 {
-	struct sh_eth_private *mdp = netdev_priv(ndev);
-	unsigned long flags;
-	int ret;
-
 	if (!ndev->phydev)
 		return -ENODEV;
 
-	spin_lock_irqsave(&mdp->lock, flags);
-	ret = phy_start_aneg(ndev->phydev);
-	spin_unlock_irqrestore(&mdp->lock, flags);
-
-	return ret;
+	return phy_start_aneg(ndev->phydev);
 }
 
 static u32 sh_eth_get_msglevel(struct net_device *ndev)
author maintainer
#192 lore raw

PATCH 200/324 ravb: fix invalid context bug while changing link options by ethtool

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Vladimir Zapolskiy <[email protected]>

[ Upstream commit 05925e52a7d379192a5fdff2c33710f573190ead ]

The change fixes sleep in atomic context bug, which is encountered every time when link settings are changed by ethtool.

Since commit 35b5f6b1a82b ("PHYLIB: Locking fixes for PHY I/O potentially sleeping") phy_start_aneg() function utilizes a mutex to serialize changes to phy state, however that helper function is called in atomic context under a grabbed spinlock, because phy_start_aneg() is called by phy_ethtool_ksettings_set() and by replaced phy_ethtool_sset() helpers from phylib.

Now duplex mode setting is enforced in ravb_adjust_link() only, also now RX/TX is disabled when link is put down or modifications to E-MAC registers ECMR and GECMR are expected for both cases of checked and ignored link status pin state from E-MAC interrupt handler.

Fixes c156633f1353 ("Renesas Ethernet AVB driver proper")
---
 drivers/net/ethernet/renesas/ravb_main.c |   49 +++++++++----------------------
 1 file changed, 15 insertions(+), 34 deletions(-)
drivers/net/ethernet/renesas/ravb_main.c +15 -34
@@ -980,6 +980,13 @@ static void ravb_adjust_link(struct net_
 	struct ravb_private *priv = netdev_priv(ndev);
 	struct phy_device *phydev = ndev->phydev;
 	bool new_state = false;
+	unsigned long flags;
+
+	spin_lock_irqsave(&priv->lock, flags);
+
+	/* Disable TX and RX right over here, if E-MAC change is ignored */
+	if (priv->no_avb_link)
+		ravb_rcv_snd_disable(ndev);
 
 	if (phydev->link) {
 		if (phydev->duplex != priv->duplex) {
@@ -997,18 +1004,21 @@ static void ravb_adjust_link(struct net_
 			ravb_modify(ndev, ECMR, ECMR_TXF, 0);
 			new_state = true;
 			priv->link = phydev->link;
-			if (priv->no_avb_link)
-				ravb_rcv_snd_enable(ndev);
 		}
 	} else if (priv->link) {
 		new_state = true;
 		priv->link = 0;
 		priv->speed = 0;
 		priv->duplex = -1;
-		if (priv->no_avb_link)
-			ravb_rcv_snd_disable(ndev);
 	}
 
+	/* Enable TX and RX right over here, if E-MAC change is ignored */
+	if (priv->no_avb_link && phydev->link)
+		ravb_rcv_snd_enable(ndev);
+
+	mmiowb();
+	spin_unlock_irqrestore(&priv->lock, flags);
+
 	if (new_state && netif_msg_link(priv))
 		phy_print_status(phydev);
 }
@@ -1115,39 +1125,10 @@ static int ravb_get_link_ksettings(struc
 static int ravb_set_link_ksettings(struct net_device *ndev,
 				   const struct ethtool_link_ksettings *cmd)
 {
-	struct ravb_private *priv = netdev_priv(ndev);
-	unsigned long flags;
-	int error;
-
 	if (!ndev->phydev)
 		return -ENODEV;
 
-	spin_lock_irqsave(&priv->lock, flags);
-
-	/* Disable TX and RX */
-	ravb_rcv_snd_disable(ndev);
-
-	error = phy_ethtool_ksettings_set(ndev->phydev, cmd);
-	if (error)
-		goto error_exit;
-
-	if (cmd->base.duplex == DUPLEX_FULL)
-		priv->duplex = 1;
-	else
-		priv->duplex = 0;
-
-	ravb_set_duplex(ndev);
-
-error_exit:
-	mdelay(1);
-
-	/* Enable TX and RX */
-	ravb_rcv_snd_enable(ndev);
-
-	mmiowb();
-	spin_unlock_irqrestore(&priv->lock, flags);
-
-	return error;
+	return phy_ethtool_ksettings_set(ndev->phydev, cmd);
 }
 
 static int ravb_nway_reset(struct net_device *ndev)
author maintainer
#195 lore raw

PATCH 203/324 tipc: fix correct setting of message type in second discoverer

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Jon Maloy <[email protected]>

[ Upstream commit 92018c7ca959ccd346d6235dac03cf7fc1ba51f7 ]

The duplicate address discovery protocol is not safe against two discoverers running in parallel. The one executing first after the trial period is over will set the node address and change its own message type to DSC_REQ_MSG. The one executing last may find that the node address is already set, and never change message type, with the result that its links may never be established.

In this commmit we ensure that the message type always is set correctly after the trial period is over.

Fixes 25b0b9c4e835 ("tipc: handle collisions of 32-bit node address hash values")
---
 net/tipc/discover.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
net/tipc/discover.c +7 -6
@@ -287,7 +287,6 @@ static void tipc_disc_timeout(struct tim
 {
 	struct tipc_discoverer *d = from_timer(d, t, timer);
 	struct tipc_net *tn = tipc_net(d->net);
-	u32 self = tipc_own_addr(d->net);
 	struct tipc_media_addr maddr;
 	struct sk_buff *skb = NULL;
 	struct net *net = d->net;
@@ -301,12 +300,14 @@ static void tipc_disc_timeout(struct tim
 		goto exit;
 	}
 
-	/* Did we just leave the address trial period ? */
-	if (!self && !time_before(jiffies, tn->addr_trial_end)) {
-		self = tn->trial_addr;
-		tipc_net_finalize(net, self);
-		msg_set_prevnode(buf_msg(d->skb), self);
+	/* Trial period over ? */
+	if (!time_before(jiffies, tn->addr_trial_end)) {
+		/* Did we just leave it ? */
+		if (!tipc_own_addr(net))
+			tipc_net_finalize(net, tn->trial_addr);
+
 		msg_set_type(buf_msg(d->skb), DSC_REQ_MSG);
+		msg_set_prevnode(buf_msg(d->skb), tipc_own_addr(net));
 	}
 
 	/* Adjust timeout interval according to discovery phase */
author maintainer
#198 lore raw

PATCH 206/324 ARM: pxa: irq: fix handling of ICMR registers in suspend/resume

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Daniel Mack <[email protected]>

[ Upstream commit 0c1049dcb4ceec640d8bd797335bcbebdcab44d2 ]

PXA3xx platforms have 56 interrupts that are stored in two ICMR registers. The code in pxa_irq_suspend() and pxa_irq_resume() however does a simple division by 32 which only leads to one register being saved at suspend and restored at resume time. The NAND interrupt setting, for instance, is lost.

Fix this by using DIV_ROUND_UP() instead.

---
 arch/arm/mach-pxa/irq.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-pxa/irq.c +2 -2
@@ -185,7 +185,7 @@ static int pxa_irq_suspend(void)
 {
 	int i;
 
-	for (i = 0; i < pxa_internal_irq_nr / 32; i++) {
+	for (i = 0; i < DIV_ROUND_UP(pxa_internal_irq_nr, 32); i++) {
 		void __iomem *base = irq_base(i);
 
 		saved_icmr[i] = __raw_readl(base + ICMR);
@@ -204,7 +204,7 @@ static void pxa_irq_resume(void)
 {
 	int i;
 
-	for (i = 0; i < pxa_internal_irq_nr / 32; i++) {
+	for (i = 0; i < DIV_ROUND_UP(pxa_internal_irq_nr, 32); i++) {
 		void __iomem *base = irq_base(i);
 
 		__raw_writel(saved_icmr[i], base + ICMR);
author maintainer
#200 lore raw

PATCH 208/324 net/sched: act_csum: fix NULL dereference when goto chain is used

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Davide Caratti <[email protected]>

[ Upstream commit 11a245e2f7bf25fc21f47e4c9c8491841b128890 ]

the control action in the common member of struct tcf_csum must be a valid value, as it can contain the chain index when 'goto chain' is used. Ensure that the control action can be read as x->tcfa_action, when x is a pointer to struct tc_action and x->ops->type is TCA_ACT_CSUM, to prevent the following command:

  # tc filter add dev $h2 ingress protocol ip pref 1 handle 101 flower \
Quoted 1 line

$tcflags dst_mac $h2mac action csum ip or tcp or udp or sctp goto chain 1

from triggering a NULL pointer dereference when a matching packet is received.

 BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
 PGD 800000010416b067 P4D 800000010416b067 PUD 1041be067 PMD 0
 Oops: 0000 [#1] SMP PTI
 CPU: 0 PID: 3072 Comm: mausezahn Tainted: G            E     4.18.0-rc2.auguri+ #421
 Hardware name: Hewlett-Packard HP Z220 CMT Workstation/1790, BIOS K51 v01.58 02/07/2013
 RIP: 0010:tcf_action_exec+0xb8/0x100
 Code: 00 00 00 20 74 1d 83 f8 03 75 09 49 83 c4 08 4d 39 ec 75 bc 48 83 c4 10 5b 5d 41 5c 41 5d 41 5e 41 5f c3 49 8b 97 a8 00 00 00 <48> 8b 12 48 89 55 00 48 83 c4 10 5b 5d 41 5c 41 5d 41 5e 41 5f c3
 RSP: 0018:ffffa020dea03c40 EFLAGS: 00010246
 RAX: 0000000020000001 RBX: ffffa020d7ccef00 RCX: 0000000000000054
 RDX: 0000000000000000 RSI: ffffa020ca5ae000 RDI: ffffa020d7ccef00
 RBP: ffffa020dea03e60 R08: 0000000000000000 R09: ffffa020dea03c9c
 R10: ffffa020dea03c78 R11: 0000000000000008 R12: ffffa020d3fe4f00
 R13: ffffa020d3fe4f08 R14: 0000000000000001 R15: ffffa020d53ca300
 FS:  00007f5a46942740(0000) GS:ffffa020dea00000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 CR2: 0000000000000000 CR3: 0000000104218002 CR4: 00000000001606f0
 Call Trace:
  <IRQ>
  fl_classify+0x1ad/0x1c0 [cls_flower]
  ? arp_rcv+0x121/0x1b0
  ? __x2apic_send_IPI_dest+0x40/0x40
  ? smp_reschedule_interrupt+0x1c/0xd0
  ? reschedule_interrupt+0xf/0x20
  ? reschedule_interrupt+0xa/0x20
  ? device_is_rmrr_locked+0xe/0x50
  ? iommu_should_identity_map+0x49/0xd0
  ? __intel_map_single+0x30/0x140
  ? e1000e_update_rdt_wa.isra.52+0x22/0xb0 [e1000e]
  ? e1000_alloc_rx_buffers+0x233/0x250 [e1000e]
  ? kmem_cache_alloc+0x38/0x1c0
  tcf_classify+0x89/0x140
  __netif_receive_skb_core+0x5ea/0xb70
  ? enqueue_task_fair+0xb6/0x7d0
  ? process_backlog+0x97/0x150
  process_backlog+0x97/0x150
  net_rx_action+0x14b/0x3e0
  __do_softirq+0xde/0x2b4
  do_softirq_own_stack+0x2a/0x40
  </IRQ>
  do_softirq.part.18+0x49/0x50
  __local_bh_enable_ip+0x49/0x50
  __dev_queue_xmit+0x4ab/0x8a0
  ? wait_woken+0x80/0x80
  ? packet_sendmsg+0x38f/0x810
  ? __dev_queue_xmit+0x8a0/0x8a0
  packet_sendmsg+0x38f/0x810
  sock_sendmsg+0x36/0x40
  __sys_sendto+0x10e/0x140
  ? do_vfs_ioctl+0xa4/0x630
  ? syscall_trace_enter+0x1df/0x2e0
  ? __audit_syscall_exit+0x22a/0x290
  __x64_sys_sendto+0x24/0x30
  do_syscall_64+0x5b/0x180
  entry_SYSCALL_64_after_hwframe+0x44/0xa9
 RIP: 0033:0x7f5a45cbec93
 Code: 48 8b 0d 18 83 20 00 f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 83 3d 59 c7 20 00 00 75 13 49 89 ca b8 2c 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 34 c3 48 83 ec 08 e8 2b f7 ff ff 48 89 04 24
 RSP: 002b:00007ffd0ee6d748 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
 RAX: ffffffffffffffda RBX: 0000000001161010 RCX: 00007f5a45cbec93
 RDX: 0000000000000062 RSI: 0000000001161322 RDI: 0000000000000003
 RBP: 00007ffd0ee6d780 R08: 00007ffd0ee6d760 R09: 0000000000000014
 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000062
 R13: 0000000001161322 R14: 00007ffd0ee6d760 R15: 0000000000000003
 Modules linked in: act_csum act_gact cls_flower sch_ingress vrf veth act_tunnel_key(E) xt_CHECKSUM iptable_mangle ipt_MASQUERADE iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack ipt_REJECT nf_reject_ipv4 tun bridge stp llc ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel snd_hda_codec_hdmi snd_hda_codec_realtek kvm snd_hda_codec_generic hp_wmi iTCO_wdt sparse_keymap rfkill mei_wdt iTCO_vendor_support wmi_bmof gpio_ich irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel pcbc aesni_intel snd_hda_intel crypto_simd cryptd snd_hda_codec glue_helper snd_hda_core snd_hwdep snd_seq snd_seq_device snd_pcm pcspkr i2c_i801 snd_timer snd sg lpc_ich soundcore wmi mei_me
  mei ie31200_edac nfsd auth_rpcgss nfs_acl lockd grace sunrpc ip_tables xfs libcrc32c sr_mod cdrom sd_mod ahci libahci crc32c_intel i915 ixgbe serio_raw libata video dca i2c_algo_bit sfc drm_kms_helper syscopyarea mtd sysfillrect mdio sysimgblt fb_sys_fops drm e1000e i2c_core
 CR2: 0000000000000000
 ---[ end trace 3c9e9d1a77df4026 ]---
 RIP: 0010:tcf_action_exec+0xb8/0x100
 Code: 00 00 00 20 74 1d 83 f8 03 75 09 49 83 c4 08 4d 39 ec 75 bc 48 83 c4 10 5b 5d 41 5c 41 5d 41 5e 41 5f c3 49 8b 97 a8 00 00 00 <48> 8b 12 48 89 55 00 48 83 c4 10 5b 5d 41 5c 41 5d 41 5e 41 5f c3
 RSP: 0018:ffffa020dea03c40 EFLAGS: 00010246
 RAX: 0000000020000001 RBX: ffffa020d7ccef00 RCX: 0000000000000054
 RDX: 0000000000000000 RSI: ffffa020ca5ae000 RDI: ffffa020d7ccef00
 RBP: ffffa020dea03e60 R08: 0000000000000000 R09: ffffa020dea03c9c
 R10: ffffa020dea03c78 R11: 0000000000000008 R12: ffffa020d3fe4f00
 R13: ffffa020d3fe4f08 R14: 0000000000000001 R15: ffffa020d53ca300
 FS:  00007f5a46942740(0000) GS:ffffa020dea00000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 CR2: 0000000000000000 CR3: 0000000104218002 CR4: 00000000001606f0
 Kernel panic - not syncing: Fatal exception in interrupt
 Kernel Offset: 0x26400000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
 ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---
Fixes 9c5f69bbd75a ("net/sched: act_csum: don't use spinlock in the fast path")
---
 include/net/tc_act/tc_csum.h |    1 -
 net/sched/act_csum.c         |    6 +++---
 2 files changed, 3 insertions(+), 4 deletions(-)
include/net/tc_act/tc_csum.h +0 -1
@@ -7,7 +7,6 @@
 #include <linux/tc_act/tc_csum.h>
 
 struct tcf_csum_params {
-	int action;
 	u32 update_flags;
 	struct rcu_head rcu;
 };
net/sched/act_csum.c +3 -3
@@ -91,7 +91,7 @@ static int tcf_csum_init(struct net *net
 	}
 	params_old = rtnl_dereference(p->params);
 
-	params_new->action = parm->action;
+	p->tcf_action = parm->action;
 	params_new->update_flags = parm->update_flags;
 	rcu_assign_pointer(p->params, params_new);
 	if (params_old)
@@ -561,7 +561,7 @@ static int tcf_csum(struct sk_buff *skb,
 	tcf_lastuse_update(&p->tcf_tm);
 	bstats_cpu_update(this_cpu_ptr(p->common.cpu_bstats), skb);
 
-	action = params->action;
+	action = READ_ONCE(p->tcf_action);
 	if (unlikely(action == TC_ACT_SHOT))
 		goto drop_stats;
 
@@ -599,11 +599,11 @@ static int tcf_csum_dump(struct sk_buff
 		.index   = p->tcf_index,
 		.refcnt  = p->tcf_refcnt - ref,
 		.bindcnt = p->tcf_bindcnt - bind,
+		.action  = p->tcf_action,
 	};
 	struct tcf_t t;
 
 	params = rtnl_dereference(p->params);
-	opt.action = params->action;
 	opt.update_flags = params->update_flags;
 
 	if (nla_put(skb, TCA_CSUM_PARMS, sizeof(opt), &opt))
author maintainer
#204 lore raw

PATCH 212/324 ipfrag: really prevent allocation on netns exit

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Paolo Abeni <[email protected]>

[ Upstream commit f6f2a4a2eb92bc73671204198bb2f8ab53ff59fb ]

Setting the low threshold to 0 has no effect on frags allocation, we need to clear high_thresh instead.

The code was pre-existent to commit 648700f76b03 ("inet: frags:
use rhashtables for reassembly units"), but before the above, such assignment had a different role: prevent concurrent eviction from the worker and the netns cleanup helper.

Fixes 648700f76b03 ("inet: frags: use rhashtables for reassembly units")
---
 net/ipv4/inet_fragment.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/inet_fragment.c +1 -1
@@ -90,7 +90,7 @@ static void inet_frags_free_cb(void *ptr
 
 void inet_frags_exit_net(struct netns_frags *nf)
 {
-	nf->low_thresh = 0; /* prevent creation of new frags */
+	nf->high_thresh = 0; /* prevent creation of new frags */
 
 	rhashtable_free_and_destroy(&nf->rhashtable, inet_frags_free_cb, NULL);
 }
author maintainer
#205 lore raw

PATCH 213/324 drm/sun4i: link in front-end code if needed

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Arnd Bergmann <[email protected]>

[ Upstream commit 3156b53c2e2fadafa1a16412a8791b38f94b5bdc ]

When the base sun4i DRM driver is built-in but the back-end is a loadable module, we run into a link error:

drivers/gpu/drm/sun4i/sun4i_drv.o: In function `sun4i_drv_probe':
sun4i_drv.c:(.text+0x60c): undefined reference to `sun4i_frontend_of_table'

The dependency is a bit tricky, the best workaround I have come up with is to use a Makefile hack to to interpret both CONFIG_DRM_SUN4I_BACKEND=m and CONFIG_DRM_SUN4I_BACKEND=y as a directive to build the front-end the same way as the main module.

---
 drivers/gpu/drm/sun4i/Makefile |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/sun4i/Makefile +4 -1
@@ -29,7 +29,10 @@ obj-$(CONFIG_DRM_SUN4I)		+= sun4i-tcon.o
 obj-$(CONFIG_DRM_SUN4I)		+= sun4i_tv.o
 obj-$(CONFIG_DRM_SUN4I)		+= sun6i_drc.o
 
-obj-$(CONFIG_DRM_SUN4I_BACKEND)	+= sun4i-backend.o sun4i-frontend.o
+obj-$(CONFIG_DRM_SUN4I_BACKEND)	+= sun4i-backend.o
+ifdef CONFIG_DRM_SUN4I_BACKEND
+obj-$(CONFIG_DRM_SUN4I)		+= sun4i-frontend.o
+endif
 obj-$(CONFIG_DRM_SUN4I_HDMI)	+= sun4i-drm-hdmi.o
 obj-$(CONFIG_DRM_SUN8I_DW_HDMI)	+= sun8i-drm-hdmi.o
 obj-$(CONFIG_DRM_SUN8I_MIXER)	+= sun8i-mixer.o
author maintainer
#207 lore raw

PATCH 215/324 ieee802154: at86rf230: use __func__ macro for debug messages

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Stefan Schmidt <[email protected]>

[ Upstream commit 8a81388ec27c4c0adbdecd20e67bb5f411ab46b2 ]

Instead of having the function name hard-coded (it might change and we forgot to update them in the debug output) we can use __func__ instead and also shorter the line so we do not need to break it. Also fix an extra blank line while being here.
Found by checkpatch.

---
 drivers/net/ieee802154/at86rf230.c |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/net/ieee802154/at86rf230.c +4 -9
@@ -1121,8 +1121,7 @@ at86rf230_set_hw_addr_filt(struct ieee80
 	if (changed & IEEE802154_AFILT_SADDR_CHANGED) {
 		u16 addr = le16_to_cpu(filt->short_addr);
 
-		dev_vdbg(&lp->spi->dev,
-			 "at86rf230_set_hw_addr_filt called for saddr\n");
+		dev_vdbg(&lp->spi->dev, "%s called for saddr\n", __func__);
 		__at86rf230_write(lp, RG_SHORT_ADDR_0, addr);
 		__at86rf230_write(lp, RG_SHORT_ADDR_1, addr >> 8);
 	}
@@ -1130,8 +1129,7 @@ at86rf230_set_hw_addr_filt(struct ieee80
 	if (changed & IEEE802154_AFILT_PANID_CHANGED) {
 		u16 pan = le16_to_cpu(filt->pan_id);
 
-		dev_vdbg(&lp->spi->dev,
-			 "at86rf230_set_hw_addr_filt called for pan id\n");
+		dev_vdbg(&lp->spi->dev, "%s called for pan id\n", __func__);
 		__at86rf230_write(lp, RG_PAN_ID_0, pan);
 		__at86rf230_write(lp, RG_PAN_ID_1, pan >> 8);
 	}
@@ -1140,15 +1138,13 @@ at86rf230_set_hw_addr_filt(struct ieee80
 		u8 i, addr[8];
 
 		memcpy(addr, &filt->ieee_addr, 8);
-		dev_vdbg(&lp->spi->dev,
-			 "at86rf230_set_hw_addr_filt called for IEEE addr\n");
+		dev_vdbg(&lp->spi->dev, "%s called for IEEE addr\n", __func__);
 		for (i = 0; i < 8; i++)
 			__at86rf230_write(lp, RG_IEEE_ADDR_0 + i, addr[i]);
 	}
 
 	if (changed & IEEE802154_AFILT_PANC_CHANGED) {
-		dev_vdbg(&lp->spi->dev,
-			 "at86rf230_set_hw_addr_filt called for panc change\n");
+		dev_vdbg(&lp->spi->dev, "%s called for panc change\n", __func__);
 		if (filt->pan_coord)
 			at86rf230_write_subreg(lp, SR_AACK_I_AM_COORD, 1);
 		else
@@ -1252,7 +1248,6 @@ at86rf230_set_cca_mode(struct ieee802154
 	return at86rf230_write_subreg(lp, SR_CCA_MODE, val);
 }
 
-
 static int
 at86rf230_set_cca_ed_level(struct ieee802154_hw *hw, s32 mbm)
 {
author maintainer
#219 lore raw

PATCH 227/324 ARC: Improve cmpxchg syscall implementation

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Peter Zijlstra <[email protected]>

[ Upstream commit e8708786d4fe21c043d38d760f768949a3d71185 ]

This is used in configs lacking hardware atomics to emulate atomic r-m-w for user space, implemented by disabling preemption in kernel.

However there are issues in current implementation:

1. Process not terminated if invalid user pointer passed:
i.e. __get_user() failed.

2. The reason for this patch was __put_user() failure not being handled either, specifically for the COW break scenario.
The zero page is initially wired up and read from __get_user() succeeds. A subsequent write by __put_user() induces a Protection Violation, but COW can't finish as Linux page fault handler is disabled due to preempt disable.
And what's worse is we silently return the stale value to user space. Fix this specific case by re-enabling preemption and explicitly fixing up the fault and retrying the whole sequence over.

---
 arch/arc/kernel/process.c |   47 +++++++++++++++++++++++++++++++++++-----------
 1 file changed, 36 insertions(+), 11 deletions(-)
arch/arc/kernel/process.c +36 -11
@@ -47,7 +47,8 @@ SYSCALL_DEFINE0(arc_gettls)
 SYSCALL_DEFINE3(arc_usr_cmpxchg, int *, uaddr, int, expected, int, new)
 {
 	struct pt_regs *regs = current_pt_regs();
-	int uval = -EFAULT;
+	u32 uval;
+	int ret;
 
 	/*
 	 * This is only for old cores lacking LLOCK/SCOND, which by defintion
@@ -60,23 +61,47 @@ SYSCALL_DEFINE3(arc_usr_cmpxchg, int *,
 	/* Z indicates to userspace if operation succeded */
 	regs->status32 &= ~STATUS_Z_MASK;
 
-	if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
-		return -EFAULT;
+	ret = access_ok(VERIFY_WRITE, uaddr, sizeof(*uaddr));
+	if (!ret)
+		 goto fail;
 
+again:
 	preempt_disable();
 
-	if (__get_user(uval, uaddr))
-		goto done;
+	ret = __get_user(uval, uaddr);
+	if (ret)
+		 goto fault;
 
-	if (uval == expected) {
-		if (!__put_user(new, uaddr))
-			regs->status32 |= STATUS_Z_MASK;
-	}
+	if (uval != expected)
+		 goto out;
 
-done:
-	preempt_enable();
+	ret = __put_user(new, uaddr);
+	if (ret)
+		 goto fault;
+
+	regs->status32 |= STATUS_Z_MASK;
 
+out:
+	preempt_enable();
 	return uval;
+
+fault:
+	preempt_enable();
+
+	if (unlikely(ret != -EFAULT))
+		 goto fail;
+
+	down_read(&current->mm->mmap_sem);
+	ret = fixup_user_fault(current, current->mm, (unsigned long) uaddr,
+			       FAULT_FLAG_WRITE, NULL);
+	up_read(&current->mm->mmap_sem);
+
+	if (likely(!ret))
+		 goto again;
+
+fail:
+	force_sig(SIGSEGV, current);
+	return ret;
 }
 
 #ifdef CONFIG_ISA_ARCV2
author maintainer
#220 lore raw

PATCH 229/324 bnxt_en: Fix inconsistent BNXT_FLAG_AGG_RINGS logic.

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Michael Chan <[email protected]>

[ Upstream commit 07f4fde53d12eb8d921b465bb298e964e0bdc38c ]

If there aren't enough RX rings available, the driver will attempt to use a single RX ring without the aggregation ring. If that also fails, the BNXT_FLAG_AGG_RINGS flag is cleared but the other ring parameters are not set consistently to reflect that. If more RX rings become available at the next open, the RX rings will be in an inconsistent state and may crash when freeing the RX rings.

Fix it by restoring the BNXT_FLAG_AGG_RINGS if not enough RX rings are available to run without aggregation rings.

Fixes bdbd1eb59c56 ("bnxt_en: Handle no aggregation ring gracefully.")
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +4 -1
@@ -8485,8 +8485,11 @@ static int bnxt_get_dflt_rings(struct bn
 		/* Not enough rings, try disabling agg rings. */
 		bp->flags &= ~BNXT_FLAG_AGG_RINGS;
 		rc = bnxt_get_max_rings(bp, max_rx, max_tx, shared);
-		if (rc)
+		if (rc) {
+			/* set BNXT_FLAG_AGG_RINGS back for consistency */
+			bp->flags |= BNXT_FLAG_AGG_RINGS;
 			return rc;
+		}
 		bp->flags |= BNXT_FLAG_NO_AGG_RINGS;
 		bp->dev->hw_features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW);
 		bp->dev->features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW);
author maintainer
#221 lore raw

PATCH 230/324 bnxt_en: Always set output parameters in bnxt_get_max_rings().

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Michael Chan <[email protected]>

[ Upstream commit 78f058a4aa0f2280dc4d45d2c4a95728398ef857 ]

The current code returns -ENOMEM and does not bother to set the output parameters to 0 when no rings are available. Some callers, such as bnxt_get_channels() will display garbage ring numbers when that happens. Fix it by always setting the output parameters.

Fixes 6e6c5a57fbe1 ("bnxt_en: Modify bnxt_get_max_rings() to support shared or non shared rings.")
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +2 -2
@@ -8467,11 +8467,11 @@ int bnxt_get_max_rings(struct bnxt *bp,
 	int rx, tx, cp;
 
 	_bnxt_get_max_rings(bp, &rx, &tx, &cp);
+	*max_rx = rx;
+	*max_tx = tx;
 	if (!rx || !tx || !cp)
 		return -ENOMEM;
 
-	*max_rx = rx;
-	*max_tx = tx;
 	return bnxt_trim_rings(bp, max_rx, max_tx, cp, shared);
 }
 
author maintainer
#227 lore raw

PATCH 236/324 scsi: qedi: Send driver state to MFW

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Manish Rangankar <[email protected]>

[ Upstream commit a3440d0d2f57f7ba102fc332086961cf261180af ]

In case of iSCSI offload BFS environment, MFW requires to mark virtual link based upon qedi load status.

---
 drivers/scsi/qedi/qedi_main.c |   11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/scsi/qedi/qedi_main.c +11 -0
@@ -2075,6 +2075,7 @@ kset_free:
 static void __qedi_remove(struct pci_dev *pdev, int mode)
 {
 	struct qedi_ctx *qedi = pci_get_drvdata(pdev);
+	int rval;
 
 	if (qedi->tmf_thread) {
 		flush_workqueue(qedi->tmf_thread);
@@ -2104,6 +2105,10 @@ static void __qedi_remove(struct pci_dev
 	if (mode == QEDI_MODE_NORMAL)
 		qedi_free_iscsi_pf_param(qedi);
 
+	rval = qedi_ops->common->update_drv_state(qedi->cdev, false);
+	if (rval)
+		QEDI_ERR(&qedi->dbg_ctx, "Failed to send drv state to MFW\n");
+
 	if (!test_bit(QEDI_IN_OFFLINE, &qedi->flags)) {
 		qedi_ops->common->slowpath_stop(qedi->cdev);
 		qedi_ops->common->remove(qedi->cdev);
@@ -2378,6 +2383,12 @@ static int __qedi_probe(struct pci_dev *
 		if (qedi_setup_boot_info(qedi))
 			QEDI_ERR(&qedi->dbg_ctx,
 				 "No iSCSI boot target configured\n");
+
+		rc = qedi_ops->common->update_drv_state(qedi->cdev, true);
+		if (rc)
+			QEDI_ERR(&qedi->dbg_ctx,
+				 "Failed to send drv state to MFW\n");
+
 	}
 
 	return 0;
author maintainer
#229 lore raw

PATCH 238/324 perf test shell: Prevent temporary editor files from being considered test scripts

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Kim Phillips <[email protected]>

[ Upstream commit db8fec583f250557ddd6def1505a6c466c9747aa ]

Allows a perf shell test developer to concurrently edit and run their test scripts, avoiding perf test attempts to execute their editor temporary files, such as seen here:

 $ sudo taskset -c 0 ./perf test -vvvvvvvv -F 63
 63: 0VIM 8.0                                              :
 --- start ---
 sh: 1: ./tests/shell/.record+probe_libc_inet_pton.sh.swp: Permission denied
 ---- end ----
 0VIM 8.0: FAILED!
---
 tools/perf/tests/builtin-test.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/builtin-test.c +1 -1
@@ -422,7 +422,7 @@ static const char *shell_test__descripti
 
 #define for_each_shell_test(dir, base, ent)	\
 	while ((ent = readdir(dir)) != NULL)	\
-		if (!is_directory(base, ent))
+		if (!is_directory(base, ent) && ent->d_name[0] != '.')
 
 static const char *shell_tests__dir(char *path, size_t size)
 {
author maintainer
#234 lore raw

PATCH 244/324 ARM: 8780/1: ftrace: Only set kernel memory back to read-only after boot

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: "Steven Rostedt (VMware)" <[email protected]>

[ Upstream commit b4c7e2bd2eb4764afe3af9409ff3b1b87116fa30 ]

Dynamic ftrace requires modifying the code segments that are usually set to read-only. To do this, a per arch function is called both before and after the ftrace modifications are performed. The "before" function will set kernel code text to read-write to allow for ftrace to make the modifications, and the "after" function will set the kernel code text back to "read-only" to keep the kernel code text protected.

The issue happens when dynamic ftrace is tested at boot up. The test is done before the kernel code text has been set to read-only. But the "before" and "after" calls are still performed. The "after" call will change the kernel code text to read-only prematurely, and other boot code that expects this code to be read-write will fail.

The solution is to add a variable that is set when the kernel code text is expected to be converted to read-only, and make the ftrace "before" and "after" calls do nothing if that variable is not yet set. This is similar to the x86 solution from commit 162396309745 ("ftrace, x86:
make kernel text writable only for conversions").

---
 arch/arm/mm/init.c |    9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm/mm/init.c +9 -0
@@ -736,20 +736,29 @@ static int __mark_rodata_ro(void *unused
 	return 0;
 }
 
+static int kernel_set_to_readonly __read_mostly;
+
 void mark_rodata_ro(void)
 {
+	kernel_set_to_readonly = 1;
 	stop_machine(__mark_rodata_ro, NULL, NULL);
 	debug_checkwx();
 }
 
 void set_kernel_text_rw(void)
 {
+	if (!kernel_set_to_readonly)
+		return;
+
 	set_section_perms(ro_perms, ARRAY_SIZE(ro_perms), false,
 				current->active_mm);
 }
 
 void set_kernel_text_ro(void)
 {
+	if (!kernel_set_to_readonly)
+		return;
+
 	set_section_perms(ro_perms, ARRAY_SIZE(ro_perms), true,
 				current->active_mm);
 }
author maintainer
#237 lore raw

PATCH 247/324 ARM: DRA7/OMAP5: Enable ACTLR[0] (Enable invalidates of BTB) for secondary cores

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Nishanth Menon <[email protected]>

[ Upstream commit 2f8b5b21830aea95989a6e67d8a971297272a086 ]

Call secure services to enable ACTLR[0] (Enable invalidates of BTB with ICIALLU) when branch hardening is enabled for kernel.

On GP devices OMAP5/DRA7, there is no possibility to update secure side since "secure world" is ROM and there are no override mechanisms possible. On HS devices, appropriate PPA should do the workarounds as well.

However, the configuration is only done for secondary core, since it is expected that firmware/bootloader will have enabled the required configuration for the primary boot core (note: bootloaders typically will NOT enable secondary processors, since it has no need to do so).

---
 arch/arm/mach-omap2/omap-smp.c |   41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
arch/arm/mach-omap2/omap-smp.c +41 -0
@@ -109,6 +109,45 @@ void omap5_erratum_workaround_801819(voi
 static inline void omap5_erratum_workaround_801819(void) { }
 #endif
 
+#ifdef CONFIG_HARDEN_BRANCH_PREDICTOR
+/*
+ * Configure ACR and enable ACTLR[0] (Enable invalidates of BTB with
+ * ICIALLU) to activate the workaround for secondary Core.
+ * NOTE: it is assumed that the primary core's configuration is done
+ * by the boot loader (kernel will detect a misconfiguration and complain
+ * if this is not done).
+ *
+ * In General Purpose(GP) devices, ACR bit settings can only be done
+ * by ROM code in "secure world" using the smc call and there is no
+ * option to update the "firmware" on such devices. This also works for
+ * High security(HS) devices, as a backup option in case the
+ * "update" is not done in the "security firmware".
+ */
+static void omap5_secondary_harden_predictor(void)
+{
+	u32 acr, acr_mask;
+
+	asm volatile ("mrc p15, 0, %0, c1, c0, 1" : "=r" (acr));
+
+	/*
+	 * ACTLR[0] (Enable invalidates of BTB with ICIALLU)
+	 */
+	acr_mask = BIT(0);
+
+	/* Do we already have it done.. if yes, skip expensive smc */
+	if ((acr & acr_mask) == acr_mask)
+		return;
+
+	acr |= acr_mask;
+	omap_smc1(OMAP5_DRA7_MON_SET_ACR_INDEX, acr);
+
+	pr_debug("%s: ARM ACR setup for CVE_2017_5715 applied on CPU%d\n",
+		 __func__, smp_processor_id());
+}
+#else
+static inline void omap5_secondary_harden_predictor(void) { }
+#endif
+
 static void omap4_secondary_init(unsigned int cpu)
 {
 	/*
@@ -131,6 +170,8 @@ static void omap4_secondary_init(unsigne
 		set_cntfreq();
 		/* Configure ACR to disable streaming WA for 801819 */
 		omap5_erratum_workaround_801819();
+		/* Enable ACR to allow for ICUALLU workaround */
+		omap5_secondary_harden_predictor();
 	}
 
 	/*
author maintainer
#239 lore raw

PATCH 249/324 ixgbe: Be more careful when modifying MAC filters

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Alexander Duyck <[email protected]>

[ Upstream commit d14c780c11fbc10f66c43e7b64eefe87ca442bd3 ]

This change makes it so that we are much more explicit about the ordering of updates to the receive address register (RAR) table. Prior to this patch I believe we may have been updating the table while entries were still active, or possibly allowing for reordering of things since we weren't explicitly flushing writes to either the lower or upper portion of the register prior to accessing the other half.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_common.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +11 -1
@@ -1897,7 +1897,12 @@ s32 ixgbe_set_rar_generic(struct ixgbe_h
 	if (enable_addr != 0)
 		rar_high |= IXGBE_RAH_AV;
 
+	/* Record lower 32 bits of MAC address and then make
+	 * sure that write is flushed to hardware before writing
+	 * the upper 16 bits and setting the valid bit.
+	 */
 	IXGBE_WRITE_REG(hw, IXGBE_RAL(index), rar_low);
+	IXGBE_WRITE_FLUSH(hw);
 	IXGBE_WRITE_REG(hw, IXGBE_RAH(index), rar_high);
 
 	return 0;
@@ -1929,8 +1934,13 @@ s32 ixgbe_clear_rar_generic(struct ixgbe
 	rar_high = IXGBE_READ_REG(hw, IXGBE_RAH(index));
 	rar_high &= ~(0x0000FFFF | IXGBE_RAH_AV);
 
-	IXGBE_WRITE_REG(hw, IXGBE_RAL(index), 0);
+	/* Clear the address valid bit and upper 16 bits of the address
+	 * before clearing the lower bits. This way we aren't updating
+	 * a live filter.
+	 */
 	IXGBE_WRITE_REG(hw, IXGBE_RAH(index), rar_high);
+	IXGBE_WRITE_FLUSH(hw);
+	IXGBE_WRITE_REG(hw, IXGBE_RAL(index), 0);
 
 	/* clear VMDq pool/queue selection for this RAR */
 	hw->mac.ops.clear_vmdq(hw, index, IXGBE_CLEAR_VMDQ_ALL);
author maintainer
#241 lore raw

PATCH 251/324 ixgbe: Off by one in ixgbe_ipsec_tx()

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <[email protected]>

[ Upstream commit c411104115e6821f26fc8f6de8b235ddf98de688 ]

The ipsec->tx_tbl[] has IXGBE_IPSEC_MAX_SA_COUNT elements so the > needs to be changed to >= so we don't read one element beyond the end of the array.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c +1 -1
@@ -759,7 +759,7 @@ int ixgbe_ipsec_tx(struct ixgbe_ring *tx
 	}
 
 	itd->sa_idx = xs->xso.offload_handle - IXGBE_IPSEC_BASE_TX_INDEX;
-	if (unlikely(itd->sa_idx > IXGBE_IPSEC_MAX_SA_COUNT)) {
+	if (unlikely(itd->sa_idx >= IXGBE_IPSEC_MAX_SA_COUNT)) {
 		netdev_err(tx_ring->netdev, "%s: bad sa_idx=%d handle=%lu\n",
 			   __func__, itd->sa_idx, xs->xso.offload_handle);
 		return 0;
author maintainer
#243 lore raw

PATCH 253/324 tools: build: Use HOSTLDFLAGS with fixdep

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Laura Abbott <[email protected]>

[ Upstream commit 8b247a92ebd0cda7dec49a6f771d9c4950f3d3ad ]

The final link of fixdep uses LDFLAGS but not the existing HOSTLDFLAGS. Fix this.

---
 tools/build/Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/build/Makefile +1 -1
@@ -43,7 +43,7 @@ $(OUTPUT)fixdep-in.o: FORCE
 	$(Q)$(MAKE) $(build)=fixdep
 
 $(OUTPUT)fixdep: $(OUTPUT)fixdep-in.o
-	$(QUIET_LINK)$(HOSTCC) $(LDFLAGS) -o $@ $<
+	$(QUIET_LINK)$(HOSTCC) $(HOSTLDFLAGS) -o $@ $<
 
 FORCE:
 
author maintainer
#245 lore raw

PATCH 256/324 sfc: hold filter_sem consistently during reset

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Bert Kenward <[email protected]>

[ Upstream commit 193f20033c54db0dc9563f722fbafbcd5fa0e80d ]

We should take and release the filter_sem consistently during the reset process, in the same manner as the mac_lock and reset_lock.

For lockdep consistency we also take the filter_sem for write around other calls to efx->type->init().

Fixes c2bebe37c6b6 ("sfc: give ef10 its own rwsem in the filter table instead of filter_lock")
---
 drivers/net/ethernet/sfc/efx.c |   17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/net/ethernet/sfc/efx.c +8 -9
@@ -1840,12 +1840,6 @@ static void efx_remove_filters(struct ef
 	up_write(&efx->filter_sem);
 }
 
-static void efx_restore_filters(struct efx_nic *efx)
-{
-	down_read(&efx->filter_sem);
-	efx->type->filter_table_restore(efx);
-	up_read(&efx->filter_sem);
-}
 
 /**************************************************************************
  *
@@ -2657,6 +2651,7 @@ void efx_reset_down(struct efx_nic *efx,
 	efx_disable_interrupts(efx);
 
 	mutex_lock(&efx->mac_lock);
+	down_write(&efx->filter_sem);
 	mutex_lock(&efx->rss_lock);
 	if (efx->port_initialized && method != RESET_TYPE_INVISIBLE &&
 	    method != RESET_TYPE_DATAPATH)
@@ -2714,9 +2709,8 @@ int efx_reset_up(struct efx_nic *efx, en
 	if (efx->type->rx_restore_rss_contexts)
 		efx->type->rx_restore_rss_contexts(efx);
 	mutex_unlock(&efx->rss_lock);
-	down_read(&efx->filter_sem);
-	efx_restore_filters(efx);
-	up_read(&efx->filter_sem);
+	efx->type->filter_table_restore(efx);
+	up_write(&efx->filter_sem);
 	if (efx->type->sriov_reset)
 		efx->type->sriov_reset(efx);
 
@@ -2733,6 +2727,7 @@ fail:
 	efx->port_initialized = false;
 
 	mutex_unlock(&efx->rss_lock);
+	up_write(&efx->filter_sem);
 	mutex_unlock(&efx->mac_lock);
 
 	return rc;
@@ -3440,7 +3435,9 @@ static int efx_pci_probe_main(struct efx
 
 	efx_init_napi(efx);
 
+	down_write(&efx->filter_sem);
 	rc = efx->type->init(efx);
+	up_write(&efx->filter_sem);
 	if (rc) {
 		netif_err(efx, probe, efx->net_dev,
 			  "failed to initialise NIC\n");
@@ -3729,7 +3726,9 @@ static int efx_pm_resume(struct device *
 	rc = efx->type->reset(efx, RESET_TYPE_ALL);
 	if (rc)
 		return rc;
+	down_write(&efx->filter_sem);
 	rc = efx->type->init(efx);
+	up_write(&efx->filter_sem);
 	if (rc)
 		return rc;
 	rc = efx_pm_thaw(dev);
author maintainer
#246 lore raw

PATCH 257/324 packet: reset network header if packet shorter than ll reserved space

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Willem de Bruijn <[email protected]>

[ Upstream commit 993675a3100b16a4c80dfd70cbcde8ea7127b31d ]

If variable length link layer headers result in a packet shorter than dev->hard_header_len, reset the network header offset. Else skb->mac_len may exceed skb->len after skb_mac_reset_len.

packet_sendmsg_spkt already has similar logic.

Fixes b84bbaf7a6c8 ("packet: in packet_snd start writing at link layer allocation")
---
 net/packet/af_packet.c |    2 ++
 1 file changed, 2 insertions(+)
net/packet/af_packet.c +2 -0
@@ -2910,6 +2910,8 @@ static int packet_snd(struct socket *soc
 			goto out_free;
 	} else if (reserve) {
 		skb_reserve(skb, -reserve);
+		if (len < reserve)
+			skb_reset_network_header(skb);
 	}
 
 	/* Returns -EFAULT on error */
author maintainer
#247 lore raw

PATCH 258/324 rtc: fix alarm read and set offset

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Alexandre Belloni <[email protected]>

[ Upstream commit fd6792bb022e43faa0c4a45b6f25285e21206f9d ]

The offset needs to be added after reading the alarm value.

It also needs to be subtracted after the now < alarm test.

---
 drivers/rtc/interface.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/rtc/interface.c +5 -3
@@ -265,8 +265,10 @@ int __rtc_read_alarm(struct rtc_device *
 			return err;
 
 		/* full-function RTCs won't have such missing fields */
-		if (rtc_valid_tm(&alarm->time) == 0)
+		if (rtc_valid_tm(&alarm->time) == 0) {
+			rtc_add_offset(rtc, &alarm->time);
 			return 0;
+		}
 
 		/* get the "after" timestamp, to detect wrapped fields */
 		err = rtc_read_time(rtc, &now);
@@ -409,7 +411,6 @@ static int __rtc_set_alarm(struct rtc_de
 	if (err)
 		return err;
 
-	rtc_subtract_offset(rtc, &alarm->time);
 	scheduled = rtc_tm_to_time64(&alarm->time);
 
 	/* Make sure we're not setting alarms in the past */
@@ -426,6 +427,8 @@ static int __rtc_set_alarm(struct rtc_de
 	 * over right here, before we set the alarm.
 	 */
 
+	rtc_subtract_offset(rtc, &alarm->time);
+
 	if (!rtc->ops)
 		err = -ENODEV;
 	else if (!rtc->ops->set_alarm)
@@ -467,7 +470,6 @@ int rtc_set_alarm(struct rtc_device *rtc
 
 	mutex_unlock(&rtc->ops_lock);
 
-	rtc_add_offset(rtc, &alarm->time);
 	return err;
 }
 EXPORT_SYMBOL_GPL(rtc_set_alarm);
author maintainer
#249 lore raw

PATCH 260/324 tcp: remove DELAYED ACK events in DCTCP

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Yuchung Cheng <[email protected]>

[ Upstream commit a69258f7aa2623e0930212f09c586fd06674ad79 ]

After fixing the way DCTCP tracking delayed ACKs, the delayed-ACK related callbacks are no longer needed

---
 include/net/tcp.h     |    2 --
 net/ipv4/tcp_dctcp.c  |   25 -------------------------
 net/ipv4/tcp_output.c |    4 ----
 3 files changed, 31 deletions(-)
include/net/tcp.h +0 -2
@@ -907,8 +907,6 @@ enum tcp_ca_event {
 	CA_EVENT_LOSS,		/* loss timeout */
 	CA_EVENT_ECN_NO_CE,	/* ECT set, but not CE marked */
 	CA_EVENT_ECN_IS_CE,	/* received CE marked IP packet */
-	CA_EVENT_DELAYED_ACK,	/* Delayed ack is sent */
-	CA_EVENT_NON_DELAYED_ACK,
 };
 
 /* Information about inbound ACK, passed to cong_ops->in_ack_event() */
net/ipv4/tcp_dctcp.c +0 -25
@@ -55,7 +55,6 @@ struct dctcp {
 	u32 dctcp_alpha;
 	u32 next_seq;
 	u32 ce_state;
-	u32 delayed_ack_reserved;
 	u32 loss_cwnd;
 };
 
@@ -96,7 +95,6 @@ static void dctcp_init(struct sock *sk)
 
 		ca->dctcp_alpha = min(dctcp_alpha_on_init, DCTCP_MAX_ALPHA);
 
-		ca->delayed_ack_reserved = 0;
 		ca->loss_cwnd = 0;
 		ca->ce_state = 0;
 
@@ -230,25 +228,6 @@ static void dctcp_state(struct sock *sk,
 	}
 }
 
-static void dctcp_update_ack_reserved(struct sock *sk, enum tcp_ca_event ev)
-{
-	struct dctcp *ca = inet_csk_ca(sk);
-
-	switch (ev) {
-	case CA_EVENT_DELAYED_ACK:
-		if (!ca->delayed_ack_reserved)
-			ca->delayed_ack_reserved = 1;
-		break;
-	case CA_EVENT_NON_DELAYED_ACK:
-		if (ca->delayed_ack_reserved)
-			ca->delayed_ack_reserved = 0;
-		break;
-	default:
-		/* Don't care for the rest. */
-		break;
-	}
-}
-
 static void dctcp_cwnd_event(struct sock *sk, enum tcp_ca_event ev)
 {
 	switch (ev) {
@@ -258,10 +237,6 @@ static void dctcp_cwnd_event(struct sock
 	case CA_EVENT_ECN_NO_CE:
 		dctcp_ce_state_1_to_0(sk);
 		break;
-	case CA_EVENT_DELAYED_ACK:
-	case CA_EVENT_NON_DELAYED_ACK:
-		dctcp_update_ack_reserved(sk, ev);
-		break;
 	default:
 		/* Don't care for the rest. */
 		break;
net/ipv4/tcp_output.c +0 -4
@@ -3545,8 +3545,6 @@ void tcp_send_delayed_ack(struct sock *s
 	int ato = icsk->icsk_ack.ato;
 	unsigned long timeout;
 
-	tcp_ca_event(sk, CA_EVENT_DELAYED_ACK);
-
 	if (ato > TCP_DELACK_MIN) {
 		const struct tcp_sock *tp = tcp_sk(sk);
 		int max_ato = HZ / 2;
@@ -3603,8 +3601,6 @@ void __tcp_send_ack(struct sock *sk, u32
 	if (sk->sk_state == TCP_CLOSE)
 		return;
 
-	tcp_ca_event(sk, CA_EVENT_NON_DELAYED_ACK);
-
 	/* We are not putting this on the write queue, so
 	 * tcp_transmit_skb() will set the ownership to this
 	 * sock.
author maintainer
#250 lore raw

PATCH 261/324 pinctrl: ingenic: Fix inverted direction for < JZ4770

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Paul Cercueil <[email protected]>

[ Upstream commit 0084a786ca8c84b443f67c4a697b4f2552761650 ]

The .gpio_set_direction() callback was setting inverted direction for SoCs older than the JZ4770, this restores the correct behaviour.

---
 drivers/pinctrl/pinctrl-ingenic.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinctrl-ingenic.c +1 -1
@@ -536,7 +536,7 @@ static int ingenic_pinmux_gpio_set_direc
 		ingenic_config_pin(jzpc, pin, JZ4770_GPIO_PAT1, input);
 	} else {
 		ingenic_config_pin(jzpc, pin, JZ4740_GPIO_SELECT, false);
-		ingenic_config_pin(jzpc, pin, JZ4740_GPIO_DIR, input);
+		ingenic_config_pin(jzpc, pin, JZ4740_GPIO_DIR, !input);
 		ingenic_config_pin(jzpc, pin, JZ4740_GPIO_FUNC, false);
 	}
 
author maintainer
#252 lore raw

PATCH 263/324 pinctrl: nsp: Fix potential NULL dereference

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Wei Yongjun <[email protected]>

[ Upstream commit c29e9da56bebb4c2c794e871b0dc0298bbf08142 ]

platform_get_resource() may fail and return NULL, so we should better check it's return value to avoid a NULL pointer dereference a bit later in the code.

This is detected by Coccinelle semantic patch.

@@
expression pdev, res, n, t, e, e1, e2;
@@

res = platform_get_resource(pdev, t, n);
+ if (!res)
+ return -EINVAL;
... when != res == NULL
e = devm_ioremap_nocache(e1, res->start, e2);

Fixes cc4fa83f66e9 ("pinctrl: nsp: add pinmux driver support for Broadcom NSP SoC")
---
 drivers/pinctrl/bcm/pinctrl-nsp-mux.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/pinctrl/bcm/pinctrl-nsp-mux.c +2 -0
@@ -577,6 +577,8 @@ static int nsp_pinmux_probe(struct platf
 		return PTR_ERR(pinctrl->base0);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+	if (!res)
+		return -EINVAL;
 	pinctrl->base1 = devm_ioremap_nocache(&pdev->dev, res->start,
 					      resource_size(res));
 	if (!pinctrl->base1) {
author maintainer
#256 lore raw

PATCH 267/324 drm/nouveau/gem: off by one bugs in nouveau_gem_pushbuf_reloc_apply()

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <[email protected]>

[ Upstream commit 7f073d011f93e92d4d225526b9ab6b8b0bbd6613 ]

The bo array has req->nr_buffers elements so the > should be >= so we don't read beyond the end of the array.

Fixes a1606a9596e5 ("drm/nouveau: new gem pushbuf interface, bump to 0.0.16")
---
 drivers/gpu/drm/nouveau/nouveau_gem.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nouveau_gem.c +2 -2
@@ -617,7 +617,7 @@ nouveau_gem_pushbuf_reloc_apply(struct n
 		struct nouveau_bo *nvbo;
 		uint32_t data;
 
-		if (unlikely(r->bo_index > req->nr_buffers)) {
+		if (unlikely(r->bo_index >= req->nr_buffers)) {
 			NV_PRINTK(err, cli, "reloc bo index invalid\n");
 			ret = -EINVAL;
 			break;
@@ -627,7 +627,7 @@ nouveau_gem_pushbuf_reloc_apply(struct n
 		if (b->presumed.valid)
 			continue;
 
-		if (unlikely(r->reloc_bo_index > req->nr_buffers)) {
+		if (unlikely(r->reloc_bo_index >= req->nr_buffers)) {
 			NV_PRINTK(err, cli, "reloc container bo index invalid\n");
 			ret = -EINVAL;
 			break;
author maintainer
#258 lore raw

PATCH 269/324 ibmvnic: Revise RX/TX queue error messages

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Thomas Falcon <[email protected]>

[ Upstream commit 2d14d3795294d42aacc278948984a480569bcc23 ]

During a device failover, there may be latency between the loss of the current backing device and a notification from firmware that a failover has occurred. This latency can result in a large amount of error printouts as firmware returns outgoing traffic with a generic error code. These are not necessarily errors in this case as the firmware is busy swapping in a new backing adapter and is not ready to send packets yet. This patch reclassifies those error codes as warnings with an explanation that a failover may be pending. All other return codes will be considered errors.

---
 drivers/net/ethernet/ibm/ibmvnic.c |   39 +++++++++++++++++++++++++------------
 1 file changed, 27 insertions(+), 12 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +27 -12
@@ -319,7 +319,8 @@ static void replenish_rx_pool(struct ibm
 	return;
 
 failure:
-	dev_info(dev, "replenish pools failure\n");
+	if (lpar_rc != H_PARAMETER && lpar_rc != H_CLOSED)
+		dev_err_ratelimited(dev, "rx: replenish packet buffer failed\n");
 	pool->free_map[pool->next_free] = index;
 	pool->rx_buff[index].skb = NULL;
 
@@ -1594,7 +1595,8 @@ static int ibmvnic_xmit(struct sk_buff *
 				      &tx_crq);
 	}
 	if (lpar_rc != H_SUCCESS) {
-		dev_err(dev, "tx failed with code %ld\n", lpar_rc);
+		if (lpar_rc != H_CLOSED && lpar_rc != H_PARAMETER)
+			dev_err_ratelimited(dev, "tx: send failed\n");
 		dev_kfree_skb_any(skb);
 		tx_buff->skb = NULL;
 
@@ -3085,6 +3087,25 @@ static union ibmvnic_crq *ibmvnic_next_c
 	return crq;
 }
 
+static void print_subcrq_error(struct device *dev, int rc, const char *func)
+{
+	switch (rc) {
+	case H_PARAMETER:
+		dev_warn_ratelimited(dev,
+				     "%s failed: Send request is malformed or adapter failover pending. (rc=%d)\n",
+				     func, rc);
+		break;
+	case H_CLOSED:
+		dev_warn_ratelimited(dev,
+				     "%s failed: Backing queue closed. Adapter is down or failover pending. (rc=%d)\n",
+				     func, rc);
+		break;
+	default:
+		dev_err_ratelimited(dev, "%s failed: (rc=%d)\n", func, rc);
+		break;
+	}
+}
+
 static int send_subcrq(struct ibmvnic_adapter *adapter, u64 remote_handle,
 		       union sub_crq *sub_crq)
 {
@@ -3111,11 +3132,8 @@ static int send_subcrq(struct ibmvnic_ad
 				cpu_to_be64(u64_crq[2]),
 				cpu_to_be64(u64_crq[3]));
 
-	if (rc) {
-		if (rc == H_CLOSED)
-			dev_warn(dev, "CRQ Queue closed\n");
-		dev_err(dev, "Send error (rc=%d)\n", rc);
-	}
+	if (rc)
+		print_subcrq_error(dev, rc, __func__);
 
 	return rc;
 }
@@ -3133,11 +3151,8 @@ static int send_subcrq_indirect(struct i
 				cpu_to_be64(remote_handle),
 				ioba, num_entries);
 
-	if (rc) {
-		if (rc == H_CLOSED)
-			dev_warn(dev, "CRQ Queue closed\n");
-		dev_err(dev, "Send (indirect) error (rc=%d)\n", rc);
-	}
+	if (rc)
+		print_subcrq_error(dev, rc, __func__);
 
 	return rc;
 }
author maintainer
#260 lore raw

PATCH 271/324 net/ethernet/freescale/fman: fix cross-build error

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Randy Dunlap <[email protected]>

[ Upstream commit c133459765fae249ba482f62e12f987aec4376f0 ]

CC [M] drivers/net/ethernet/freescale/fman/fman.o
In file included from ../drivers/net/ethernet/freescale/fman/fman.c:35:
../include/linux/fsl/guts.h: In function 'guts_set_dmacr':
../include/linux/fsl/guts.h:165:2: error: implicit declaration of function 'clrsetbits_be32' [-Werror=implicit-function-declaration]
clrsetbits_be32(&guts->dmacr, 3 << shift, device << shift);
^~~~~~~~~~~~~~~

---
 include/linux/fsl/guts.h |    1 +
 1 file changed, 1 insertion(+)
include/linux/fsl/guts.h +1 -0
@@ -16,6 +16,7 @@
 #define __FSL_GUTS_H__
 
 #include <linux/types.h>
+#include <linux/io.h>
 
 /**
  * Global Utility Registers.
author maintainer
#262 lore raw

PATCH 273/324 ARM: dts: omap4-droid4: fix dts w.r.t. pwm

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Pavel Machek <[email protected]>

[ Upstream commit d3f6daede246038cf2ea38b78d732f9dd8feb1d6 ]

pwm node should not be under gpio6 node in the device tree.

This fixes detection of the pwm on Droid 4.

Fixes 6d7bdd328da4 ("ARM: dts: omap4-droid4: update touchscreen")
[[email protected]: added fixes tag]
---
 arch/arm/boot/dts/omap4-droid4-xt894.dts |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
arch/arm/boot/dts/omap4-droid4-xt894.dts +3 -6
@@ -159,13 +159,7 @@
 
 		dais = <&mcbsp2_port>, <&mcbsp3_port>;
 	};
-};
-
-&dss {
-	status = "okay";
-};
 
-&gpio6 {
 	pwm8: dmtimer-pwm-8 {
 		pinctrl-names = "default";
 		pinctrl-0 = <&vibrator_direction_pin>;
@@ -192,7 +186,10 @@
 		pwm-names = "enable", "direction";
 		direction-duty-cycle-ns = <10000000>;
 	};
+};
 
+&dss {
+	status = "okay";
 };
 
 &dsi1 {
author maintainer
#270 lore raw

PATCH 281/324 PCI: xgene: Fix I/O space page leak

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Sergei Shtylyov <[email protected]>

[ Upstream commit 925652d03589084850023d8924b376b7ee3c1b1b ]

When testing the R-Car PCIe driver on the Condor board, if the PCIe PHY driver was left disabled, the kernel crashed with this BUG:

kernel BUG at lib/ioremap.c:72!

  Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
  Modules linked in:
  CPU: 0 PID: 39 Comm: kworker/0:1 Not tainted 4.17.0-dirty #1092
  Hardware name: Renesas Condor board based on r8a77980 (DT)
  Workqueue: events deferred_probe_work_func
  pstate: 80000005 (Nzcv daif -PAN -UAO)
  pc : ioremap_page_range+0x370/0x3c8
  lr : ioremap_page_range+0x40/0x3c8
  sp : ffff000008da39e0
  x29: ffff000008da39e0 x28: 00e8000000000f07
  x27: ffff7dfffee00000 x26: 0140000000000000
  x25: ffff7dfffef00000 x24: 00000000000fe100
  x23: ffff80007b906000 x22: ffff000008ab8000
  x21: ffff000008bb1d58 x20: ffff7dfffef00000
  x19: ffff800009c30fb8 x18: 0000000000000001
  x17: 00000000000152d0 x16: 00000000014012d0
  x15: 0000000000000000 x14: 0720072007200720
  x13: 0720072007200720 x12: 0720072007200720
  x11: 0720072007300730 x10: 00000000000000ae
  x9 : 0000000000000000 x8 : ffff7dffff000000
  x7 : 0000000000000000 x6 : 0000000000000100
  x5 : 0000000000000000 x4 : 000000007b906000
  x3 : ffff80007c61a880 x2 : ffff7dfffeefffff
  x1 : 0000000040000000 x0 : 00e80000fe100f07
  Process kworker/0:1 (pid: 39, stack limit = 0x        (ptrval))
  Call trace:
   ioremap_page_range+0x370/0x3c8
   pci_remap_iospace+0x7c/0xac
   pci_parse_request_of_pci_ranges+0x13c/0x190
   rcar_pcie_probe+0x4c/0xb04
   platform_drv_probe+0x50/0xbc
   driver_probe_device+0x21c/0x308
   __device_attach_driver+0x98/0xc8
   bus_for_each_drv+0x54/0x94
   __device_attach+0xc4/0x12c
   device_initial_probe+0x10/0x18
   bus_probe_device+0x90/0x98
   deferred_probe_work_func+0xb0/0x150
   process_one_work+0x12c/0x29c
   worker_thread+0x200/0x3fc
   kthread+0x108/0x134
   ret_from_fork+0x10/0x18
  Code: f9004ba2 54000080 aa0003fb 17ffff48 (d4210000)

It turned out that pci_remap_iospace() wasn't undone when the driver's probe failed, and since devm_phy_optional_get() returned -EPROBE_DEFER, the probe was retried, finally causing the BUG due to trying to remap already remapped pages.

The X-Gene PCI controller driver has the same issue. Replace pci_remap_iospace() with the devm_ managed version so that the pages get unmapped automagically on any probe failure.

Fixes 5f6b6ccdbe1c ("PCI: xgene: Add APM X-Gene PCIe driver")
[[email protected]: updated the commit log]
---
 drivers/pci/host/pci-xgene.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/host/pci-xgene.c +1 -1
@@ -421,7 +421,7 @@ static int xgene_pcie_map_ranges(struct
 		case IORESOURCE_IO:
 			xgene_pcie_setup_ob_reg(port, res, OMR3BARL, io_base,
 						res->start - window->offset);
-			ret = pci_remap_iospace(res, io_base);
+			ret = devm_pci_remap_iospace(dev, res, io_base);
 			if (ret < 0)
 				return ret;
 			break;
author maintainer
#275 lore raw

PATCH 286/324 PCI: mediatek: Fix I/O space page leak

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Sergei Shtylyov <[email protected]>

[ Upstream commit 438477b9a089e45ea7c8fb549553e52833117ed8 ]

When testing the R-Car PCIe driver on the Condor board, if the PCIe PHY driver was left disabled, the kernel crashed with this BUG:

kernel BUG at lib/ioremap.c:72!

  Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
  Modules linked in:
  CPU: 0 PID: 39 Comm: kworker/0:1 Not tainted 4.17.0-dirty #1092
  Hardware name: Renesas Condor board based on r8a77980 (DT)
  Workqueue: events deferred_probe_work_func
  pstate: 80000005 (Nzcv daif -PAN -UAO)
  pc : ioremap_page_range+0x370/0x3c8
  lr : ioremap_page_range+0x40/0x3c8
  sp : ffff000008da39e0
  x29: ffff000008da39e0 x28: 00e8000000000f07
  x27: ffff7dfffee00000 x26: 0140000000000000
  x25: ffff7dfffef00000 x24: 00000000000fe100
  x23: ffff80007b906000 x22: ffff000008ab8000
  x21: ffff000008bb1d58 x20: ffff7dfffef00000
  x19: ffff800009c30fb8 x18: 0000000000000001
  x17: 00000000000152d0 x16: 00000000014012d0
  x15: 0000000000000000 x14: 0720072007200720
  x13: 0720072007200720 x12: 0720072007200720
  x11: 0720072007300730 x10: 00000000000000ae
  x9 : 0000000000000000 x8 : ffff7dffff000000
  x7 : 0000000000000000 x6 : 0000000000000100
  x5 : 0000000000000000 x4 : 000000007b906000
  x3 : ffff80007c61a880 x2 : ffff7dfffeefffff
  x1 : 0000000040000000 x0 : 00e80000fe100f07
  Process kworker/0:1 (pid: 39, stack limit = 0x        (ptrval))
  Call trace:
   ioremap_page_range+0x370/0x3c8
   pci_remap_iospace+0x7c/0xac
   pci_parse_request_of_pci_ranges+0x13c/0x190
   rcar_pcie_probe+0x4c/0xb04
   platform_drv_probe+0x50/0xbc
   driver_probe_device+0x21c/0x308
   __device_attach_driver+0x98/0xc8
   bus_for_each_drv+0x54/0x94
   __device_attach+0xc4/0x12c
   device_initial_probe+0x10/0x18
   bus_probe_device+0x90/0x98
   deferred_probe_work_func+0xb0/0x150
   process_one_work+0x12c/0x29c
   worker_thread+0x200/0x3fc
   kthread+0x108/0x134
   ret_from_fork+0x10/0x18
  Code: f9004ba2 54000080 aa0003fb 17ffff48 (d4210000)

It turned out that pci_remap_iospace() wasn't undone when the driver's probe failed, and since devm_phy_optional_get() returned -EPROBE_DEFER, the probe was retried, finally causing the BUG due to trying to remap already remapped pages.

The MediaTek PCIe driver has the same issue.

Replace devm_pci_remap_iospace() with its devm_ managed counterpart to fix the bug.

Fixes 637cfacae96f ("PCI: mediatek: Add MediaTek PCIe host controller support")
[[email protected]: updated the commit log]
---
 drivers/pci/host/pcie-mediatek.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/host/pcie-mediatek.c +1 -1
@@ -1063,7 +1063,7 @@ static int mtk_pcie_request_resources(st
 	if (err < 0)
 		return err;
 
-	pci_remap_iospace(&pcie->pio, pcie->io.start);
+	devm_pci_remap_iospace(dev, &pcie->pio, pcie->io.start);
 
 	return 0;
 }
author maintainer
#276 lore raw

PATCH 287/324 PCI: v3-semi: Fix I/O space page leak

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Sergei Shtylyov <[email protected]>

[ Upstream commit 270ed733e68955049b693bea8f4a1efb293a96ae ]

When testing the R-Car PCIe driver on the Condor board, if the PCIe PHY driver was left disabled, the kernel crashed with this BUG:

kernel BUG at lib/ioremap.c:72!

  Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
  Modules linked in:
  CPU: 0 PID: 39 Comm: kworker/0:1 Not tainted 4.17.0-dirty #1092
  Hardware name: Renesas Condor board based on r8a77980 (DT)
  Workqueue: events deferred_probe_work_func
  pstate: 80000005 (Nzcv daif -PAN -UAO)
  pc : ioremap_page_range+0x370/0x3c8
  lr : ioremap_page_range+0x40/0x3c8
  sp : ffff000008da39e0
  x29: ffff000008da39e0 x28: 00e8000000000f07
  x27: ffff7dfffee00000 x26: 0140000000000000
  x25: ffff7dfffef00000 x24: 00000000000fe100
  x23: ffff80007b906000 x22: ffff000008ab8000
  x21: ffff000008bb1d58 x20: ffff7dfffef00000
  x19: ffff800009c30fb8 x18: 0000000000000001
  x17: 00000000000152d0 x16: 00000000014012d0
  x15: 0000000000000000 x14: 0720072007200720
  x13: 0720072007200720 x12: 0720072007200720
  x11: 0720072007300730 x10: 00000000000000ae
  x9 : 0000000000000000 x8 : ffff7dffff000000
  x7 : 0000000000000000 x6 : 0000000000000100
  x5 : 0000000000000000 x4 : 000000007b906000
  x3 : ffff80007c61a880 x2 : ffff7dfffeefffff
  x1 : 0000000040000000 x0 : 00e80000fe100f07
  Process kworker/0:1 (pid: 39, stack limit = 0x        (ptrval))
  Call trace:
   ioremap_page_range+0x370/0x3c8
   pci_remap_iospace+0x7c/0xac
   pci_parse_request_of_pci_ranges+0x13c/0x190
   rcar_pcie_probe+0x4c/0xb04
   platform_drv_probe+0x50/0xbc
   driver_probe_device+0x21c/0x308
   __device_attach_driver+0x98/0xc8
   bus_for_each_drv+0x54/0x94
   __device_attach+0xc4/0x12c
   device_initial_probe+0x10/0x18
   bus_probe_device+0x90/0x98
   deferred_probe_work_func+0xb0/0x150
   process_one_work+0x12c/0x29c
   worker_thread+0x200/0x3fc
   kthread+0x108/0x134
   ret_from_fork+0x10/0x18
  Code: f9004ba2 54000080 aa0003fb 17ffff48 (d4210000)

It turned out that pci_remap_iospace() wasn't undone when the driver's probe failed, and since devm_phy_optional_get() returned -EPROBE_DEFER, the probe was retried, finally causing the BUG due to trying to remap already remapped pages.

The V3 Semiconductor PCI driver has the same issue.
Replace devm_pci_remap_iospace() with its devm_ managed version to fix the bug.

Fixes 68a15eb7bd0c ("PCI: v3-semi: Add V3 Semiconductor PCI host driver")
[[email protected]: updated the commit log]
---
 drivers/pci/host/pci-v3-semi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/host/pci-v3-semi.c +1 -1
@@ -535,7 +535,7 @@ static int v3_pci_setup_resource(struct
 		v3->io_bus_addr = io->start - win->offset;
 		dev_dbg(dev, "I/O window %pR, bus addr %pap\n",
 			io, &v3->io_bus_addr);
-		ret = pci_remap_iospace(io, io_base);
+		ret = devm_pci_remap_iospace(dev, io, io_base);
 		if (ret) {
 			dev_warn(dev,
 				 "error %d: failed to map resource %pR\n",
author maintainer
#281 lore raw

PATCH 293/324 soc: imx: gpc: restrict register range for regmap access

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Anson Huang <[email protected]>

[ Upstream commit de2d9b5284bcb5c159c5882ac69f6bfd4dec7c67 ]

GPC registers are NOT continuous, some registers are reserved and accessing them from userspace will trigger external abort, add regmap register access table to avoid below abort:

root@imx6slevk:~# cat /sys/kernel/debug/regmap/20dc000.gpc/registers
[  108.480477] Unhandled fault: imprecise external abort (0x1406) at 0xb6db5004
[  108.487985] pgd = 42b54bfd
[  108.490741] [b6db5004] *pgd=ba1b7831
[  108.494386] Internal error: : 1406 [#1] SMP ARM
[  108.498943] Modules linked in:
[  108.502043] CPU: 0 PID: 389 Comm: cat Not tainted 4.18.0-rc1-00074-gc9f1f60-dirty #482
[  108.509982] Hardware name: Freescale i.MX6 SoloLite (Device Tree)
[  108.516123] PC is at regmap_mmio_read32le+0x20/0x24
[  108.521031] LR is at regmap_mmio_read+0x40/0x60
[  108.525586] pc : [<c059cf74>]    lr : [<c059d1ac>]    psr: 20060093
[  108.531875] sp : eccf1d98  ip : eccf1da8  fp : eccf1da4
[  108.537122] r10: ec2d3800  r9 : eccf1f60  r8 : ecfc0000
[  108.542370] r7 : eccf1e2c  r6 : eccf1e2c  r5 : 00000028  r4 : ec338e00
[  108.548920] r3 : 00000000  r2 : eccf1e2c  r1 : f0980028  r0 : 00000000
[  108.555474] Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none
[  108.562720] Control: 10c5387d  Table: acf4004a  DAC: 00000051
[  108.568491] Process cat (pid: 389, stack limit = 0xd4318a65)
[  108.574174] Stack: (0xeccf1d98 to 0xeccf2000)
Fixes 721cabf6c660 ("soc: imx: move PGC handling to a new GPC driver")
---
 drivers/soc/imx/gpc.c |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
drivers/soc/imx/gpc.c +21 -0
@@ -27,9 +27,16 @@
 #define GPC_PGC_SW2ISO_SHIFT	0x8
 #define GPC_PGC_SW_SHIFT	0x0
 
+#define GPC_PGC_PCI_PDN		0x200
+#define GPC_PGC_PCI_SR		0x20c
+
 #define GPC_PGC_GPU_PDN		0x260
 #define GPC_PGC_GPU_PUPSCR	0x264
 #define GPC_PGC_GPU_PDNSCR	0x268
+#define GPC_PGC_GPU_SR		0x26c
+
+#define GPC_PGC_DISP_PDN	0x240
+#define GPC_PGC_DISP_SR		0x24c
 
 #define GPU_VPU_PUP_REQ		BIT(1)
 #define GPU_VPU_PDN_REQ		BIT(0)
@@ -318,10 +325,24 @@ static const struct of_device_id imx_gpc
 	{ }
 };
 
+static const struct regmap_range yes_ranges[] = {
+	regmap_reg_range(GPC_CNTR, GPC_CNTR),
+	regmap_reg_range(GPC_PGC_PCI_PDN, GPC_PGC_PCI_SR),
+	regmap_reg_range(GPC_PGC_GPU_PDN, GPC_PGC_GPU_SR),
+	regmap_reg_range(GPC_PGC_DISP_PDN, GPC_PGC_DISP_SR),
+};
+
+static const struct regmap_access_table access_table = {
+	.yes_ranges	= yes_ranges,
+	.n_yes_ranges	= ARRAY_SIZE(yes_ranges),
+};
+
 static const struct regmap_config imx_gpc_regmap_config = {
 	.reg_bits = 32,
 	.val_bits = 32,
 	.reg_stride = 4,
+	.rd_table = &access_table,
+	.wr_table = &access_table,
 	.max_register = 0x2ac,
 };
 
author maintainer
#286 lore raw

PATCH 300/324 mm: make vm_area_alloc() initialize core fields

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Linus Torvalds <[email protected]>

[ Upstream commit 490fc053865c9cc40f1085ef8a5504f5341f79d2 ]

Like vm_area_dup(), it initializes the anon_vma_chain head, and the basic mm pointer.

The rest of the fields end up being different for different users, although the plan is to also initialize the 'vm_ops' field to a dummy entry.

---
 arch/ia64/kernel/perfmon.c |    4 +---
 arch/ia64/mm/init.c        |    8 ++------
 fs/exec.c                  |    4 +---
 include/linux/mm.h         |    2 +-
 kernel/fork.c              |   10 ++++++++--
 mm/mmap.c                  |   12 +++---------
 mm/nommu.c                 |    3 +--
 7 files changed, 17 insertions(+), 26 deletions(-)
arch/ia64/kernel/perfmon.c +1 -3
@@ -2278,17 +2278,15 @@ pfm_smpl_buffer_alloc(struct task_struct
 	DPRINT(("smpl_buf @%p\n", smpl_buf));
 
 	/* allocate vma */
-	vma = vm_area_alloc();
+	vma = vm_area_alloc(mm);
 	if (!vma) {
 		DPRINT(("Cannot allocate vma\n"));
 		goto error_kmem;
 	}
-	INIT_LIST_HEAD(&vma->anon_vma_chain);
 
 	/*
 	 * partially initialize the vma for the sampling buffer
 	 */
-	vma->vm_mm	     = mm;
 	vma->vm_file	     = get_file(filp);
 	vma->vm_flags	     = VM_READ|VM_MAYREAD|VM_DONTEXPAND|VM_DONTDUMP;
 	vma->vm_page_prot    = PAGE_READONLY; /* XXX may need to change */
arch/ia64/mm/init.c +2 -6
@@ -114,10 +114,8 @@ ia64_init_addr_space (void)
 	 * the problem.  When the process attempts to write to the register backing store
 	 * for the first time, it will get a SEGFAULT in this case.
 	 */
-	vma = vm_area_alloc();
+	vma = vm_area_alloc(current->mm);
 	if (vma) {
-		INIT_LIST_HEAD(&vma->anon_vma_chain);
-		vma->vm_mm = current->mm;
 		vma->vm_start = current->thread.rbs_bot & PAGE_MASK;
 		vma->vm_end = vma->vm_start + PAGE_SIZE;
 		vma->vm_flags = VM_DATA_DEFAULT_FLAGS|VM_GROWSUP|VM_ACCOUNT;
@@ -133,10 +131,8 @@ ia64_init_addr_space (void)
 
 	/* map NaT-page at address zero to speed up speculative dereferencing of NULL: */
 	if (!(current->personality & MMAP_PAGE_ZERO)) {
-		vma = vm_area_alloc();
+		vma = vm_area_alloc(current->mm);
 		if (vma) {
-			INIT_LIST_HEAD(&vma->anon_vma_chain);
-			vma->vm_mm = current->mm;
 			vma->vm_end = PAGE_SIZE;
 			vma->vm_page_prot = __pgprot(pgprot_val(PAGE_READONLY) | _PAGE_MA_NAT);
 			vma->vm_flags = VM_READ | VM_MAYREAD | VM_IO |
fs/exec.c +1 -3
@@ -290,7 +290,7 @@ static int __bprm_mm_init(struct linux_b
 	struct vm_area_struct *vma = NULL;
 	struct mm_struct *mm = bprm->mm;
 
-	bprm->vma = vma = vm_area_alloc();
+	bprm->vma = vma = vm_area_alloc(mm);
 	if (!vma)
 		return -ENOMEM;
 
@@ -298,7 +298,6 @@ static int __bprm_mm_init(struct linux_b
 		err = -EINTR;
 		goto err_free;
 	}
-	vma->vm_mm = mm;
 
 	/*
 	 * Place the stack at the largest stack address the architecture
@@ -311,7 +310,6 @@ static int __bprm_mm_init(struct linux_b
 	vma->vm_start = vma->vm_end - PAGE_SIZE;
 	vma->vm_flags = VM_SOFTDIRTY | VM_STACK_FLAGS | VM_STACK_INCOMPLETE_SETUP;
 	vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
-	INIT_LIST_HEAD(&vma->anon_vma_chain);
 
 	err = insert_vm_struct(mm, vma);
 	if (err)
include/linux/mm.h +1 -1
@@ -154,7 +154,7 @@ extern int overcommit_kbytes_handler(str
  * mmap() functions).
  */
 
-struct vm_area_struct *vm_area_alloc(void);
+struct vm_area_struct *vm_area_alloc(struct mm_struct *);
 struct vm_area_struct *vm_area_dup(struct vm_area_struct *);
 void vm_area_free(struct vm_area_struct *);
 
kernel/fork.c +8 -2
@@ -308,9 +308,15 @@ static struct kmem_cache *vm_area_cachep
 /* SLAB cache for mm_struct structures (tsk->mm) */
 static struct kmem_cache *mm_cachep;
 
-struct vm_area_struct *vm_area_alloc(void)
+struct vm_area_struct *vm_area_alloc(struct mm_struct *mm)
 {
-	return kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
+	struct vm_area_struct *vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
+
+	if (vma) {
+		vma->vm_mm = mm;
+		INIT_LIST_HEAD(&vma->anon_vma_chain);
+	}
+	return vma;
 }
 
 struct vm_area_struct *vm_area_dup(struct vm_area_struct *orig)
mm/mmap.c +3 -9
@@ -1729,19 +1729,17 @@ unsigned long mmap_region(struct file *f
 	 * specific mapper. the address has already been validated, but
 	 * not unmapped, but the maps are removed from the list.
 	 */
-	vma = vm_area_alloc();
+	vma = vm_area_alloc(mm);
 	if (!vma) {
 		error = -ENOMEM;
 		goto unacct_error;
 	}
 
-	vma->vm_mm = mm;
 	vma->vm_start = addr;
 	vma->vm_end = addr + len;
 	vma->vm_flags = vm_flags;
 	vma->vm_page_prot = vm_get_page_prot(vm_flags);
 	vma->vm_pgoff = pgoff;
-	INIT_LIST_HEAD(&vma->anon_vma_chain);
 
 	if (file) {
 		if (vm_flags & VM_DENYWRITE) {
@@ -2979,14 +2977,12 @@ static int do_brk_flags(unsigned long ad
 	/*
 	 * create a vma struct for an anonymous mapping
 	 */
-	vma = vm_area_alloc();
+	vma = vm_area_alloc(mm);
 	if (!vma) {
 		vm_unacct_memory(len >> PAGE_SHIFT);
 		return -ENOMEM;
 	}
 
-	INIT_LIST_HEAD(&vma->anon_vma_chain);
-	vma->vm_mm = mm;
 	vma->vm_start = addr;
 	vma->vm_end = addr + len;
 	vma->vm_pgoff = pgoff;
@@ -3343,12 +3339,10 @@ static struct vm_area_struct *__install_
 	int ret;
 	struct vm_area_struct *vma;
 
-	vma = vm_area_alloc();
+	vma = vm_area_alloc(mm);
 	if (unlikely(vma == NULL))
 		return ERR_PTR(-ENOMEM);
 
-	INIT_LIST_HEAD(&vma->anon_vma_chain);
-	vma->vm_mm = mm;
 	vma->vm_start = addr;
 	vma->vm_end = addr + len;
 
mm/nommu.c +1 -2
@@ -1204,7 +1204,7 @@ unsigned long do_mmap(struct file *file,
 	if (!region)
 		goto error_getting_region;
 
-	vma = vm_area_alloc();
+	vma = vm_area_alloc(current->mm);
 	if (!vma)
 		goto error_getting_vma;
 
@@ -1212,7 +1212,6 @@ unsigned long do_mmap(struct file *file,
 	region->vm_flags = vm_flags;
 	region->vm_pgoff = pgoff;
 
-	INIT_LIST_HEAD(&vma->anon_vma_chain);
 	vma->vm_flags = vm_flags;
 	vma->vm_pgoff = pgoff;
 
author maintainer
#287 lore raw

PATCH 301/324 EDAC: Add missing MEM_LRDDR4 entry in edac_mem_types[]

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <[email protected]>

commit b748f2de4b2f578599f46c6000683a8da755bf68 upstream.

The edac_mem_types[] array misses a MEM_LRDDR4 entry, which leads to NULL pointer dereference when accessed via sysfs or such.

Cc Mauro Carvalho Chehab <[email protected]>
Cc Yazen Ghannam <[email protected]>
Cc linux-edac <[email protected]>
Fixes 1e8096bb2031 ("EDAC: Add LRDDR4 DRAM type")
---
 drivers/edac/edac_mc.c |    1 +
 1 file changed, 1 insertion(+)
drivers/edac/edac_mc.c +1 -0
@@ -215,6 +215,7 @@ const char * const edac_mem_types[] = {
 	[MEM_LRDDR3]	= "Load-Reduced-DDR3-RAM",
 	[MEM_DDR4]	= "Unbuffered-DDR4",
 	[MEM_RDDR4]	= "Registered-DDR4",
+	[MEM_LRDDR4]	= "Load-Reduced-DDR4-RAM",
 	[MEM_NVDIMM]	= "Non-volatile-RAM",
 };
 EXPORT_SYMBOL_GPL(edac_mem_types);
author maintainer
#288 lore raw

PATCH 302/324 pty: fix O_CLOEXEC for TIOCGPTPEER

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Matthijs van Duin <[email protected]>

commit 36ecc1481dc8d8c52d43ba18c6b642c1d2fde789 upstream.

It was being ignored because the flags were not passed to fd allocation.

Fixes 54ebbfb16034 ("tty: add TIOCGPTPEER ioctl")
Cc stable <[email protected]>
---
 drivers/tty/pty.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/pty.c +1 -1
@@ -625,7 +625,7 @@ int ptm_open_peer(struct file *master, s
 	if (tty->driver != ptm_driver)
 		return -EIO;
 
-	fd = get_unused_fd_flags(0);
+	fd = get_unused_fd_flags(flags);
 	if (fd < 0) {
 		retval = fd;
 		goto err;
author maintainer
#289 lore raw

PATCH 303/324 mm: Allow non-direct-map arguments to free_reserved_area()

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Dave Hansen <[email protected]>

commit 0d83432811f26871295a9bc24d3c387924da6071 upstream.

free_reserved_area() takes pointers as arguments to show which addresses should be freed. However, it does this in a somewhat ambiguous way. If it gets a kernel direct map address, it always works. However, if it gets an address that is part of the kernel image alias mapping, it can fail.

It fails if all of the following happen:
* The specified address is part of the kernel image alias
* Poisoning is requested (forcing a memset())
* The address is in a read-only portion of the kernel image

The memset() fails on the read-only mapping, of course. free_reserved_area() *is* called both on the direct map and on kernel image alias addresses. We've just lucked out thus far that the kernel image alias areas it gets used on are read-write. I'm fairly sure this has been just a happy accident.

It is quite easy to make free_reserved_area() work for all cases: just convert the address to a direct map address before doing the memset(), and do this unconditionally. There is little chance of a regression here because we previously did a virt_to_page() on the address for the memset, so we know these are not highmem pages for which virt_to_page() would fail.

---
 mm/page_alloc.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
mm/page_alloc.c +14 -2
@@ -6933,9 +6933,21 @@ unsigned long free_reserved_area(void *s
 	start = (void *)PAGE_ALIGN((unsigned long)start);
 	end = (void *)((unsigned long)end & PAGE_MASK);
 	for (pos = start; pos < end; pos += PAGE_SIZE, pages++) {
+		struct page *page = virt_to_page(pos);
+		void *direct_map_addr;
+
+		/*
+		 * 'direct_map_addr' might be different from 'pos'
+		 * because some architectures' virt_to_page()
+		 * work with aliases.  Getting the direct map
+		 * address ensures that we get a _writeable_
+		 * alias for the memset().
+		 */
+		direct_map_addr = page_address(page);
 		if ((unsigned int)poison <= 0xFF)
-			memset(pos, poison, PAGE_SIZE);
-		free_reserved_page(virt_to_page(pos));
+			memset(direct_map_addr, poison, PAGE_SIZE);
+
+		free_reserved_page(page);
 	}
 
 	if (pages && s)
author maintainer
#293 lore raw

PATCH 307/324 ext4: fix spectre gadget in ext4_mb_regular_allocator()

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Jeremy Cline <[email protected]>

commit 1a5d5e5d51e75a5bca67dadbcea8c841934b7b85 upstream.

'ac->ac_g_ex.fe_len' is a user-controlled value which is used in the derivation of 'ac->ac_2order'. 'ac->ac_2order', in turn, is used to index arrays which makes it a potential spectre gadget. Fix this by sanitizing the value assigned to 'ac->ac2_order'. This covers the following accesses found with the help of smatch:

* fs/ext4/mballoc.c:1896 ext4_mb_simple_scan_group() warn: potential spectre issue 'grp->bb_counters' [w] (local cap)

* fs/ext4/mballoc.c:445 mb_find_buddy() warn: potential spectre issue 'EXT4_SB(e4b->bd_sb)->s_mb_offsets' [r] (local cap)

* fs/ext4/mballoc.c:446 mb_find_buddy() warn: potential spectre issue 'EXT4_SB(e4b->bd_sb)->s_mb_maxs' [r] (local cap)

---
 fs/ext4/mballoc.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ext4/mballoc.c +3 -1
@@ -14,6 +14,7 @@
 #include <linux/log2.h>
 #include <linux/module.h>
 #include <linux/slab.h>
+#include <linux/nospec.h>
 #include <linux/backing-dev.h>
 #include <trace/events/ext4.h>
 
@@ -2140,7 +2141,8 @@ ext4_mb_regular_allocator(struct ext4_al
 		 * This should tell if fe_len is exactly power of 2
 		 */
 		if ((ac->ac_g_ex.fe_len & (~(1 << (i - 1)))) == 0)
-			ac->ac_2order = i - 1;
+			ac->ac_2order = array_index_nospec(i - 1,
+							   sb->s_blocksize_bits + 2);
 	}
 
 	/* if stream allocation is enabled, use global goal */
author maintainer
#300 lore raw

PATCH 317/324 PCI / ACPI / PM: Resume all bridges on suspend-to-RAM

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Rafael J. Wysocki <[email protected]>

commit 9d64b539b738fc181442caab95f1f76d9bd58539 upstream.

Commit 26112ddc254c (PCI / ACPI / PM: Resume bridges w/o drivers on suspend-to-RAM) attempted to fix a functional regression resulting from commit c62ec4610c40 (PM / core: Fix direct_complete handling for devices with no callbacks) by resuming PCI bridges without drivers (that is, "parallel PCI" ones) during system-wide suspend if the target system state is not ACPI S0 (working state).

That turns out insufficient, however, as it is reported that, at least in one case, the platform firmware gets confused if a PCIe root port is suspended before entering the ACPI S3 sleep state. That issue was exposed by commit 77b3729ca03 (PCI / PM: Use SMART_SUSPEND and LEAVE_SUSPENDED flags for PCIe ports) that allowed PCIe ports to stay in runtime suspend during system-wide suspend (which is OK for suspend-to-idle, but turns out to be problematic otherwise).

For this reason, drop the driver check from acpi_pci_need_resume() and resume all bridges (including PCIe ports with drivers) during system-wide suspend if the target system state is not ACPI S0.

[If the target system state is ACPI S0, it means suspend-to-idle
and the platform firmware is not going to be invoked to actually suspend the system, so there is no need to resume the bridges in that case.]

Fixes 77b3729ca03 (PCI / PM: Use SMART_SUSPEND and LEAVE_SUSPENDED flags for PCIe ports)
Cc 4.16+ <[email protected]> # 4.16+: 26112ddc254c (PCI / ACPI / PM: Resume bridges ...)
---
 drivers/pci/pci-acpi.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/pci/pci-acpi.c +2 -4
@@ -601,13 +601,11 @@ static bool acpi_pci_need_resume(struct
 	/*
 	 * In some cases (eg. Samsung 305V4A) leaving a bridge in suspend over
 	 * system-wide suspend/resume confuses the platform firmware, so avoid
-	 * doing that, unless the bridge has a driver that should take care of
-	 * the PM handling.  According to Section 16.1.6 of ACPI 6.2, endpoint
+	 * doing that.  According to Section 16.1.6 of ACPI 6.2, endpoint
 	 * devices are expected to be in D3 before invoking the S3 entry path
 	 * from the firmware, so they should not be affected by this issue.
 	 */
-	if (pci_is_bridge(dev) && !dev->driver &&
-	    acpi_target_system_state() != ACPI_STATE_S0)
+	if (pci_is_bridge(dev) && acpi_target_system_state() != ACPI_STATE_S0)
 		return true;
 
 	if (!adev || !acpi_device_power_manageable(adev))
author maintainer
#301 lore raw

PATCH 318/324 PCI: hotplug: Dont leak pci_slot on registration failure

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Lukas Wunner <[email protected]>

commit 4ce6435820d1f1cc2c2788e232735eb244bcc8a3 upstream.

If addition of sysfs files fails on registration of a hotplug slot, the struct pci_slot as well as the entry in the slot_list is leaked. The issue has been present since the hotplug core was introduced in 2002:
https://git.kernel.org/tglx/history/c/a8a2069f432c

Perhaps the idea was that even though sysfs addition fails, the slot should still be usable. But that's not how drivers use the interface, they abort probe if a non-zero value is returned.

---
 drivers/pci/hotplug/pci_hotplug_core.c |    9 +++++++++
 1 file changed, 9 insertions(+)
drivers/pci/hotplug/pci_hotplug_core.c +9 -0
@@ -438,8 +438,17 @@ int __pci_hp_register(struct hotplug_slo
 	list_add(&slot->slot_list, &pci_hotplug_slot_list);
 
 	result = fs_add_slot(pci_slot);
+	if (result)
+		goto err_list_del;
+
 	kobject_uevent(&pci_slot->kobj, KOBJ_ADD);
 	dbg("Added slot %s to the list\n", name);
+	goto out;
+
+err_list_del:
+	list_del(&slot->slot_list);
+	pci_slot->hotplug = NULL;
+	pci_destroy_slot(pci_slot);
 out:
 	mutex_unlock(&pci_hp_mutex);
 	return result;
author maintainer
#302 lore raw

PATCH 319/324 PCI: Skip MPS logic for Virtual Functions (VFs)

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Myron Stowe <[email protected]>

commit 3dbe97efe8bf450b183d6dee2305cbc032e6b8a4 upstream.

PCIe r4.0, sec 9.3.5.4, "Device Control Register", shows both Max_Payload_Size (MPS) and Max_Read_request_Size (MRRS) to be 'RsvdP' for VFs. Just prior to the table it states:

"PF and VF functionality is defined in Section 7.5.3.4 except where
noted in Table 9-16. For VF fields marked 'RsvdP', the PF setting applies to the VF."

All of which implies that with respect to Max_Payload_Size Supported (MPSS), MPS, and MRRS values, we should not be paying any attention to the VF's fields, but rather only to the PF's. Only looking at the PF's fields also logically makes sense as it's the sole physical interface to the PCIe bus.

Fixes 27d868b5e6cf ("PCI: Set MPS to match upstream bridge")
Cc Keith Busch <[email protected]>
Cc Sinan Kaya <[email protected]>
Cc Dongdong Liu <[email protected]>
Cc Jon Mason <[email protected]>
---
 drivers/pci/probe.c |    4 ++++
 1 file changed, 4 insertions(+)
drivers/pci/probe.c +4 -0
@@ -1677,6 +1677,10 @@ static void pci_configure_mps(struct pci
 	if (!pci_is_pcie(dev) || !bridge || !pci_is_pcie(bridge))
 		return;
 
+	/* MPS and MRRS fields are of type 'RsvdP' for VFs, short-circuit out */
+	if (dev->is_virtfn)
+		return;
+
 	mps = pcie_get_mps(dev);
 	p_mps = pcie_get_mps(bridge);
 
author maintainer
#305 lore raw

PATCH 322/324 i2c: core: ACPI: Properly set status byte to 0 for multi-byte writes

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Hans de Goede <[email protected]>

commit c463a158cb6c5d9a85b7d894cd4f8116e8bd6be0 upstream.

acpi_gsb_i2c_write_bytes() returns i2c_transfer()'s return value, which is the number of transfers executed on success, so 1.

The ACPI code expects us to store 0 in gsb->status for success, not 1.

Specifically this breaks the following code in the Thinkpad 8 DSDT:

            ECWR = I2CW = ECWR /* \_SB_.I2C1.BAT0.ECWR */
            If ((ECST == Zero))
            {
                ECRD = I2CR /* \_SB_.I2C1.I2CR */
            }

Before this commit we set ECST to 1, causing the read to never happen breaking battery monitoring on the Thinkpad 8.

This commit makes acpi_gsb_i2c_write_bytes() return 0 when i2c_transfer() returns 1, so the single write transfer completed successfully, and makes it return -EIO on for other (unexpected) return values >= 0.

---
 drivers/i2c/i2c-core-acpi.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/i2c/i2c-core-acpi.c +8 -3
@@ -482,11 +482,16 @@ static int acpi_gsb_i2c_write_bytes(stru
 	msgs[0].buf = buffer;
 
 	ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
-	if (ret < 0)
-		dev_err(&client->adapter->dev, "i2c write failed\n");
 
 	kfree(buffer);
-	return ret;
+
+	if (ret < 0) {
+		dev_err(&client->adapter->dev, "i2c write failed: %d\n", ret);
+		return ret;
+	}
+
+	/* 1 transfer must have completed successfully */
+	return (ret == 1) ? 0 : -EIO;
 }
 
 static acpi_status
author maintainer
#306 lore raw

PATCH 324/324 reiserfs: fix broken xattr handling (heap corruption, bad retval)

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Jann Horn <[email protected]>

commit a13f085d111e90469faf2d9965eb39b11c114d7e upstream.

This fixes the following issues:

- When a buffer size is supplied to reiserfs_listxattr() such that each individual name fits, but the concatenation of all names doesn't fit, reiserfs_listxattr() overflows the supplied buffer. This leads to a kernel heap overflow (verified using KASAN) followed by an out-of-bounds usercopy and is therefore a security bug.

- When a buffer size is supplied to reiserfs_listxattr() such that a name doesn't fit, -ERANGE should be returned. But reiserfs instead just truncates the list of names; I have verified that if the only xattr on a file has a longer name than the supplied buffer length, listxattr() incorrectly returns zero.

With my patch applied, -ERANGE is returned in both cases and the memory corruption doesn't happen anymore.

Credit for making me clean this code up a bit goes to Al Viro, who pointed out that the ->actor calling convention is suboptimal and should be changed.

---
 fs/reiserfs/xattr.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/reiserfs/xattr.c +3 -1
@@ -792,8 +792,10 @@ static int listxattr_filler(struct dir_c
 			return 0;
 		size = namelen + 1;
 		if (b->buf) {
-			if (size > b->size)
+			if (b->pos + size > b->size) {
+				b->pos = -ERANGE;
 				return -ERANGE;
+			}
 			memcpy(b->buf + b->pos, name, namelen);
 			b->buf[b->pos + namelen] = 0;
 		}
author maintainer
#1 lore raw

PATCH 1/324 arm: dts: armada: Fix "#cooling-cells" propertys name

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Viresh Kumar <[email protected]>

[ Upstream commit ac62cc9d9cd6fa4c79e171c13dc8d58c3862b678 ]

It should be "#cooling-cells" instead of "cooling-cells". Fix it.

---
 arch/arm/boot/dts/armada-385-synology-ds116.dts |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/armada-385-synology-ds116.dts +1 -1
@@ -139,7 +139,7 @@
 					      3700 5
 					      3900 6
 					      4000 7>;
-			cooling-cells = <2>;
+			#cooling-cells = <2>;
 		};
 
 		gpio-leds {
author maintainer
#2 lore raw

PATCH 2/324 vfio: ccw: fix error return in vfio_ccw_sch_event

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Dong Jia Shi <[email protected]>

[ Upstream commit 2c861d89ccda2fbcea9358eff9cc5f8fae548be5 ]

If the device has not been registered, or there is work pending, we should reschedule a sch_event call again.

Message-Id: <[email protected]>

---
 drivers/s390/cio/vfio_ccw_drv.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/s390/cio/vfio_ccw_drv.c +4 -1
@@ -177,6 +177,7 @@ static int vfio_ccw_sch_event(struct sub
 {
 	struct vfio_ccw_private *private = dev_get_drvdata(&sch->dev);
 	unsigned long flags;
+	int rc = -EAGAIN;
 
 	spin_lock_irqsave(sch->lock, flags);
 	if (!device_is_registered(&sch->dev))
@@ -187,6 +188,7 @@ static int vfio_ccw_sch_event(struct sub
 
 	if (cio_update_schib(sch)) {
 		vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_NOT_OPER);
+		rc = 0;
 		goto out_unlock;
 	}
 
@@ -195,11 +197,12 @@ static int vfio_ccw_sch_event(struct sub
 		private->state = private->mdev ? VFIO_CCW_STATE_IDLE :
 				 VFIO_CCW_STATE_STANDBY;
 	}
+	rc = 0;
 
 out_unlock:
 	spin_unlock_irqrestore(sch->lock, flags);
 
-	return 0;
+	return rc;
 }
 
 static struct css_device_id vfio_ccw_sch_ids[] = {
author maintainer
#3 lore raw

PATCH 3/324 perf tools: Fix error index for pmu event parser

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Jiri Olsa <[email protected]>

[ Upstream commit f7fa827f5f432a0b1f34e10fc49da93aeef9f817 ]

For events we provide specific error message we need to set error column index, PMU parser is missing that, adding it.

Before:

  $ perf stat -e cycles,krava/cycles/ kill
  event syntax error: 'cycles,krava/cycles/'
                       \___ Cannot find PMU `krava'. Missing kernel support?

After:

  $ perf stat -e cycles,krava/cycles/ kill
  event syntax error: 'cycles,krava/cycles/'
                              \___ Cannot find PMU `krava'. Missing kernel support?
---
 tools/perf/util/parse-events.y |    5 +++++
 1 file changed, 5 insertions(+)
tools/perf/util/parse-events.y +5 -0
@@ -227,11 +227,16 @@ event_def: event_pmu |
 event_pmu:
 PE_NAME opt_pmu_config
 {
+	struct parse_events_state *parse_state = _parse_state;
+	struct parse_events_error *error = parse_state->error;
 	struct list_head *list, *orig_terms, *terms;
 
 	if (parse_events_copy_term_list($2, &orig_terms))
 		YYABORT;
 
+	if (error)
+		error->idx = @1.first_column;
+
 	ALLOC_LIST(list);
 	if (parse_events_add_pmu(_parse_state, list, $1, $2, false, false)) {
 		struct perf_pmu *pmu = NULL;
author maintainer
#7 lore raw

PATCH 7/324 Input: synaptics-rmi4 - fix axis-swap behavior

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Lucas Stach <[email protected]>

[ Upstream commit 645a397d325db6e1bb36588095ae637738b37693 ]

The documentation for the touchscreen-swapped-x-y property states that swapping is done after inverting if both are used. RMI4 did it the other way around, leading to inconsistent behavior with regard to other touchscreens.

---
 drivers/input/rmi4/rmi_2d_sensor.c |   34 ++++++++++++++++------------------
 1 file changed, 16 insertions(+), 18 deletions(-)
drivers/input/rmi4/rmi_2d_sensor.c +16 -18
@@ -32,15 +32,15 @@ void rmi_2d_sensor_abs_process(struct rm
 	if (obj->type == RMI_2D_OBJECT_NONE)
 		return;
 
-	if (axis_align->swap_axes)
-		swap(obj->x, obj->y);
-
 	if (axis_align->flip_x)
 		obj->x = sensor->max_x - obj->x;
 
 	if (axis_align->flip_y)
 		obj->y = sensor->max_y - obj->y;
 
+	if (axis_align->swap_axes)
+		swap(obj->x, obj->y);
+
 	/*
 	 * Here checking if X offset or y offset are specified is
 	 * redundant. We just add the offsets or clip the values.
@@ -120,15 +120,15 @@ void rmi_2d_sensor_rel_report(struct rmi
 	x = min(RMI_2D_REL_POS_MAX, max(RMI_2D_REL_POS_MIN, (int)x));
 	y = min(RMI_2D_REL_POS_MAX, max(RMI_2D_REL_POS_MIN, (int)y));
 
-	if (axis_align->swap_axes)
-		swap(x, y);
-
 	if (axis_align->flip_x)
 		x = min(RMI_2D_REL_POS_MAX, -x);
 
 	if (axis_align->flip_y)
 		y = min(RMI_2D_REL_POS_MAX, -y);
 
+	if (axis_align->swap_axes)
+		swap(x, y);
+
 	if (x || y) {
 		input_report_rel(sensor->input, REL_X, x);
 		input_report_rel(sensor->input, REL_Y, y);
@@ -141,17 +141,10 @@ static void rmi_2d_sensor_set_input_para
 	struct input_dev *input = sensor->input;
 	int res_x;
 	int res_y;
+	int max_x, max_y;
 	int input_flags = 0;
 
 	if (sensor->report_abs) {
-		if (sensor->axis_align.swap_axes) {
-			swap(sensor->max_x, sensor->max_y);
-			swap(sensor->axis_align.clip_x_low,
-			     sensor->axis_align.clip_y_low);
-			swap(sensor->axis_align.clip_x_high,
-			     sensor->axis_align.clip_y_high);
-		}
-
 		sensor->min_x = sensor->axis_align.clip_x_low;
 		if (sensor->axis_align.clip_x_high)
 			sensor->max_x = min(sensor->max_x,
@@ -163,14 +156,19 @@ static void rmi_2d_sensor_set_input_para
 				sensor->axis_align.clip_y_high);
 
 		set_bit(EV_ABS, input->evbit);
-		input_set_abs_params(input, ABS_MT_POSITION_X, 0, sensor->max_x,
-					0, 0);
-		input_set_abs_params(input, ABS_MT_POSITION_Y, 0, sensor->max_y,
-					0, 0);
+
+		max_x = sensor->max_x;
+		max_y = sensor->max_y;
+		if (sensor->axis_align.swap_axes)
+			swap(max_x, max_y);
+		input_set_abs_params(input, ABS_MT_POSITION_X, 0, max_x, 0, 0);
+		input_set_abs_params(input, ABS_MT_POSITION_Y, 0, max_y, 0, 0);
 
 		if (sensor->x_mm && sensor->y_mm) {
 			res_x = (sensor->max_x - sensor->min_x) / sensor->x_mm;
 			res_y = (sensor->max_y - sensor->min_y) / sensor->y_mm;
+			if (sensor->axis_align.swap_axes)
+				swap(res_x, res_y);
 
 			input_abs_set_res(input, ABS_X, res_x);
 			input_abs_set_res(input, ABS_Y, res_y);
author maintainer
#8 lore raw

PATCH 8/324 IB/mlx4: Fix an error handling path in mlx4_ib_rereg_user_mr()

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Christophe Jaillet <[email protected]>

[ Upstream commit 3dc7c7badb7502ec3e3aa817a8bdd9e53aa54c52 ]

Before returning -EPERM we should release some resources, as already done in the other error handling path of the function.

Fixes d8f9cc328c88 ("IB/mlx4: Mark user MR as writable if actual virtual memory is writable")
---
 drivers/infiniband/hw/mlx4/mr.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/infiniband/hw/mlx4/mr.c +5 -2
@@ -486,8 +486,11 @@ int mlx4_ib_rereg_user_mr(struct ib_mr *
 	}
 
 	if (flags & IB_MR_REREG_ACCESS) {
-		if (ib_access_writable(mr_access_flags) && !mmr->umem->writable)
-			return -EPERM;
+		if (ib_access_writable(mr_access_flags) &&
+		    !mmr->umem->writable) {
+			err = -EPERM;
+			goto release_mpt_entry;
+		}
 
 		err = mlx4_mr_hw_change_access(dev->dev, *pmpt_entry,
 					       convert_access(mr_access_flags));

Greg Kroah-Hartman

author maintainer
#0 lore raw

cover 4.17.19-stable review

NOTE, this is going to be the LAST 4.17.y kernel release. Please move to the 4.18.y tree at this point in time if you have not already. After this release, 4.17.y will be end-of-life.

This is the start of the stable review cycle for the 4.17.19 release. There are 324 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Sat Aug 25 07:48:40 UTC 2018. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

	https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.17.19-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.17.y
and the diffstat can be found below.

thanks,

greg k-h

-------------
Pseudo-Shortlog of commits:

Greg Kroah-Hartman <[email protected]>

    Linux 4.17.19-rc1

Jann Horn <[email protected]>
reiserfs: fix broken xattr handling (heap corruption, bad retval)

Esben Haabendal <[email protected]>
i2c: imx: Fix race condition in dma read

Hans de Goede <[email protected]>
i2c: core: ACPI: Properly set status byte to 0 for multi-byte writes

Lukas Wunner <[email protected]>
PCI: pciehp: Fix unprotected list iteration in IRQ handler

Lukas Wunner <[email protected]>
PCI: pciehp: Fix use-after-free on unplug

Myron Stowe <[email protected]>
PCI: Skip MPS logic for Virtual Functions (VFs)

Lukas Wunner <[email protected]>
PCI: hotplug: Don't leak pci_slot on registration failure

Rafael J. Wysocki <[email protected]>
PCI / ACPI / PM: Resume all bridges on suspend-to-RAM

Christian König <[email protected]>
PCI: Restore resized BAR state on resume

Ursula Braun <[email protected]>
net/smc: no shutdown in state SMC_LISTEN

Willem de Bruijn <[email protected]>
packet: refine ring v3 block size test to hold one frame

Florian Westphal <[email protected]>
netfilter: conntrack: dccp: treat SYNC/SYNCACK as invalid if no prior state

Eric Dumazet <[email protected]>
xfrm_user: prevent leaking 2 bytes of kernel memory

John David Anglin <[email protected]>
parisc: Remove ordered stores from syscall.S

John David Anglin <[email protected]>
parisc: Remove unnecessary barriers from spinlock.h

Gustavo A. R. Silva <[email protected]>
drm/amdgpu/pm: Fix potential Spectre v1

Gustavo A. R. Silva <[email protected]>
drm/i915/kvmgt: Fix potential Spectre v1

Jeremy Cline <[email protected]>
ext4: fix spectre gadget in ext4_mb_regular_allocator()

Dave Hansen <[email protected]>
x86/mm/init: Remove freed kernel image areas from alias mapping

Dave Hansen <[email protected]>
x86/mm/init: Add helper for freeing kernel image pages

Dave Hansen <[email protected]>
x86/mm/init: Pass unconverted symbol addresses to free_init_pages()

Dave Hansen <[email protected]>
mm: Allow non-direct-map arguments to free_reserved_area()

Matthijs van Duin <[email protected]>
pty: fix O_CLOEXEC for TIOCGPTPEER

Takashi Iwai <[email protected]>

    EDAC: Add missing MEM_LRDDR4 entry in edac_mem_types[]

Linus Torvalds <[email protected]>
mm: make vm_area_alloc() initialize core fields

Linus Torvalds <[email protected]>
mm: make vm_area_dup() actually copy the old vma data

Linus Torvalds <[email protected]>
mm: use helper functions for allocating and freeing vm_area structs

Roland Dreier <[email protected]>
nvme: fix handling of metadata_len for NVME_IOCTL_IO_CMD

Damien Thébault <[email protected]>
platform/x86: dell-laptop: Fix backlight detection

Uwe Kleine-König <[email protected]>
ARM: dts: imx6: RDU2: fix irq type for mv88e6xxx switch

Robin H. Johnson <[email protected]>
ACPI / EC: Use ec_no_wakeup on more Thinkpad X1 Carbon 6th systems

Anson Huang <[email protected]>
soc: imx: gpc: restrict register range for regmap access

Randy Dunlap <[email protected]>
tcp: identify cryptic messages as TCP seq # bugs

Alexander Sverdlin <[email protected]>
net: cavium: Add fine-granular dependencies on PCI

Stefan Wahren <[email protected]>
net: qca_spi: Fix log level if probe fails

Stefan Wahren <[email protected]>
net: qca_spi: Make sure the QCA7000 reset is triggered

Stefan Wahren <[email protected]>
net: qca_spi: Avoid packet drop during initial sync

Sergei Shtylyov <[email protected]>
PCI: v3-semi: Fix I/O space page leak

Sergei Shtylyov <[email protected]>
PCI: mediatek: Fix I/O space page leak

Sergei Shtylyov <[email protected]>
PCI: faraday: Fix I/O space page leak

Sergei Shtylyov <[email protected]>
PCI: aardvark: Fix I/O space page leak

Sergei Shtylyov <[email protected]>
PCI: designware: Fix I/O space page leak

Sergei Shtylyov <[email protected]>
PCI: versatile: Fix I/O space page leak

Sergei Shtylyov <[email protected]>
PCI: xgene: Fix I/O space page leak

Sergei Shtylyov <[email protected]>
PCI: OF: Fix I/O space page leak

Karsten Graul <[email protected]>
net/smc: reset recv timeout after clc handshake

Peng Hao <[email protected]>
kvmclock: fix TSC calibration for nested guests

David Lechner <[email protected]>
net: usb: rtl8150: demote allmulti message to dev_dbg()

Alexander Sverdlin <[email protected]>
octeon_mgmt: Fix MIX registers configuration on MTU setup

Scott Bauer <[email protected]>
nvme: ensure forward progress during Admin passthru

Qu Wenruo <[email protected]>
btrfs: scrub: Don't use inode page cache in scrub_handle_errored_block()

Pavel Machek <[email protected]>
ARM: dts: omap4-droid4: fix dts w.r.t. pwm

John Allen <[email protected]>
ibmvnic: Fix error recovery on login failure

Randy Dunlap <[email protected]>
net/ethernet/freescale/fman: fix cross-build error

Stephen Hemminger <[email protected]>
hv/netvsc: fix handling of fallback to single queue mode

Thomas Falcon <[email protected]>
ibmvnic: Revise RX/TX queue error messages

Frank Rowand <[email protected]>
of: overlay: update phandle cache on overlay apply and remove

Dan Carpenter <[email protected]>
drm/nouveau/gem: off by one bugs in nouveau_gem_pushbuf_reloc_apply()

Juri Lelli <[email protected]>
sched/deadline: Fix switched_from_dl() warning

Jim Mattson <[email protected]>
kvm: nVMX: Restore exit qual for VM-entry failure due to MSR loading

piaojun <[email protected]>
net/9p/client.c: put refcount of trans_mod in error case in parse_opts()

Wei Yongjun <[email protected]>
pinctrl: nsp: Fix potential NULL dereference

Dan Carpenter <[email protected]>
pinctrl: nsp: off by ones in nsp_pinmux_enable()

Paul Cercueil <[email protected]>
pinctrl: ingenic: Fix inverted direction for < JZ4770

Yuchung Cheng <[email protected]>
tcp: remove DELAYED ACK events in DCTCP

Dan Carpenter <[email protected]>
qlogic: check kstrtoul() for errors

Alexandre Belloni <[email protected]>
rtc: fix alarm read and set offset

Willem de Bruijn <[email protected]>
packet: reset network header if packet shorter than ll reserved space

Bert Kenward <[email protected]>
sfc: hold filter_sem consistently during reset

Bert Kenward <[email protected]>
sfc: avoid hang from nested use of the filter_sem

Masahiro Yamada <[email protected]>
kbuild: suppress warnings from 'getconf LFS_*'

Laura Abbott <[email protected]>
tools: build: Use HOSTLDFLAGS with fixdep

Laura Abbott <[email protected]>
tools: build: Fixup host c flags

Dan Carpenter <[email protected]>
ixgbe: Off by one in ixgbe_ipsec_tx()

David Francis <[email protected]>
amd/dc/dce100: On dce100, set clocks to 0 on suspend

Alexander Duyck <[email protected]>
ixgbe: Be more careful when modifying MAC filters

Adam Ford <[email protected]>
ARM: dts: am3517.dtsi: Disable reference to OMAP3 OTG controller

Nishanth Menon <[email protected]>
ARM: DRA7/OMAP5: Enable ACTLR[0] (Enable invalidates of BTB) for secondary cores

Russell King <[email protected]>
sfp: fix module initialisation with netdev already up

Russell King <[email protected]>
sfp: ensure we clean up properly on bus registration failure

Steven Rostedt (VMware) <[email protected]>
ARM: 8780/1: ftrace: Only set kernel memory back to read-only after boot

Kamal Heib <[email protected]>
RDMA/mlx5: Fix memory leak in mlx5_ib_create_srq() error path

Dave Jiang <[email protected]>
nfit: fix unchecked dereference in acpi_nfit_ctl

Jeremy Cline <[email protected]>
perf tools: Use python-config --includes rather than --cflags

Janne Huttunen <[email protected]>
perf script python: Fix dict reference counting

Jiri Olsa <[email protected]>
perf tools: Fix compilation errors on gcc8

Kim Phillips <[email protected]>
perf test shell: Prevent temporary editor files from being considered test scripts

Kim Phillips <[email protected]>
perf llvm-utils: Remove bashism from kernel include fetch script

Manish Rangankar <[email protected]>
scsi: qedi: Send driver state to MFW

Saurav Kashyap <[email protected]>
scsi: qedf: Send the driver state to MFW

Don Brace <[email protected]>
scsi: hpsa: correct enclosure sas address

Taeung Song <[email protected]>
samples/bpf: Fix tc and ip paths in xdp2skb_meta.sh

Vikas Gupta <[email protected]>
bnxt_en: Fix for system hang if request_irq fails

Michael Chan <[email protected]>
bnxt_en: Do not modify max IRQ count after RDMA driver requests/frees IRQs.

Michael Chan <[email protected]>
bnxt_en: Always set output parameters in bnxt_get_max_rings().

Michael Chan <[email protected]>
bnxt_en: Fix inconsistent BNXT_FLAG_AGG_RINGS logic.

Venkat Duvvuru <[email protected]>
bnxt_en: Fix the vlan_tci exact match check.

Peter Zijlstra <[email protected]>
ARC: Improve cmpxchg syscall implementation

Gustavo Pimentel <[email protected]>
ARC: [plat-hsdk]: Configure APB GPIO controller on ARC HSDK platform

Andrey Ryabinin <[email protected]>
netfilter: nf_conntrack: Fix possible possible crash on module loading.

Florian Westphal <[email protected]>
netfilter: nft_compat: explicitly reject ERROR and standard target

Russell King <[email protected]>
drm/armada: fix irq handling

Russell King <[email protected]>
drm/armada: fix colorkey mode property

Michael Hennerich <[email protected]>

    net: ieee802154: adf7242: Fix OCL calibration runs

Michael Hennerich <[email protected]>

    net: ieee802154: adf7242: Fix erroneous RX enable

Mikko Perttunen <[email protected]>
drm/tegra: Fix comparison operator for buffer size

Dmitry Osipenko <[email protected]>
gpu: host1x: Check whether size of unpin isn't 0

Dmitry Osipenko <[email protected]>
gpu: host1x: Skip IOMMU initialization if firewall is enabled

Stefan Schmidt <[email protected]>
ieee802154: fakelb: switch from BUG_ON() to WARN_ON() on problem

Stefan Schmidt <[email protected]>

    ieee802154: at86rf230: use __func__ macro for debug messages

Stefan Schmidt <[email protected]>

    ieee802154: at86rf230: switch from BUG_ON() to WARN_ON() on problem

Arnd Bergmann <[email protected]>
drm/sun4i: link in front-end code if needed

Paolo Abeni <[email protected]>
ipfrag: really prevent allocation on netns exit

John Fastabend <[email protected]>

    bpf: fix sk_skb programs without skb->dev assigned

Douglas Anderson <[email protected]>
nvmem: Don't let a NULL cell_id for nvmem_cell_get() crash us

Davide Caratti <[email protected]>
net/sched: act_tunnel_key: fix NULL dereference when 'goto chain' is used

Davide Caratti <[email protected]>
net/sched: act_csum: fix NULL dereference when 'goto chain' is used

Harini Katakam <[email protected]>
net: macb: Free RX ring for all queues

Daniel Mack <[email protected]>
ARM: pxa: irq: fix handling of ICMR registers in suspend/resume

Casey Leedom <[email protected]>
cxgb4: assume flash part size to be 4MB, if it can't be determined

Jon Maloy <[email protected]>
tipc: make function tipc_net_finalize() thread safe

Jon Maloy <[email protected]>
tipc: fix correct setting of message type in second discoverer

Jon Maloy <[email protected]>
tipc: correct discovery message handling during address trial period

Jon Maloy <[email protected]>
tipc: fix wrong return value from function tipc_node_try_addr()

Vladimir Zapolskiy <[email protected]>
ravb: fix invalid context bug while changing link options by ethtool

Vladimir Zapolskiy <[email protected]>
ravb: fix invalid context bug while calling auto-negotiation by ethtool

Vladimir Zapolskiy <[email protected]>
sh_eth: fix invalid context bug while changing link options by ethtool

Vladimir Zapolskiy <[email protected]>
sh_eth: fix invalid context bug while calling auto-negotiation by ethtool

Arun Kumar Neelakantam <[email protected]>
net: qrtr: Reset the node and port ID of broadcast messages

Arun Kumar Neelakantam <[email protected]>
net: qrtr: Broadcast messages only from control port

Paul Moore <[email protected]>
ipv6: make ipv6_renew_options() interrupt/kernel safe

Dan Carpenter <[email protected]>
qed: off by one in qed_parse_mcp_trace_buf()

Florian Westphal <[email protected]>
netfilter: x_tables: set module owner for icmp(6) matches

Lubomir Rintel <[email protected]>

    ieee802154: 6lowpan: set IFLA_LINK

Arnd Bergmann <[email protected]>
ieee802154: mcr20a: add missing includes

Taeung Song <[email protected]>
samples/bpf: Check the error of write() and read()

Taeung Song <[email protected]>
samples/bpf: Check the result of system()

Taeung Song <[email protected]>
samples/bpf: add missing <linux/if_vlan.h>

Jim Wilson <[email protected]>
RISC-V: Fix PTRACE_SETREGSET bug.

Palmer Dabbelt <[email protected]>
RISC-V: Don't include irq-riscv-intc.h

Andreas Schwab <[email protected]>
RISC-V: fix R_RISCV_ADD32/R_RISCV_SUB32 relocations

Maciej Purski <[email protected]>
drm/bridge/sii8620: Fix display of packed pixel modes

Yuiko Oshino <[email protected]>
smsc75xx: Add workaround for gigabit link up hardware errata.

Wang Dongsheng <[email protected]>
net: phy: marvell: change default m88e1510 LED configuration

Zhen Lei <[email protected]>
kasan: fix shadow_size calculation error in kasan_module_alloc

Mathieu Malaterre <[email protected]>
tracing: Use __printf markup to silence compiler

Mauricio Vasquez B <[email protected]>
bpf: hash map: decrement counter on error

Heiner Kallweit <[email protected]>
r8169: fix mac address change

Doron Roberts-Kedes <[email protected]>
tls: fix skb_to_sgvec returning unhandled error.

Fabio Estevam <[email protected]>
ARM: imx_v4_v5_defconfig: Select ULPI support

Fabio Estevam <[email protected]>
ARM: imx_v6_v7_defconfig: Select ULPI support

Jason Gerecke <[email protected]>
HID: wacom: Correct touch maximum XY of 2nd-gen Intuos

Zhenzhong Duan <[email protected]>
x86/mm/32: Initialize the CR4 shadow before __flush_tlb_all()

Peter Zijlstra <[email protected]>
kthread, sched/core: Fix kthread_parkme() (again...)

Vincent Guittot <[email protected]>
sched/util_est: Fix util_est_dequeue() for throttled cfs_rq

Xunlei Pang <[email protected]>
sched/fair: Fix bandwidth timer clock drift condition

Frederic Weisbecker <[email protected]>
sched/nohz: Skip remote tick on idle task entirely

Greentime Hu <[email protected]>
nds32: Fix the dts pointer is not passed correctly issue.

Alex Deucher <[email protected]>
drm/amdgpu: fix swapped emit_ib_size in vce3

Kai-Heng Feng <[email protected]>
usb: xhci: dbc: Don't decrement runtime PM counter if DBC is not started

Hangbin Liu <[email protected]>
ipvlan: call dev_change_flags when ipvlan mode is reset

Josh Poimboeuf <[email protected]>
objtool: Support GCC 8 '-fnoreorder-functions'

Greg Ungerer <[email protected]>
m68k: fix "bad page state" oops on ColdFire boot

Eric Biggers <[email protected]>
crypto: arm/speck - fix building in Thumb2 mode

Stafford Horne <[email protected]>
openrisc: entry: Fix delay slot exception detection

Vishal Verma <[email protected]>
tools/testing/nvdimm: advertise a write cache for nfit_test

Dave Jiang <[email protected]>
acpi/nfit: fix cmd_rc for acpi_nfit_ctl to always return a value

Julian Wiedmann <[email protected]>
s390/qeth: consistently re-enable device features

Madalin Bucur <[email protected]>
dpaa_eth: DPAA SGT needs to be 256B

Madalin Bucur <[email protected]>
fsl/fman: fix parser reporting bad checksum on short frames

Sudarsana Reddy Kalluru <[email protected]>
bnx2x: Fix receiving tx-timeout in error or recovery state.

Nicholas Mc Guire <[email protected]>
PCI: faraday: Add missing of_node_put()

Nicholas Mc Guire <[email protected]>
PCI: xilinx-nwl: Add missing of_node_put()

Nicholas Mc Guire <[email protected]>
PCI: xilinx: Add missing of_node_put()

Daniel Borkmann <[email protected]>
bpf, s390: fix potential memleak when later bpf_jit_prog fails

Bart Van Assche <[email protected]>
drbd: Fix drbd_request_prepare() discard handling

Jens Axboe <[email protected]>
blk-mq: don't queue more if we get a busy return

Marek Szyprowski <[email protected]>
drm/exynos: decon5433: Fix WINCONx reset value

Marek Szyprowski <[email protected]>
drm/exynos: decon5433: Fix per-plane global alpha for XRGB modes

Marek Szyprowski <[email protected]>

    drm/exynos: gsc: Fix support for NV16/61, YUV420/YVU420 and YUV422 modes

Johannes Berg <[email protected]>
nl80211: check nla_parse_nested() return values

Bob Copeland <[email protected]>
nl80211: relax ht operation checks for mesh

Denis Kenzior <[email protected]>

    mac80211: disable BHs/preemption in ieee80211_tx_control_port()

Jeff Moyer <[email protected]>
dev-dax: check_vma: ratelimit dev_info-s

BingJing Chang <[email protected]>
md/raid10: fix that replacement cannot complete recovery after reassemble

Evan Quan <[email protected]>
drm/amd/powerplay: correct vega12 thermal support as true

Ryan Hsu <[email protected]>
ath10k: update the phymode along with bandwidth change request

Dan Carpenter <[email protected]>
dmaengine: k3dma: Off by one in k3_of_dma_simple_xlate()

Marek Szyprowski <[email protected]>
dmaengine: pl330: report BURST residue granularity

Martin Blumenstingl <[email protected]>
ARM64: dts: meson-gxl: fix Mali GPU compatible string

Jerome Brunet <[email protected]>
ARM64: dts: meson-axg: fix ethernet stability issue

Will Deacon <[email protected]>
arm64: Avoid flush_icache_range() in alternatives patching code

Katsuhiro Suzuki <[email protected]>
arm64: dts: uniphier: fix widget name of headphone for LD11/LD20 boards

Keerthy <[email protected]>
ARM: dts: da850: Fix interrups property for gpio

Andy Lutomirski <[email protected]>
selftests/x86/sigreturn: Do minor cleanups

Andy Lutomirski <[email protected]>
selftests/x86/sigreturn/64: Fix spurious failures on AMD CPUs

Chengguang Xu <[email protected]>
nfp: cast sizeof() to int when comparing with error code

Sowmini Varadhan <[email protected]>
rds: clean up loopback rds_connections on netns deletion

Eli Cohen <[email protected]>
net/mlx5: E-Switch, Disallow vlan/spoofcheck setup if not being esw manager

Yan, Zheng <[email protected]>
ceph: fix dentry leak in splice_dentry()

Jann Horn <[email protected]>
netfilter: nf_log: fix uninit read in nf_log_proc_dostring

Adam Ford <[email protected]>
ARM: davinci: board-da850-evm: fix WP pin polarity for MMC/SD

Peter Chen <[email protected]>
usb: chipidea: host: fix disconnection detect issue

Dan Carpenter <[email protected]>
clk: davinci: cfgchip: testing the wrong variable

Ravi Bangoria <[email protected]>
perf tools: Fix crash caused by accessing feat_ops[HEADER_LAST_FEATURE]

Ravi Bangoria <[email protected]>

    perf script: Fix crash because of missing evsel->priv

Jiri Olsa <[email protected]>
perf bench: Fix numa report output code

Yonghong Song <[email protected]>
perf tools: Fix a clang 7.0 compilation error

Jiri Olsa <[email protected]>
perf tests: Add event parsing error handling to parse events test

Sandipan Das <[email protected]>
perf report powerpc: Fix crash if callchain is empty

Thomas Richter <[email protected]>
perf test session topology: Fix test on s390

Thomas Richter <[email protected]>
perf record: Support s390 random socket_id assignment

Dirk Gouders <[email protected]>
kconfig: fix line numbers for if-entries in menu tree

Dan Carpenter <[email protected]>
typec: tcpm: Fix a msecs vs jiffies bug

Hans de Goede <[email protected]>
NFC: pn533: Fix wrong GFP flag usage

Ajay Gupta <[email protected]>
usb: xhci: increase CRS timeout value

Dongjiu Geng <[email protected]>
usb: xhci: remove the code build warning

Jakub Kicinski <[email protected]>
nfp: bpf: don't stop offload if replace failed

Takashi Iwai <[email protected]>
ALSA: seq: Fix UBSAN warning at SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT ioctl

Daniel Mack <[email protected]>
ARM: dts: am437x: make edt-ft5x06 a wakeup source

Haiyue Wang <[email protected]>
ipmi: kcs_bmc: fix IRQ exception if the channel is not open

Michael Trimarchi <[email protected]>
brcmfmac: stop watchdog before detach and free everything

Tomasz Duszynski <[email protected]>
iio: pressure: bmp280: fix relative humidity unit

Ganesh Goudar <[email protected]>
cxgb4: when disabling dcb set txq dcb priority to 0

Linus Lüssing <[email protected]>
batman-adv: Fix multicast TT issues with bogus ROAM flags

Linus Lüssing <[email protected]>
batman-adv: Avoid storing non-TT-sync flags on singular entries too

Sven Eckelmann <[email protected]>
batman-adv: Fix debugfs path for renamed softif

Sven Eckelmann <[email protected]>
batman-adv: Fix debugfs path for renamed hardif

Sven Eckelmann <[email protected]>
batman-adv: Fix bat_v best gw refcnt after netlink dump

Sven Eckelmann <[email protected]>
batman-adv: Fix bat_ogm_iv best gw refcnt after netlink dump

Rob Herring <[email protected]>
arm64: dts: msm8916: fix Coresight ETF graph connections

Casey Schaufler <[email protected]>
Smack: Mark inode instant in smack_task_to_inode

Hangbin Liu <[email protected]>
ipv6: mcast: fix unsolicited report interval after receiving querys

Zhenzhong Duan <[email protected]>
x86/microcode/intel: Fix memleak in save_microcode_patch()

Marc Zyngier <[email protected]>
irqchip/gic-v3-its: Fix reprogramming of redistributors on CPU hotplug

Marc Zyngier <[email protected]>
irqchip/gic-v2m: Fix SPI release on error path

Geert Uytterhoeven <[email protected]>
mtd: dataflash: Use ULL suffix for 64-bit constants

Jeffrin Jose T <[email protected]>
selftests: bpf: notification about privilege required to run test_kmod.sh testing script

Steven Rostedt (VMware) <[email protected]>
locking/lockdep: Do not record IRQ state within lockdep code

Masahiro Yamada <[email protected]>
clk: sunxi-ng: replace lib-y with obj-y

Jianchao Wang <[email protected]>
nvme-pci: move nvme_kill_queues to nvme_remove_dead_ctrl

Maciej Purski <[email protected]>
drm/bridge/sii8620: fix display of packed pixel modes in MHL2

Ard Biesheuvel <[email protected]>
KVM: arm/arm64: Drop resource size check for GICV window

Marcelo Ricardo Leitner <[email protected]>
sctp: fix erroneous inc of snmp SctpFragUsrMsgs

Bartosz Golaszewski <[email protected]>
net: davinci_emac: match the mdio device against its compatible if possible

Doron Roberts-Kedes <[email protected]>
nbd: Add the nbd NBD_DISCONNECT_ON_CLOSE config flag.

Anders Roxell <[email protected]>
selftests: net: add config fragments

Alexey Brodkin <[email protected]>

    ARC: Enable machine_desc->init_per_cpu for !CONFIG_SMP

Dan Carpenter <[email protected]>
block: sed-opal: Fix a couple off by one bugs

Dan Carpenter <[email protected]>
blk-mq-debugfs: Off by one in blk_mq_rq_state_name()

Max Gurtuvoy <[email protected]>
nvmet: reset keep alive timer in controller enable

Israel Rukshin <[email protected]>
nvme-rdma: Fix command completion race at error recovery

Sagi Grimberg <[email protected]>
nvme-rdma: fix possible double free condition when failing to create a controller

Dinh Nguyen <[email protected]>
net: stmmac: socfpga: add additional ocp reset line for Stratix10

Li RongQing <[email protected]>
net: propagate dev_get_valid_name return code

Stefan Agner <[email protected]>
net: hamradio: use eth_broadcast_addr

Govindarajulu Varadarajan <[email protected]>

    enic: initialize enic->rfs_h.lock in enic_probe

Sudarsana Reddy Kalluru <[email protected]>
qed: Do not advertise DCBX_LLD_MANAGED capability.

Sudarsana Reddy Kalluru <[email protected]>
qed: Add sanity check for SIMD fastpath handler.

Sudarsana Reddy Kalluru <[email protected]>
qed: Fix possible memory leak in Rx error path handling.

Zhizhou Zhang <[email protected]>
arm64: make secondary_start_kernel() notrace

Marek Szyprowski <[email protected]>
arm64: dma-mapping: clear buffers allocated with FORCE_CONTIGUOUS flag

Zhouyang Jia <[email protected]>
xen/scsiback: add error handling for xenbus_printf

Zhouyang Jia <[email protected]>
scsi: xen-scsifront: add error handling for xenbus_printf

Trond Myklebust <[email protected]>
pNFS: Always free the session slot on error in nfs4_layoutget_handle_exception

Zhouyang Jia <[email protected]>
xen: add error handling for xenbus_printf

Nicholas Piggin <[email protected]>
powerpc: smp_send_stop do not offline stopped CPUs

Minas Harutyunyan <[email protected]>
dwc2: gadget: Fix ISOC IN DDMA PID bitfield value calculation

Grigor Tovmasyan <[email protected]>
usb: gadget: dwc2: fix memory leak in gadget_init()

Chunfeng Yun <[email protected]>
usb: gadget: composite: fix delayed_status race condition when set_interface

William Wu <[email protected]>
usb: dwc2: fix isoc split in transfer with no data

William Wu <[email protected]>
usb: dwc2: alloc dma aligned buffer for isoc split in

Artur Petrosyan <[email protected]>
usb: dwc2: Fix host exit from hibernation flow.

Janusz Krzysztofik <[email protected]>
dmaengine: ti: omap-dma: Fix OMAP1510 incorrect residue_granularity

John Garry <[email protected]>
libahci: Fix possible Spectre-v1 pmp indexing in ahci_led_store()

Vijay Immanuel <[email protected]>
IB/rxe: Fix missing completion for mem_reg work requests

Ayan Kumar Halder <[email protected]>
drm/mali-dp: Rectify the width and height passed to rotmem_required()

Ayan Kumar Halder <[email protected]>
drm/arm/malidp: Preserve LAYER_FORMAT contents when setting format

Alison Wang <[email protected]>
drm: mali-dp: Enable Global SE interrupts mask for DP500

Ayan Kumar Halder <[email protected]>
drm/arm/malidp: Ensure that the crtcs are shutdown before removing any encoder/connector

Hoan Tran <[email protected]>
drivers/perf: xgene_pmu: Fix IOB SLOW PMU parser error

Ray Jui <[email protected]>
arm64: dts: Stingray: Fix I2C controller interrupt type

Ray Jui <[email protected]>
arm64: dts: ns2: Fix PCIe controller interrupt type

Ray Jui <[email protected]>
arm64: dts: ns2: Fix I2C controller interrupt type

Scott Branden <[email protected]>
arm64: dts: specify 1.8V EMMC capabilities for bcm958742t

Scott Branden <[email protected]>
arm64: dts: specify 1.8V EMMC capabilities for bcm958742k

Ray Jui <[email protected]>
ARM: dts: Cygnus: Fix PCIe controller interrupt type

Ray Jui <[email protected]>
ARM: dts: Cygnus: Fix I2C controller interrupt type

Florian Fainelli <[email protected]>
ARM: dts: BCM5301x: Fix i2c controller interrupt type

Florian Fainelli <[email protected]>
ARM: dts: HR2: Fix interrupt types for i2c and PCIe

Florian Fainelli <[email protected]>
ARM: dts: NSP: Fix PCIe controllers interrupt types

Florian Fainelli <[email protected]>
ARM: dts: NSP: Fix i2c controller interrupt type

Fathi Boudra <[email protected]>
selftests: sync: add config fragment for testing sync framework

Shuah Khan (Samsung OSG) <[email protected]>
selftests: vm: return Kselftest Skip code for skipped tests

Shuah Khan (Samsung OSG) <[email protected]>
selftests: zram: return Kselftest Skip code for skipped tests

Shuah Khan (Samsung OSG) <[email protected]>
selftests: user: return Kselftest Skip code for skipped tests

Shuah Khan (Samsung OSG) <[email protected]>
selftests: sysctl: return Kselftest Skip code for skipped tests

Shuah Khan (Samsung OSG) <[email protected]>
selftests: static_keys: return Kselftest Skip code for skipped tests

Shuah Khan (Samsung OSG) <[email protected]>
selftests: pstore: return Kselftest Skip code for skipped tests

Gao Feng <[email protected]>
netfilter: nf_ct_helper: Fix possible panic after nf_conntrack_helper_unregister

Eric Dumazet <[email protected]>
netfilter: ipv6: nf_defrag: reduce struct net memory waste

Mika Westerberg <[email protected]>
ACPI / EC: Use ec_no_wakeup on Thinkpad X1 Carbon 6th

Johan Hovold <[email protected]>
usb: dwc3: of-simple: fix use-after-free on remove

Minas Harutyunyan <[email protected]>
usb: dwc2: gadget: Fix issue in dwc2_gadget_start_isoc()

Vincent Pelletier <[email protected]>
usb: gadget: ffs: Fix BUG when userland exits with submitted AIO transfers

Heikki Krogerus <[email protected]>
usb: dwc3: pci: add support for Intel IceLake

Anson Huang <[email protected]>
soc: imx: gpcv2: correct PGC offset

Guenter Roeck <[email protected]>
hwmon: (nct6775) Fix loop limit

Helge Eichelberg <[email protected]>
hwmon: (dell-smm) Disable fan support for Dell XPS13 9333

Steve French <[email protected]>
smb3: increase initial number of credits requested to allow write

Jakub Kicinski <[email protected]>
selftests/bpf: test offloads even with BPF programs present

Alexey Brodkin <[email protected]>
ARC: Explicitly add -mmedium-calls to CFLAGS

Maciej Purski <[email protected]>
drm/bridge/sii8620: fix potential buffer overflow

Maciej Purski <[email protected]>
drm/bridge/sii8620: fix display modes validation

Andrzej Hajda <[email protected]>
drm/bridge/sii8620: fix loops in EDID fetch logic

Julia Lawall <[email protected]>
clocksource/drivers/stm32: Fix error return code

Christophe Jaillet <[email protected]>
IB/mlx4: Fix an error handling path in 'mlx4_ib_rereg_user_mr()'

Lucas Stach <[email protected]>
Input: synaptics-rmi4 - fix axis-swap behavior

Kalderon, Michal <[email protected]>
RDMA/qedr: Fix NULL pointer dereference when running over iWARP without RDMA-CM

Zhu Yanjun <[email protected]>
IB/rxe: avoid double kfree skb

Nicolas Boichat <[email protected]>
HID: google: Add support for whiskers

Jiri Olsa <[email protected]>
perf tools: Fix error index for pmu event parser

Dong Jia Shi <[email protected]>
vfio: ccw: fix error return in vfio_ccw_sch_event

Viresh Kumar <[email protected]>
arm: dts: armada: Fix "#cooling-cells" property's name

-------------

Diffstat:

 Makefile                                           |  10 +-
 arch/arc/Makefile                                  |  15 +--
 arch/arc/include/asm/mach_desc.h                   |   2 -
 arch/arc/kernel/irq.c                              |   2 +-
 arch/arc/kernel/process.c                          |  47 ++++++--
 arch/arc/plat-hsdk/platform.c                      |  62 +++++++++++
 arch/arm/boot/dts/am3517.dtsi                      |   5 +
 arch/arm/boot/dts/am437x-sk-evm.dts                |   2 +
 arch/arm/boot/dts/armada-385-synology-ds116.dts    |   2 +-
 arch/arm/boot/dts/bcm-cygnus.dtsi                  |  24 ++--
 arch/arm/boot/dts/bcm-hr2.dtsi                     |  24 ++--
 arch/arm/boot/dts/bcm-nsp.dtsi                     |  32 +++---
 arch/arm/boot/dts/bcm5301x.dtsi                    |   2 +-
 arch/arm/boot/dts/da850.dtsi                       |   6 +-
 arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi            |   2 +-
 arch/arm/boot/dts/omap4-droid4-xt894.dts           |   9 +-
 arch/arm/configs/imx_v4_v5_defconfig               |   2 +
 arch/arm/configs/imx_v6_v7_defconfig               |   2 +
 arch/arm/crypto/speck-neon-core.S                  |   6 +-
 arch/arm/mach-davinci/board-da850-evm.c            |   2 +-
 arch/arm/mach-omap2/omap-smp.c                     |  41 +++++++
 arch/arm/mach-pxa/irq.c                            |   4 +-
 arch/arm/mm/init.c                                 |   9 ++
 arch/arm64/boot/dts/amlogic/meson-axg-s400.dts     |  15 ++-
 arch/arm64/boot/dts/amlogic/meson-gxl-mali.dtsi    |   2 +-
 arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi   |   8 +-
 .../boot/dts/broadcom/stingray/bcm958742k.dts      |   4 +
 .../boot/dts/broadcom/stingray/bcm958742t.dts      |   4 +
 .../arm64/boot/dts/broadcom/stingray/stingray.dtsi |   4 +-
 arch/arm64/boot/dts/qcom/msm8916.dtsi              |   4 +-
 .../boot/dts/socionext/uniphier-ld11-global.dts    |   2 +-
 .../boot/dts/socionext/uniphier-ld20-global.dts    |   2 +-
 arch/arm64/include/asm/alternative.h               |   7 +-
 arch/arm64/kernel/alternative.c                    |  51 +++++++--
 arch/arm64/kernel/module.c                         |   5 +-
 arch/arm64/kernel/smp.c                            |   2 +-
 arch/arm64/mm/dma-mapping.c                        |   9 +-
 arch/ia64/kernel/perfmon.c                         |   6 +-
 arch/ia64/mm/init.c                                |  12 +-
 arch/m68k/include/asm/mcf_pgalloc.h                |   4 +-
 arch/nds32/kernel/setup.c                          |   3 +-
 arch/openrisc/kernel/entry.S                       |   8 +-
 arch/openrisc/kernel/head.S                        |   9 +-
 arch/openrisc/kernel/traps.c                       |   2 +-
 arch/parisc/include/asm/spinlock.h                 |   8 +-
 arch/parisc/kernel/syscall.S                       |  24 ++--
 arch/powerpc/kernel/smp.c                          |   6 -
 arch/riscv/kernel/irq.c                            |   4 -
 arch/riscv/kernel/module.c                         |   4 +-
 arch/riscv/kernel/ptrace.c                         |   2 +-
 arch/s390/net/bpf_jit_comp.c                       |   1 +
 arch/x86/include/asm/processor.h                   |   1 +
 arch/x86/include/asm/set_memory.h                  |   1 +
 arch/x86/kernel/cpu/microcode/intel.c              |   5 +-
 arch/x86/kernel/kvmclock.c                         |   1 +
 arch/x86/kernel/smpboot.c                          |   5 +
 arch/x86/kvm/vmx.c                                 |   9 +-
 arch/x86/mm/init.c                                 |  37 ++++++-
 arch/x86/mm/init_64.c                              |   8 +-
 arch/x86/mm/pageattr.c                             |  13 +++
 block/blk-mq-debugfs.c                             |   2 +-
 block/blk-mq.c                                     |  12 ++
 block/sed-opal.c                                   |   4 +-
 drivers/acpi/ec.c                                  |  20 ++++
 drivers/acpi/nfit/core.c                           |   4 +
 drivers/ata/libahci.c                              |   7 +-
 drivers/block/drbd/drbd_req.c                      |   4 +-
 drivers/block/nbd.c                                |  40 +++++--
 drivers/char/ipmi/kcs_bmc.c                        |  31 ++----
 drivers/clk/Makefile                               |   2 +-
 drivers/clk/davinci/da8xx-cfgchip.c                |   2 +-
 drivers/clk/sunxi-ng/Makefile                      |  39 +++----
 drivers/clocksource/timer-stm32.c                  |   4 +-
 drivers/dax/device.c                               |  12 +-
 drivers/dma/k3dma.c                                |   2 +-
 drivers/dma/omap-dma.c                             |   6 +-
 drivers/dma/pl330.c                                |   2 +-
 drivers/edac/edac_mc.c                             |   1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             |   3 +-
 drivers/gpu/drm/amd/amdgpu/vce_v3_0.c              |   4 +-
 .../drm/amd/display/dc/dce100/dce100_resource.c    |  19 +++-
 drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c |   1 +
 drivers/gpu/drm/arm/malidp_drv.c                   |   3 +-
 drivers/gpu/drm/arm/malidp_hw.c                    |   3 +-
 drivers/gpu/drm/arm/malidp_planes.c                |   9 +-
 drivers/gpu/drm/armada/armada_crtc.c               |  12 +-
 drivers/gpu/drm/armada/armada_hw.h                 |   1 +
 drivers/gpu/drm/armada/armada_overlay.c            |  30 +++--
 drivers/gpu/drm/bridge/sil-sii8620.c               | 121 +++++++++++----------
 drivers/gpu/drm/exynos/exynos5433_drm_decon.c      |   6 +-
 drivers/gpu/drm/exynos/exynos_drm_gsc.c            |  29 +++--
 drivers/gpu/drm/exynos/regs-gsc.h                  |   1 +
 drivers/gpu/drm/i915/gvt/kvmgt.c                   |   9 +-
 drivers/gpu/drm/nouveau/nouveau_gem.c              |   4 +-
 drivers/gpu/drm/sun4i/Makefile                     |   5 +-
 drivers/gpu/drm/tegra/drm.c                        |   2 +-
 drivers/gpu/host1x/dev.c                           |   3 +
 drivers/gpu/host1x/job.c                           |   3 +-
 drivers/hid/hid-google-hammer.c                    |   2 +
 drivers/hid/hid-ids.h                              |   1 +
 drivers/hid/wacom_wac.c                            |  10 +-
 drivers/hwmon/dell-smm-hwmon.c                     |   7 ++
 drivers/hwmon/nct6775.c                            |   2 +-
 drivers/i2c/busses/i2c-imx.c                       |   8 +-
 drivers/i2c/i2c-core-acpi.c                        |  11 +-
 drivers/iio/pressure/bmp280-core.c                 |   5 +-
 drivers/infiniband/hw/mlx4/mr.c                    |   7 +-
 drivers/infiniband/hw/mlx5/srq.c                   |  18 ++-
 drivers/infiniband/hw/qedr/verbs.c                 |   3 +
 drivers/infiniband/sw/rxe/rxe_req.c                |   5 +-
 drivers/input/rmi4/rmi_2d_sensor.c                 |  34 +++---
 drivers/irqchip/irq-gic-v2m.c                      |   2 +-
 drivers/irqchip/irq-gic-v3-its.c                   |  10 ++
 drivers/md/raid10.c                                |   7 ++
 drivers/mtd/devices/mtd_dataflash.c                |   4 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h        |   1 +
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c    |   6 +
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c   |   6 +
 drivers/net/ethernet/broadcom/bnxt/bnxt.c          |  15 ++-
 drivers/net/ethernet/broadcom/bnxt/bnxt.h          |   1 -
 drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c       |  30 ++++-
 drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c      |   2 -
 drivers/net/ethernet/cadence/macb_main.c           |  11 +-
 drivers/net/ethernet/cavium/Kconfig                |  12 +-
 drivers/net/ethernet/cavium/octeon/octeon_mgmt.c   |  14 ++-
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c    |   2 +-
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.c         |  35 +++---
 drivers/net/ethernet/cisco/enic/enic_clsf.c        |   3 +-
 drivers/net/ethernet/cisco/enic/enic_main.c        |   3 +-
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c     |  15 +--
 drivers/net/ethernet/freescale/fman/fman_port.c    |   8 ++
 drivers/net/ethernet/ibm/ibmvnic.c                 |  43 +++++---
 drivers/net/ethernet/intel/ixgbe/ixgbe_common.c    |  12 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c     |   2 +-
 drivers/net/ethernet/mellanox/mlx5/core/eswitch.c  |  12 +-
 drivers/net/ethernet/mellanox/mlx5/core/vport.c    |   2 -
 drivers/net/ethernet/netronome/nfp/bpf/main.c      |   6 +-
 .../net/ethernet/netronome/nfp/nfpcore/nfp_nffw.c  |   2 +-
 drivers/net/ethernet/qlogic/qed/qed_dcbx.c         |  11 +-
 drivers/net/ethernet/qlogic/qed/qed_debug.c        |   2 +-
 drivers/net/ethernet/qlogic/qed/qed_ll2.c          |  11 +-
 drivers/net/ethernet/qlogic/qed/qed_main.c         |  12 +-
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c  |   2 +
 drivers/net/ethernet/qualcomm/qca_spi.c            |  21 ++--
 drivers/net/ethernet/realtek/r8169.c               |   1 +
 drivers/net/ethernet/renesas/ravb_main.c           |  56 +++-------
 drivers/net/ethernet/renesas/sh_eth.c              |  59 +++-------
 drivers/net/ethernet/sfc/ef10.c                    |  30 +++--
 drivers/net/ethernet/sfc/efx.c                     |  17 ++-
 drivers/net/ethernet/stmicro/stmmac/Kconfig        |   2 +-
 .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c    |  18 ++-
 drivers/net/ethernet/ti/davinci_emac.c             |   4 +
 drivers/net/hamradio/bpqether.c                    |   8 +-
 drivers/net/hyperv/rndis_filter.c                  |   1 +
 drivers/net/ieee802154/adf7242.c                   |  34 +++++-
 drivers/net/ieee802154/at86rf230.c                 |  15 +--
 drivers/net/ieee802154/fakelb.c                    |   2 +-
 drivers/net/ieee802154/mcr20a.c                    |   3 +-
 drivers/net/ipvlan/ipvlan_main.c                   |  36 ++++--
 drivers/net/phy/marvell.c                          |  54 ++++++---
 drivers/net/phy/sfp-bus.c                          |  35 ++++--
 drivers/net/usb/rtl8150.c                          |   2 +-
 drivers/net/usb/smsc75xx.c                         |  62 +++++++++++
 drivers/net/wireless/ath/ath10k/mac.c              |  16 ++-
 drivers/net/wireless/ath/ath10k/wmi.h              |   1 +
 .../wireless/broadcom/brcm80211/brcmfmac/sdio.c    |   7 ++
 drivers/nfc/pn533/usb.c                            |   4 +-
 drivers/nvme/host/core.c                           |  52 ++++-----
 drivers/nvme/host/pci.c                            |   2 +-
 drivers/nvme/host/rdma.c                           |  28 +++--
 drivers/nvme/target/core.c                         |   8 ++
 drivers/nvmem/core.c                               |   4 +
 drivers/of/base.c                                  |   6 +-
 drivers/of/of_private.h                            |   2 +
 drivers/of/overlay.c                               |  11 ++
 drivers/pci/dwc/pcie-designware-host.c             |   3 +-
 drivers/pci/host/pci-aardvark.c                    |   2 +-
 drivers/pci/host/pci-ftpci100.c                    |   4 +-
 drivers/pci/host/pci-v3-semi.c                     |   2 +-
 drivers/pci/host/pci-versatile.c                   |   2 +-
 drivers/pci/host/pci-xgene.c                       |   2 +-
 drivers/pci/host/pcie-mediatek.c                   |   2 +-
 drivers/pci/host/pcie-xilinx-nwl.c                 |   2 +-
 drivers/pci/host/pcie-xilinx.c                     |   1 +
 drivers/pci/hotplug/pci_hotplug_core.c             |   9 ++
 drivers/pci/hotplug/pciehp.h                       |   1 +
 drivers/pci/hotplug/pciehp_core.c                  |   7 ++
 drivers/pci/hotplug/pciehp_hpc.c                   |  18 +--
 drivers/pci/of.c                                   |   2 +-
 drivers/pci/pci-acpi.c                             |   6 +-
 drivers/pci/pci.c                                  |  66 +++++++++++
 drivers/pci/probe.c                                |   4 +
 drivers/perf/xgene_pmu.c                           |   2 +-
 drivers/pinctrl/bcm/pinctrl-nsp-mux.c              |   6 +-
 drivers/pinctrl/pinctrl-ingenic.c                  |   2 +-
 drivers/platform/x86/dell-laptop.c                 |   2 +-
 drivers/rtc/interface.c                            |   8 +-
 drivers/s390/cio/vfio_ccw_drv.c                    |   5 +-
 drivers/s390/net/qeth_core.h                       |   2 +-
 drivers/s390/net/qeth_core_main.c                  |  23 ++--
 drivers/s390/net/qeth_l2_main.c                    |   5 +-
 drivers/s390/net/qeth_l3_main.c                    |   3 +-
 drivers/scsi/hpsa.c                                |  25 ++++-
 drivers/scsi/hpsa.h                                |   1 +
 drivers/scsi/qedf/qedf_main.c                      |  12 ++
 drivers/scsi/qedi/qedi_main.c                      |  11 ++
 drivers/scsi/xen-scsifront.c                       |  33 ++++--
 drivers/soc/imx/gpc.c                              |  21 ++++
 drivers/soc/imx/gpcv2.c                            |  13 ++-
 drivers/tty/pty.c                                  |   2 +-
 drivers/usb/chipidea/host.c                        |   5 +-
 drivers/usb/dwc2/core.h                            |   3 +
 drivers/usb/dwc2/gadget.c                          |  15 ++-
 drivers/usb/dwc2/hcd.c                             |  93 +++++++++++++++-
 drivers/usb/dwc2/hcd.h                             |   8 ++
 drivers/usb/dwc2/hcd_intr.c                        |  11 +-
 drivers/usb/dwc2/hcd_queue.c                       |   3 +
 drivers/usb/dwc3/dwc3-of-simple.c                  |   3 +-
 drivers/usb/dwc3/dwc3-pci.c                        |   2 +
 drivers/usb/gadget/composite.c                     |   3 +
 drivers/usb/gadget/function/f_fs.c                 |  26 +++--
 drivers/usb/host/xhci-dbgcap.c                     |  12 +-
 drivers/usb/host/xhci-tegra.c                      |   2 +-
 drivers/usb/host/xhci.c                            |   7 +-
 drivers/usb/typec/tcpm.c                           |   3 +-
 drivers/xen/manage.c                               |  18 ++-
 drivers/xen/xen-scsiback.c                         |  16 ++-
 fs/btrfs/scrub.c                                   |  17 +--
 fs/ceph/inode.c                                    |   1 +
 fs/cifs/smb2pdu.c                                  |   5 +-
 fs/exec.c                                          |   6 +-
 fs/ext4/mballoc.c                                  |   4 +-
 fs/nfs/nfs4proc.c                                  |  17 +--
 fs/reiserfs/xattr.c                                |   4 +-
 include/linux/fsl/guts.h                           |   1 +
 include/linux/kthread.h                            |   1 -
 include/linux/marvell_phy.h                        |   2 +
 include/linux/mm.h                                 |   4 +-
 include/linux/pci.h                                |   2 +
 include/linux/sched.h                              |   2 +-
 include/net/ipv6.h                                 |   9 +-
 include/net/net_namespace.h                        |   1 +
 include/net/netns/ipv6.h                           |   1 -
 include/net/tc_act/tc_csum.h                       |   1 -
 include/net/tc_act/tc_tunnel_key.h                 |   1 -
 include/net/tcp.h                                  |   2 -
 include/uapi/linux/nbd.h                           |   3 +
 kernel/bpf/hashtab.c                               |  16 ++-
 kernel/fork.c                                      |  35 +++++-
 kernel/kthread.c                                   |  30 ++++-
 kernel/locking/lockdep.c                           |  12 +-
 kernel/sched/core.c                                |  67 ++++++------
 kernel/sched/deadline.c                            |  11 +-
 kernel/sched/fair.c                                |  30 ++---
 kernel/sched/sched.h                               |   6 +-
 kernel/trace/trace.c                               |   5 +
 mm/kasan/kasan.c                                   |   5 +-
 mm/mmap.c                                          |  35 ++----
 mm/nommu.c                                         |  10 +-
 mm/page_alloc.c                                    |  16 ++-
 net/9p/client.c                                    |   3 +-
 net/batman-adv/bat_iv_ogm.c                        |   4 +-
 net/batman-adv/bat_v.c                             |   4 +-
 net/batman-adv/debugfs.c                           |  40 +++++++
 net/batman-adv/debugfs.h                           |  11 ++
 net/batman-adv/hard-interface.c                    |  37 ++++++-
 net/batman-adv/translation-table.c                 |   7 +-
 net/core/dev.c                                     |   4 +-
 net/core/filter.c                                  |   3 +-
 net/ieee802154/6lowpan/core.c                      |   6 +
 net/ipv4/inet_fragment.c                           |   2 +-
 net/ipv4/netfilter/ip_tables.c                     |   1 +
 net/ipv4/tcp.c                                     |   4 +-
 net/ipv4/tcp_dctcp.c                               |  25 -----
 net/ipv4/tcp_output.c                              |   4 -
 net/ipv6/calipso.c                                 |   9 +-
 net/ipv6/exthdrs.c                                 | 111 +++++--------------
 net/ipv6/ipv6_sockglue.c                           |  27 +++--
 net/ipv6/mcast.c                                   |   9 +-
 net/ipv6/netfilter/ip6_tables.c                    |   1 +
 net/ipv6/netfilter/nf_conntrack_reasm.c            |   6 +-
 net/mac80211/tx.c                                  |   2 +
 net/netfilter/nf_conntrack_core.c                  |   2 +-
 net/netfilter/nf_conntrack_helper.c                |   5 +
 net/netfilter/nf_conntrack_proto_dccp.c            |   8 +-
 net/netfilter/nf_log.c                             |   4 +
 net/netfilter/nft_compat.c                         |  13 +++
 net/packet/af_packet.c                             |  12 +-
 net/qrtr/qrtr.c                                    |  13 ++-
 net/rds/connection.c                               |  11 +-
 net/rds/loop.c                                     |  56 ++++++++++
 net/rds/loop.h                                     |   2 +
 net/sched/act_csum.c                               |   6 +-
 net/sched/act_tunnel_key.c                         |   6 +-
 net/sctp/chunk.c                                   |   4 +-
 net/smc/af_smc.c                                   |   3 +-
 net/smc/smc_clc.c                                  |   3 +-
 net/tipc/discover.c                                |  18 +--
 net/tipc/net.c                                     |  17 ++-
 net/tipc/node.c                                    |   7 +-
 net/tls/tls_sw.c                                   |   5 +
 net/wireless/nl80211.c                             |  35 +++---
 net/xfrm/xfrm_user.c                               |   8 +-
 samples/bpf/parse_varlen.c                         |   6 +-
 samples/bpf/test_overhead_user.c                   |  19 +++-
 samples/bpf/trace_event_user.c                     |  27 ++++-
 samples/bpf/xdp2skb_meta.sh                        |   6 +-
 scripts/kconfig/zconf.y                            |   4 +-
 security/smack/smack_lsm.c                         |   1 +
 sound/core/seq/seq_clientmgr.c                     |   3 +-
 tools/build/Build.include                          |   2 +-
 tools/build/Makefile                               |   2 +-
 tools/objtool/elf.c                                |  41 ++++---
 tools/perf/Makefile.config                         |   3 +-
 tools/perf/arch/powerpc/util/skip-callchain-idx.c  |   2 +-
 tools/perf/arch/x86/util/perf_regs.c               |   2 +-
 tools/perf/bench/numa.c                            |   5 +-
 tools/perf/builtin-annotate.c                      |  11 +-
 tools/perf/builtin-report.c                        |   3 +-
 tools/perf/builtin-script.c                        |  25 ++++-
 tools/perf/jvmti/jvmti_agent.c                     |   3 +-
 tools/perf/pmu-events/Build                        |   2 +-
 tools/perf/tests/builtin-test.c                    |   2 +-
 tools/perf/tests/parse-events.c                    |   8 +-
 tools/perf/tests/topology.c                        |   1 +
 tools/perf/util/c++/clang.cpp                      |  11 +-
 tools/perf/util/header.c                           |  12 +-
 tools/perf/util/llvm-utils.c                       |   6 +-
 tools/perf/util/parse-events.y                     |   5 +
 .../util/scripting-engines/trace-event-python.c    |   8 +-
 tools/testing/nvdimm/test/nfit.c                   |   3 +-
 tools/testing/selftests/bpf/test_kmod.sh           |   9 ++
 tools/testing/selftests/bpf/test_offload.py        |  12 +-
 tools/testing/selftests/net/config                 |   2 +
 .../selftests/pstore/pstore_post_reboot_tests      |   5 +-
 .../selftests/static_keys/test_static_keys.sh      |  13 +++
 tools/testing/selftests/sync/config                |   4 +
 tools/testing/selftests/sysctl/sysctl.sh           |  20 ++--
 tools/testing/selftests/user/test_user_copy.sh     |   7 ++
 tools/testing/selftests/vm/compaction_test.c       |   4 +-
 tools/testing/selftests/vm/mlock2-tests.c          |  12 +-
 tools/testing/selftests/vm/run_vmtests             |   5 +-
 tools/testing/selftests/vm/userfaultfd.c           |   4 +-
 tools/testing/selftests/x86/sigreturn.c            |  59 ++++++----
 tools/testing/selftests/zram/zram.sh               |   5 +-
 tools/testing/selftests/zram/zram_lib.sh           |   5 +-
 virt/kvm/arm/vgic/vgic-v3.c                        |   5 -
 347 files changed, 2652 insertions(+), 1285 deletions(-)
author maintainer
#11 lore raw

PATCH 11/324 drm/bridge/sii8620: fix display modes validation

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Maciej Purski <[email protected]>

[ Upstream commit ecba7cfa3afbe489288f2c819158b7402afd7ee9 ]

Current implementation of mode_valid() and mode_fixup() callbacks handle packed pixel modes improperly.

Fix it by using proper maximum clock values from the documentation.

---
 drivers/gpu/drm/bridge/sil-sii8620.c |   78 +++++++++++++++++------------------
 1 file changed, 40 insertions(+), 38 deletions(-)
drivers/gpu/drm/bridge/sil-sii8620.c +40 -38
@@ -36,8 +36,11 @@
 
 #define SII8620_BURST_BUF_LEN 288
 #define VAL_RX_HDMI_CTRL2_DEFVAL VAL_RX_HDMI_CTRL2_IDLE_CNT(3)
-#define MHL1_MAX_LCLK 225000
-#define MHL3_MAX_LCLK 600000
+
+#define MHL1_MAX_PCLK 75000
+#define MHL1_MAX_PCLK_PP_MODE 150000
+#define MHL3_MAX_PCLK 200000
+#define MHL3_MAX_PCLK_PP_MODE 300000
 
 enum sii8620_mode {
 	CM_DISCONNECTED,
@@ -2277,17 +2280,43 @@ static void sii8620_detach(struct drm_br
 	rc_unregister_device(ctx->rc_dev);
 }
 
+static int sii8620_is_packing_required(struct sii8620 *ctx,
+				       const struct drm_display_mode *mode)
+{
+	int max_pclk, max_pclk_pp_mode;
+
+	if (sii8620_is_mhl3(ctx)) {
+		max_pclk = MHL3_MAX_PCLK;
+		max_pclk_pp_mode = MHL3_MAX_PCLK_PP_MODE;
+	} else {
+		max_pclk = MHL1_MAX_PCLK;
+		max_pclk_pp_mode = MHL1_MAX_PCLK_PP_MODE;
+	}
+
+	if (mode->clock < max_pclk)
+		return 0;
+	else if (mode->clock < max_pclk_pp_mode)
+		return 1;
+	else
+		return -1;
+}
+
 static enum drm_mode_status sii8620_mode_valid(struct drm_bridge *bridge,
 					 const struct drm_display_mode *mode)
 {
 	struct sii8620 *ctx = bridge_to_sii8620(bridge);
+	int pack_required = sii8620_is_packing_required(ctx, mode);
 	bool can_pack = ctx->devcap[MHL_DCAP_VID_LINK_MODE] &
 			MHL_DCAP_VID_LINK_PPIXEL;
-	unsigned int max_pclk = sii8620_is_mhl3(ctx) ? MHL3_MAX_LCLK :
-						       MHL1_MAX_LCLK;
-	max_pclk /= can_pack ? 2 : 3;
 
-	return (mode->clock > max_pclk) ? MODE_CLOCK_HIGH : MODE_OK;
+	switch (pack_required) {
+	case 0:
+		return MODE_OK;
+	case 1:
+		return (can_pack) ? MODE_OK : MODE_CLOCK_HIGH;
+	default:
+		return MODE_CLOCK_HIGH;
+	}
 }
 
 static bool sii8620_mode_fixup(struct drm_bridge *bridge,
@@ -2295,43 +2324,16 @@ static bool sii8620_mode_fixup(struct dr
 			       struct drm_display_mode *adjusted_mode)
 {
 	struct sii8620 *ctx = bridge_to_sii8620(bridge);
-	int max_lclk;
-	bool ret = true;
 
 	mutex_lock(&ctx->lock);
 
-	max_lclk = sii8620_is_mhl3(ctx) ? MHL3_MAX_LCLK : MHL1_MAX_LCLK;
-	if (max_lclk > 3 * adjusted_mode->clock) {
-		ctx->use_packed_pixel = 0;
-		goto end;
-	}
-	if ((ctx->devcap[MHL_DCAP_VID_LINK_MODE] & MHL_DCAP_VID_LINK_PPIXEL) &&
-	    max_lclk > 2 * adjusted_mode->clock) {
-		ctx->use_packed_pixel = 1;
-		goto end;
-	}
-	ret = false;
-end:
-	if (ret) {
-		u8 vic = drm_match_cea_mode(adjusted_mode);
+	ctx->use_packed_pixel = sii8620_is_packing_required(ctx, adjusted_mode);
+	ctx->video_code = drm_match_cea_mode(adjusted_mode);
+	ctx->pixel_clock = adjusted_mode->clock;
 
-		if (!vic) {
-			union hdmi_infoframe frm;
-			u8 mhl_vic[] = { 0, 95, 94, 93, 98 };
-
-			/* FIXME: We need the connector here */
-			drm_hdmi_vendor_infoframe_from_display_mode(
-				&frm.vendor.hdmi, NULL, adjusted_mode);
-			vic = frm.vendor.hdmi.vic;
-			if (vic >= ARRAY_SIZE(mhl_vic))
-				vic = 0;
-			vic = mhl_vic[vic];
-		}
-		ctx->video_code = vic;
-		ctx->pixel_clock = adjusted_mode->clock;
-	}
 	mutex_unlock(&ctx->lock);
-	return ret;
+
+	return true;
 }
 
 static const struct drm_bridge_funcs sii8620_bridge_funcs = {
author maintainer
#23 lore raw

PATCH 22/324 usb: dwc3: of-simple: fix use-after-free on remove

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Johan Hovold <[email protected]>

[ Upstream commit 896e518883f18e601335908192e33426c1f599a4 ]

The clocks have already been explicitly disabled and put as part of remove() so the runtime suspend callback must not be run when balancing the runtime PM usage count before returning.

Fixes 16adc674d0d6 ("usb: dwc3: add generic OF glue layer")
---
 drivers/usb/dwc3/dwc3-of-simple.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/dwc3/dwc3-of-simple.c +2 -1
@@ -165,8 +165,9 @@ static int dwc3_of_simple_remove(struct
 
 	reset_control_put(simple->resets);
 
-	pm_runtime_put_sync(dev);
 	pm_runtime_disable(dev);
+	pm_runtime_put_noidle(dev);
+	pm_runtime_set_suspended(dev);
 
 	return 0;
 }
author maintainer
#24 lore raw

PATCH 23/324 ACPI / EC: Use ec_no_wakeup on Thinkpad X1 Carbon 6th

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Mika Westerberg <[email protected]>

[ Upstream commit 8195a655e5ce09550aff81b2573d9b015d520cb9 ]

On this system EC interrupt triggers constantly kicking devices out of low power states and thus blocking power management. The system also has a PCIe root port hosting Alpine Ridge Thunderbolt controller and it never gets a chance to go to D3cold because of this.

Since the power button works the same regardless if EC interrupt is enabled or not during s2idle, add a quirk for this machine that sets ec_no_wakeup=true preventing spurious wakeups.

---
 drivers/acpi/ec.c |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/acpi/ec.c +20 -0
@@ -2031,6 +2031,17 @@ static inline void acpi_ec_query_exit(vo
 	}
 }
 
+static const struct dmi_system_id acpi_ec_no_wakeup[] = {
+	{
+		.ident = "Thinkpad X1 Carbon 6th",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "20KGS3JF01"),
+		},
+	},
+	{ },
+};
+
 int __init acpi_ec_init(void)
 {
 	int result;
@@ -2041,6 +2052,15 @@ int __init acpi_ec_init(void)
 	if (result)
 		return result;
 
+	/*
+	 * Disable EC wakeup on following systems to prevent periodic
+	 * wakeup from EC GPE.
+	 */
+	if (dmi_check_system(acpi_ec_no_wakeup)) {
+		ec_no_wakeup = true;
+		pr_debug("Disabling EC wakeup on suspend-to-idle\n");
+	}
+
 	/* Drivers must be started after acpi_ec_query_init() */
 	dsdt_fail = acpi_bus_register_driver(&acpi_ec_driver);
 	/*
author maintainer
#25 lore raw

PATCH 24/324 netfilter: ipv6: nf_defrag: reduce struct net memory waste

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Eric Dumazet <[email protected]>

[ Upstream commit 9ce7bc036ae4cfe3393232c86e9e1fea2153c237 ]

It is a waste of memory to use a full "struct netns_sysctl_ipv6" while only one pointer is really used, considering netns_sysctl_ipv6 keeps growing.

Also, since "struct netns_frags" has cache line alignment, it is better to move the frags_hdr pointer outside, otherwise we spend a full cache line for this pointer.

This saves 192 bytes of memory per netns.

Fixes c038a767cd69 ("ipv6: add a new namespace for nf_conntrack_reasm")
---
 include/net/net_namespace.h             |    1 +
 include/net/netns/ipv6.h                |    1 -
 net/ipv6/netfilter/nf_conntrack_reasm.c |    6 +++---
 3 files changed, 4 insertions(+), 4 deletions(-)
include/net/net_namespace.h +1 -0
@@ -128,6 +128,7 @@ struct net {
 #endif
 #if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
 	struct netns_nf_frag	nf_frag;
+	struct ctl_table_header *nf_frag_frags_hdr;
 #endif
 	struct sock		*nfnl;
 	struct sock		*nfnl_stash;
include/net/netns/ipv6.h +0 -1
@@ -107,7 +107,6 @@ struct netns_ipv6 {
 
 #if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
 struct netns_nf_frag {
-	struct netns_sysctl_ipv6 sysctl;
 	struct netns_frags	frags;
 };
 #endif
net/ipv6/netfilter/nf_conntrack_reasm.c +3 -3
@@ -107,7 +107,7 @@ static int nf_ct_frag6_sysctl_register(s
 	if (hdr == NULL)
 		goto err_reg;
 
-	net->nf_frag.sysctl.frags_hdr = hdr;
+	net->nf_frag_frags_hdr = hdr;
 	return 0;
 
 err_reg:
@@ -121,8 +121,8 @@ static void __net_exit nf_ct_frags6_sysc
 {
 	struct ctl_table *table;
 
-	table = net->nf_frag.sysctl.frags_hdr->ctl_table_arg;
-	unregister_net_sysctl_table(net->nf_frag.sysctl.frags_hdr);
+	table = net->nf_frag_frags_hdr->ctl_table_arg;
+	unregister_net_sysctl_table(net->nf_frag_frags_hdr);
 	if (!net_eq(net, &init_net))
 		kfree(table);
 }
author maintainer
#29 lore raw

PATCH 28/324 selftests: sysctl: return Kselftest Skip code for skipped tests

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: "Shuah Khan (Samsung OSG)" <[email protected]>

[ Upstream commit c7db6ffb831fd36a03485a0d88b1e505378975ad ]

When sysctl test is skipped because of unmet dependencies and/or unsupported configuration, it exits with error which is treated as a fail by the Kselftest framework. This leads to false negative result even when the test could not be run.

Change it to return kselftest skip code when a test gets skipped to clearly report that the test could not be run.

Changed return code to kselftest skip code in skip error legs that check requirements and module probe test error leg.

Kselftest framework SKIP code is 4 and the framework prints appropriate messages to indicate that the test is skipped.

---
 tools/testing/selftests/sysctl/sysctl.sh |   20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
tools/testing/selftests/sysctl/sysctl.sh +13 -7
@@ -14,6 +14,9 @@
 
 # This performs a series tests against the proc sysctl interface.
 
+# Kselftest framework requirement - SKIP code is 4.
+ksft_skip=4
+
 TEST_NAME="sysctl"
 TEST_DRIVER="test_${TEST_NAME}"
 TEST_DIR=$(dirname $0)
@@ -41,7 +44,7 @@ test_modprobe()
                echo "$0: $DIR not present" >&2
                echo "You must have the following enabled in your kernel:" >&2
                cat $TEST_DIR/config >&2
-               exit 1
+               exit $ksft_skip
        fi
 }
 
@@ -98,28 +101,30 @@ test_reqs()
 	uid=$(id -u)
 	if [ $uid -ne 0 ]; then
 		echo $msg must be run as root >&2
-		exit 0
+		exit $ksft_skip
 	fi
 
 	if ! which perl 2> /dev/null > /dev/null; then
 		echo "$0: You need perl installed"
-		exit 1
+		exit $ksft_skip
 	fi
 	if ! which getconf 2> /dev/null > /dev/null; then
 		echo "$0: You need getconf installed"
-		exit 1
+		exit $ksft_skip
 	fi
 	if ! which diff 2> /dev/null > /dev/null; then
 		echo "$0: You need diff installed"
-		exit 1
+		exit $ksft_skip
 	fi
 }
 
 function load_req_mod()
 {
-	trap "test_modprobe" EXIT
-
 	if [ ! -d $DIR ]; then
+		if ! modprobe -q -n $TEST_DRIVER; then
+			echo "$0: module $TEST_DRIVER not found [SKIP]"
+			exit $ksft_skip
+		fi
 		modprobe $TEST_DRIVER
 		if [ $? -ne 0 ]; then
 			exit
@@ -765,6 +770,7 @@ function parse_args()
 test_reqs
 allow_user_defaults
 check_production_sysctl_writes_strict
+test_modprobe
 load_req_mod
 
 trap "test_finish" EXIT
author maintainer
#30 lore raw

PATCH 29/324 selftests: user: return Kselftest Skip code for skipped tests

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: "Shuah Khan (Samsung OSG)" <[email protected]>

[ Upstream commit d7d5311d4aa9611fe1a5a851e6f75733237a668a ]

When user test is skipped because of unmet dependencies and/or unsupported configuration, it exits with error which is treated as a fail by the Kselftest framework. This leads to false negative result even when the test could not be run.

Change it to return kselftest skip code when a test gets skipped to clearly report that the test could not be run. Add an explicit check for module presence and return skip code if module isn't present.

Kselftest framework SKIP code is 4 and the framework prints appropriate messages to indicate that the test is skipped.

---
 tools/testing/selftests/user/test_user_copy.sh |    7 +++++++
 1 file changed, 7 insertions(+)
tools/testing/selftests/user/test_user_copy.sh +7 -0
@@ -2,6 +2,13 @@
 # SPDX-License-Identifier: GPL-2.0
 # Runs copy_to/from_user infrastructure using test_user_copy kernel module
 
+# Kselftest framework requirement - SKIP code is 4.
+ksft_skip=4
+
+if ! /sbin/modprobe -q -n test_user_copy; then
+	echo "user: module test_user_copy is not found [SKIP]"
+	exit $ksft_skip
+fi
 if /sbin/modprobe -q test_user_copy; then
 	/sbin/modprobe -q -r test_user_copy
 	echo "user_copy: ok"
author maintainer
#12 lore raw

PATCH 12/324 drm/bridge/sii8620: fix potential buffer overflow

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Maciej Purski <[email protected]>

[ Upstream commit 9378cecb1ce5d618b8aff4d65113ddcf72fc1011 ]

Buffer overflow error should not occur, as mode_fixup() callback filters pixel clock value and it should never exceed 600000. However, current implementation is not obviously safe and relies on implementation of mode_fixup().

Make 'i' variable never reach unsafe value in order to avoid buffer overflow error.

---
 drivers/gpu/drm/bridge/sil-sii8620.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/sil-sii8620.c +1 -1
@@ -1228,7 +1228,7 @@ static void sii8620_start_video(struct s
 		int clk = ctx->pixel_clock * (ctx->use_packed_pixel ? 2 : 3);
 		int i;
 
-		for (i = 0; i < ARRAY_SIZE(clk_spec); ++i)
+		for (i = 0; i < ARRAY_SIZE(clk_spec) - 1; ++i)
 			if (clk < clk_spec[i].max_clk)
 				break;
 
author maintainer
#31 lore raw

PATCH 30/324 selftests: zram: return Kselftest Skip code for skipped tests

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: "Shuah Khan (Samsung OSG)" <[email protected]>

[ Upstream commit 685814466bf8398192cf855415a0bb2cefc1930e ]

When zram test is skipped because of unmet dependencies and/or unsupported configuration, it exits with error which is treated as a fail by the Kselftest framework. This leads to false negative result even when the test could not be run.

Change it to return kselftest skip code when a test gets skipped to clearly report that the test could not be run.

Kselftest framework SKIP code is 4 and the framework prints appropriate messages to indicate that the test is skipped.

---
 tools/testing/selftests/zram/zram.sh     |    5 ++++-
 tools/testing/selftests/zram/zram_lib.sh |    5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
tools/testing/selftests/zram/zram.sh +4 -1
@@ -2,6 +2,9 @@
 # SPDX-License-Identifier: GPL-2.0
 TCID="zram.sh"
 
+# Kselftest framework requirement - SKIP code is 4.
+ksft_skip=4
+
 . ./zram_lib.sh
 
 run_zram () {
@@ -24,5 +27,5 @@ elif [ -b /dev/zram0 ]; then
 else
 	echo "$TCID : No zram.ko module or /dev/zram0 device file not found"
 	echo "$TCID : CONFIG_ZRAM is not set"
-	exit 1
+	exit $ksft_skip
 fi
tools/testing/selftests/zram/zram_lib.sh +4 -1
@@ -18,6 +18,9 @@ MODULE=0
 dev_makeswap=-1
 dev_mounted=-1
 
+# Kselftest framework requirement - SKIP code is 4.
+ksft_skip=4
+
 trap INT
 
 check_prereqs()
@@ -27,7 +30,7 @@ check_prereqs()
 
 	if [ $uid -ne 0 ]; then
 		echo $msg must be run as root >&2
-		exit 0
+		exit $ksft_skip
 	fi
 }
 
author maintainer
#33 lore raw

PATCH 32/324 selftests: sync: add config fragment for testing sync framework

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Fathi Boudra <[email protected]>

[ Upstream commit d6a3e55131fcb1e5ca1753f4b6f297a177b2fc91 ]

Unless the software synchronization objects (CONFIG_SW_SYNC) is enabled, the sync test will be skipped:

TAP version 13
1..0 # Skipped: Sync framework not supported by kernel

Add a config fragment file to be able to run "make kselftest-merge" to enable relevant configuration required in order to run the sync test.

---
 tools/testing/selftests/sync/config |    4 ++++
 1 file changed, 4 insertions(+)
 create mode 100644 tools/testing/selftests/sync/config
tools/testing/selftests/sync/config new file +4 -0
@@ -0,0 +1,4 @@
+CONFIG_STAGING=y
+CONFIG_ANDROID=y
+CONFIG_SYNC=y
+CONFIG_SW_SYNC=y
author maintainer
#13 lore raw

PATCH 13/324 ARC: Explicitly add -mmedium-calls to CFLAGS

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Alexey Brodkin <[email protected]>

[ Upstream commit 74c11e300c103af47db5b658fdcf28002421e250 ]

GCC built for arc*-*-linux has "-mmedium-calls" implicitly enabled by default thus we don't see any problems during Linux kernel compilation. ----------------------------->8------------------------ arc-linux-gcc -mcpu=arc700 -Q --help=target | grep calls
-mlong-calls [disabled]
-mmedium-calls [enabled]
----------------------------->8------------------------

But if we try to use so-called Elf32 toolchain with GCC configured for arc*-*-elf* then we'd see the following failure:
----------------------------->8------------------------ init/do_mounts.o: In function 'init_rootfs':
do_mounts.c:(.init.text+0x108): relocation truncated to fit: R_ARC_S21W_PCREL against symbol 'unregister_filesystem' defined in .text section in fs/filesystems.o

arc-elf32-ld: final link failed: Symbol needs debug section which does not exist
make: *** [vmlinux] Error 1 ----------------------------->8------------------------

That happens because neither "-mmedium-calls" nor "-mlong-calls" are enabled in Elf32 GCC:
----------------------------->8------------------------ arc-elf32-gcc -mcpu=arc700 -Q --help=target | grep calls
-mlong-calls [disabled]
-mmedium-calls [disabled]
----------------------------->8------------------------

Now to make it possible to use Elf32 toolchain for building Linux kernel we're explicitly add "-mmedium-calls" to CFLAGS.

And since we add "-mmedium-calls" to the global CFLAGS there's no point in having per-file copies thus removing them.

---
 arch/arc/Makefile |   15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)
arch/arc/Makefile +1 -14
@@ -16,7 +16,7 @@ endif
 
 KBUILD_DEFCONFIG := nsim_700_defconfig
 
-cflags-y	+= -fno-common -pipe -fno-builtin -D__linux__
+cflags-y	+= -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
 cflags-$(CONFIG_ISA_ARCOMPACT)	+= -mA7
 cflags-$(CONFIG_ISA_ARCV2)	+= -mcpu=archs
 
@@ -140,16 +140,3 @@ dtbs: scripts
 
 archclean:
 	$(Q)$(MAKE) $(clean)=$(boot)
-
-# Hacks to enable final link due to absence of link-time branch relexation
-# and gcc choosing optimal(shorter) branches at -O3
-#
-# vineetg Feb 2010: -mlong-calls switched off for overall kernel build
-# However lib/decompress_inflate.o (.init.text) calls
-# zlib_inflate_workspacesize (.text) causing relocation errors.
-# Thus forcing all exten calls in this file to be long calls
-export CFLAGS_decompress_inflate.o = -mmedium-calls
-export CFLAGS_initramfs.o = -mmedium-calls
-ifdef CONFIG_SMP
-export CFLAGS_core.o = -mmedium-calls
-endif
author maintainer
#14 lore raw

PATCH 14/324 selftests/bpf: test offloads even with BPF programs present

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Jakub Kicinski <[email protected]>

[ Upstream commit 47cf52a246e526e2092d60ac01c54af9bd45dcc9 ]

Modern distroes increasingly make use of BPF programs. Default Ubuntu 18.04 installation boots with a number of cgroup_skb programs loaded.

test_offloads.py tries to check if programs and maps are not leaked on error paths by confirming the list of programs on the system is empty between tests.

Since we can no longer expect the system to have no BPF objects at boot try to remember the programs and maps present at the start, and skip those when scanning the system.

---
 tools/testing/selftests/bpf/test_offload.py |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/test_offload.py +10 -2
@@ -163,6 +163,10 @@ def bpftool(args, JSON=True, ns="", fail
 
 def bpftool_prog_list(expected=None, ns=""):
     _, progs = bpftool("prog show", JSON=True, ns=ns, fail=True)
+    # Remove the base progs
+    for p in base_progs:
+        if p in progs:
+            progs.remove(p)
     if expected is not None:
         if len(progs) != expected:
             fail(True, "%d BPF programs loaded, expected %d" %
@@ -171,6 +175,10 @@ def bpftool_prog_list(expected=None, ns=
 
 def bpftool_map_list(expected=None, ns=""):
     _, maps = bpftool("map show", JSON=True, ns=ns, fail=True)
+    # Remove the base maps
+    for m in base_maps:
+        if m in maps:
+            maps.remove(m)
     if expected is not None:
         if len(maps) != expected:
             fail(True, "%d BPF maps loaded, expected %d" %
@@ -585,8 +593,8 @@ skip(os.getuid() != 0, "test must be run
 # Check tools
 ret, progs = bpftool("prog", fail=False)
 skip(ret != 0, "bpftool not installed")
-# Check no BPF programs are loaded
-skip(len(progs) != 0, "BPF programs already loaded on the system")
+base_progs = progs
+_, base_maps = bpftool("map")
 
 # Check netdevsim
 ret, out = cmd("modprobe netdevsim", fail=False)
author maintainer
#15 lore raw

PATCH 15/324 smb3: increase initial number of credits requested to allow write

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Steve French <[email protected]>

[ Upstream commit d409014e4feeab486fb36b350abfc4c94de8be37 ]

Compared to other clients the Linux smb3 client ramps up credits very slowly, taking more than 128 operations before a maximum size write could be sent (since the number of credits requested is only 2 per small operation, causing the credit limit to grow very slowly).

This lack of credits initially would impact large i/o performance, when large i/o is tried early before enough credits are built up.

---
 fs/cifs/smb2pdu.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/cifs/smb2pdu.c +3 -2
@@ -923,8 +923,9 @@ SMB2_sess_alloc_buffer(struct SMB2_sess_
 	req->PreviousSessionId = sess_data->previous_session;
 
 	req->Flags = 0; /* MBZ */
-	/* to enable echos and oplocks */
-	req->sync_hdr.CreditRequest = cpu_to_le16(3);
+
+	/* enough to enable echos and oplocks and one max size write */
+	req->sync_hdr.CreditRequest = cpu_to_le16(130);
 
 	/* only one of SMB2 signing flags may be set in SMB2 request */
 	if (server->sign)
author maintainer
#18 lore raw

PATCH 17/324 hwmon: (nct6775) Fix loop limit

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Guenter Roeck <[email protected]>

[ Upstream commit 91bb8f45f73f19a0150c233c0f11cdeb6d71d1e9 ]

Commit cc66b3038254 ("hwmon: (nct6775) Rework temperature source and label handling") changed a loop limit from "data->temp_label_num - 1" to "32", as part of moving from a string array to a bit mask. This results in the following error, reported by UBSAN.

UBSAN: Undefined behaviour in drivers/hwmon/nct6775.c:4179:27

shift exponent 32 is too large for 32-bit type 'long unsigned int'

Similar to the original loop, the limit has to be one less than the number of bits.

Fixes cc66b3038254 ("hwmon: (nct6775) Rework temperature source and label handling")
Cc Paul Menzel <[email protected]>
---
 drivers/hwmon/nct6775.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/nct6775.c +1 -1
@@ -4175,7 +4175,7 @@ static int nct6775_probe(struct platform
 	 * The temperature is already monitored if the respective bit in <mask>
 	 * is set.
 	 */
-	for (i = 0; i < 32; i++) {
+	for (i = 0; i < 31; i++) {
 		if (!(data->temp_mask & BIT(i + 1)))
 			continue;
 		if (!reg_temp_alternate[i])
author maintainer
#39 lore raw

PATCH 38/324 ARM: dts: Cygnus: Fix PCIe controller interrupt type

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Ray Jui <[email protected]>

[ Upstream commit 6cb1628ad3506b315cdddd7676db0ff2af378d28 ]

Fix PCIe controller interrupt to use IRQ_TYPE_LEVEL_HIGH for Broadcom Cygnus SoC

Fixes cd590b50a936 ("ARM: dts: enable PCIe support for Cygnus")
Fixes f6b889358a82 ("ARM: dts: Enable MSI support for Broadcom Cygnus")
---
 arch/arm/boot/dts/bcm-cygnus.dtsi |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
arch/arm/boot/dts/bcm-cygnus.dtsi +10 -10
@@ -256,7 +256,7 @@
 
 			#interrupt-cells = <1>;
 			interrupt-map-mask = <0 0 0 0>;
-			interrupt-map = <0 0 0 0 &gic GIC_SPI 100 IRQ_TYPE_NONE>;
+			interrupt-map = <0 0 0 0 &gic GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>;
 
 			linux,pci-domain = <0>;
 
@@ -278,10 +278,10 @@
 				compatible = "brcm,iproc-msi";
 				msi-controller;
 				interrupt-parent = <&gic>;
-				interrupts = <GIC_SPI 96 IRQ_TYPE_NONE>,
-					     <GIC_SPI 97 IRQ_TYPE_NONE>,
-					     <GIC_SPI 98 IRQ_TYPE_NONE>,
-					     <GIC_SPI 99 IRQ_TYPE_NONE>;
+				interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>,
+					     <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>,
+					     <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>,
+					     <GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>;
 			};
 		};
 
@@ -291,7 +291,7 @@
 
 			#interrupt-cells = <1>;
 			interrupt-map-mask = <0 0 0 0>;
-			interrupt-map = <0 0 0 0 &gic GIC_SPI 106 IRQ_TYPE_NONE>;
+			interrupt-map = <0 0 0 0 &gic GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>;
 
 			linux,pci-domain = <1>;
 
@@ -313,10 +313,10 @@
 				compatible = "brcm,iproc-msi";
 				msi-controller;
 				interrupt-parent = <&gic>;
-				interrupts = <GIC_SPI 102 IRQ_TYPE_NONE>,
-					     <GIC_SPI 103 IRQ_TYPE_NONE>,
-					     <GIC_SPI 104 IRQ_TYPE_NONE>,
-					     <GIC_SPI 105 IRQ_TYPE_NONE>;
+				interrupts = <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>,
+					     <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>,
+					     <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>,
+					     <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>;
 			};
 		};
 
author maintainer
#47 lore raw

PATCH 47/324 drm/arm/malidp: Preserve LAYER_FORMAT contents when setting format

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Ayan Kumar Halder <[email protected]>

[ Upstream commit ad7fda2e378f4356df621a39655f7c200b495d81 ]

On some Mali-DP processors, the LAYER_FORMAT register contains fields other than the format. These bits were unconditionally cleared when setting the pixel format, whereas they should be preserved at their reset values.

---
 drivers/gpu/drm/arm/malidp_planes.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/arm/malidp_planes.c +4 -1
@@ -23,6 +23,7 @@
 
 /* Layer specific register offsets */
 #define MALIDP_LAYER_FORMAT		0x000
+#define   LAYER_FORMAT_MASK		0x3f
 #define MALIDP_LAYER_CONTROL		0x004
 #define   LAYER_ENABLE			(1 << 0)
 #define   LAYER_FLOWCFG_MASK		7
@@ -337,7 +338,9 @@ static void malidp_de_plane_update(struc
 	dest_w = plane->state->crtc_w;
 	dest_h = plane->state->crtc_h;
 
-	malidp_hw_write(mp->hwdev, ms->format, mp->layer->base);
+	val = malidp_hw_read(mp->hwdev, mp->layer->base);
+	val = (val & ~LAYER_FORMAT_MASK) | ms->format;
+	malidp_hw_write(mp->hwdev, val, mp->layer->base);
 
 	for (i = 0; i < ms->n_planes; i++) {
 		/* calculate the offset for the layer's plane registers */
author maintainer
#49 lore raw

PATCH 49/324 IB/rxe: Fix missing completion for mem_reg work requests

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Vijay Immanuel <[email protected]>

[ Upstream commit 375dc53d032fc11e98036b5f228ad13f7c5933f5 ]

Run the completer task to post a work completion after processing a memory registration or invalidate work request. This covers the case where the memory registration or invalidate was the last work request posted to the qp.

---
 drivers/infiniband/sw/rxe/rxe_req.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/infiniband/sw/rxe/rxe_req.c +3 -0
@@ -645,6 +645,9 @@ next_wqe:
 		} else {
 			goto exit;
 		}
+		if ((wqe->wr.send_flags & IB_SEND_SIGNALED) ||
+		    qp->sq_sig_type == IB_SIGNAL_ALL_WR)
+			rxe_run_task(&qp->comp.task, 1);
 		qp->req.wqe_index = next_index(qp->sq.queue,
 						qp->req.wqe_index);
 		goto next_wqe;
author maintainer
#50 lore raw

PATCH 50/324 libahci: Fix possible Spectre-v1 pmp indexing in ahci_led_store()

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: John Garry <[email protected]>

[ Upstream commit fae2a63737e5973f1426bc139935a0f42e232844 ]

Currently smatch warns of possible Spectre-V1 issue in ahci_led_store():
drivers/ata/libahci.c:1150 ahci_led_store() warn: potential spectre issue 'pp->em_priv' (local cap)

Userspace controls @pmp from following callchain:
em_message->store()
->ata_scsi_em_message_store()
-->ap->ops->em_store()
--->ahci_led_store()

After the mask+shift @pmp is effectively an 8b value, which is used to index into an array of length 8, so sanitize the array index.

---
 drivers/ata/libahci.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/ata/libahci.c +5 -2
@@ -35,6 +35,7 @@
 #include <linux/kernel.h>
 #include <linux/gfp.h>
 #include <linux/module.h>
+#include <linux/nospec.h>
 #include <linux/blkdev.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
@@ -1146,10 +1147,12 @@ static ssize_t ahci_led_store(struct ata
 
 	/* get the slot number from the message */
 	pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8;
-	if (pmp < EM_MAX_SLOTS)
+	if (pmp < EM_MAX_SLOTS) {
+		pmp = array_index_nospec(pmp, EM_MAX_SLOTS);
 		emp = &pp->em_priv[pmp];
-	else
+	} else {
 		return -EINVAL;
+	}
 
 	/* mask off the activity bits if we are in sw_activity
 	 * mode, user should turn off sw_activity before setting
author maintainer
#51 lore raw

PATCH 51/324 dmaengine: ti: omap-dma: Fix OMAP1510 incorrect residue_granularity

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Janusz Krzysztofik <[email protected]>

[ Upstream commit c9bd0946da243a8eb86b44ff613e2c813f9b683b ]

Commit 0198d7bb8a0c ("ASoC: omap-mcbsp: Convert to use the sdma-pcm instead of omap-pcm") resulted in broken audio playback on OMAP1510 (discovered on Amstrad Delta).

When running on OMAP1510, omap-pcm used to obtain DMA offset from snd_dmaengine_pcm_pointer_no_residue() based on DMA interrupt triggered software calculations instead of snd_dmaengine_pcm_pointer() which depended on residue value calculated from omap_dma_get_src_pos(). Similar code path is still available in now used sound/soc/soc-generic-dmaengine-pcm.c but it is not triggered.

It was verified already before that omap_get_dma_src_pos() from arch/arm/plat-omap/dma.c didn't work correctly for OMAP1510 - see commit 1bdd7419910c ("ASoC: OMAP: fix OMAP1510 broken PCM pointer callback") for details. Apparently the same applies to its successor, omap_dma_get_src_pos() from drivers/dma/ti/omap-dma.c.

On the other hand, snd_dmaengine_pcm_pointer_no_residue() is described as depreciated and discouraged for use in new drivers because of its unreliable accuracy. However, it seems the only working option for OPAM1510 now, as long as a software calculated residue is not implemented as OMAP1510 fallback in omap-dma.

Using snd_dmaengine_pcm_pointer_no_residue() code path instead of snd_dmaengine_pcm_pointer() in sound/soc/soc-generic-dmaengine-pcm.c can be triggered in two ways:
- by passing pcm->flags |= SND_DMAENGINE_PCM_FLAG_NO_RESIDUE from sound/soc/omap/sdma-pcm.c,
- by passing dma_caps.residue_granularity = DMA_RESIDUE_GRANULARITY_DESCRIPTOR from DMA engine.

Let's do the latter.

---
 drivers/dma/omap-dma.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/dma/omap-dma.c +5 -1
@@ -1485,7 +1485,11 @@ static int omap_dma_probe(struct platfor
 	od->ddev.src_addr_widths = OMAP_DMA_BUSWIDTHS;
 	od->ddev.dst_addr_widths = OMAP_DMA_BUSWIDTHS;
 	od->ddev.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV);
-	od->ddev.residue_granularity = DMA_RESIDUE_GRANULARITY_BURST;
+	if (__dma_omap15xx(od->plat->dma_attr))
+		od->ddev.residue_granularity =
+				DMA_RESIDUE_GRANULARITY_DESCRIPTOR;
+	else
+		od->ddev.residue_granularity = DMA_RESIDUE_GRANULARITY_BURST;
 	od->ddev.max_burst = SZ_16M - 1; /* CCEN: 24bit unsigned */
 	od->ddev.dev = &pdev->dev;
 	INIT_LIST_HEAD(&od->ddev.channels);
author maintainer
#53 lore raw

PATCH 53/324 usb: dwc2: alloc dma aligned buffer for isoc split in

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: William Wu <[email protected]>

[ Upstream commit af424a410749ed7e0c2bffd3cedbc7c274d0ff6f ]

The commit 3bc04e28a030 ("usb: dwc2: host: Get aligned DMA in a more supported way") rips out a lot of code to simply the allocation of aligned DMA. However, it also introduces a new issue when use isoc split in transfer.

In my test case, I connect the dwc2 controller with an usb hs Hub (GL852G-12), and plug an usb fs audio device (Plantronics headset) into the downstream port of Hub. Then use the usb mic to record, we can find noise when playback.

It's because that the usb Hub uses an MDATA for the first transaction and a DATA0 for the second transaction for the isoc split in transaction. An typical isoc split in transaction sequence like this:

- SSPLIT IN transaction
- CSPLIT IN transaction
- MDATA packet
- CSPLIT IN transaction
- DATA0 packet

The DMA address of MDATA (urb->dma) is always DWORD-aligned, but the DMA address of DATA0 (urb->dma + qtd->isoc_split_offset) may not be DWORD-aligned, it depends on the qtd->isoc_split_offset (the length of MDATA). In my test case, the length of MDATA is usually unaligned, this cause DATA0 packet transmission error.

This patch use kmem_cache to allocate aligned DMA buf for isoc split in transaction. Note that according to usb 2.0 spec, the maximum data payload size is 1023 bytes for each fs isoc ep, and the maximum allowable interrupt data payload size is 64 bytes or less for fs interrupt ep. So we set the size of object to be 1024 bytes in the kmem cache.

---
 drivers/usb/dwc2/core.h      |    3 +
 drivers/usb/dwc2/hcd.c       |   89 ++++++++++++++++++++++++++++++++++++++++---
 drivers/usb/dwc2/hcd.h       |    8 +++
 drivers/usb/dwc2/hcd_intr.c  |    8 +++
 drivers/usb/dwc2/hcd_queue.c |    3 +
 5 files changed, 106 insertions(+), 5 deletions(-)
drivers/usb/dwc2/core.h +3 -0
@@ -915,6 +915,7 @@ struct dwc2_hregs_backup {
  * @frame_list_sz:      Frame list size
  * @desc_gen_cache:     Kmem cache for generic descriptors
  * @desc_hsisoc_cache:  Kmem cache for hs isochronous descriptors
+ * @unaligned_cache:    Kmem cache for DMA mode to handle non-aligned buf
  *
  * These are for peripheral mode:
  *
@@ -1061,6 +1062,8 @@ struct dwc2_hsotg {
 	u32 frame_list_sz;
 	struct kmem_cache *desc_gen_cache;
 	struct kmem_cache *desc_hsisoc_cache;
+	struct kmem_cache *unaligned_cache;
+#define DWC2_KMEM_UNALIGNED_BUF_SIZE 1024
 
 #endif /* CONFIG_USB_DWC2_HOST || CONFIG_USB_DWC2_DUAL_ROLE */
 
drivers/usb/dwc2/hcd.c +84 -5

129 lines not on this page · raw message

drivers/usb/dwc2/hcd.h +8 -0
@@ -76,6 +76,8 @@ struct dwc2_qh;
  *                      (micro)frame
  * @xfer_buf:           Pointer to current transfer buffer position
  * @xfer_dma:           DMA address of xfer_buf
+ * @align_buf:          In Buffer DMA mode this will be used if xfer_buf is not
+ *                      DWORD aligned
  * @xfer_len:           Total number of bytes to transfer
  * @xfer_count:         Number of bytes transferred so far
  * @start_pkt_count:    Packet count at start of transfer
@@ -133,6 +135,7 @@ struct dwc2_host_chan {
 
 	u8 *xfer_buf;
 	dma_addr_t xfer_dma;
+	dma_addr_t align_buf;
 	u32 xfer_len;
 	u32 xfer_count;
 	u16 start_pkt_count;
@@ -303,6 +306,9 @@ struct dwc2_hs_transfer_time {
  *                           is tightly packed.
  * @ls_duration_us:     Duration on the low speed bus schedule.
  * @ntd:                Actual number of transfer descriptors in a list
+ * @dw_align_buf:       Used instead of original buffer if its physical address
+ *                      is not dword-aligned
+ * @dw_align_buf_dma:   DMA address for dw_align_buf
  * @qtd_list:           List of QTDs for this QH
  * @channel:            Host channel currently processing transfers for this QH
  * @qh_list_entry:      Entry for QH in either the periodic or non-periodic
@@ -350,6 +356,8 @@ struct dwc2_qh {
 	struct dwc2_hs_transfer_time hs_transfers[DWC2_HS_SCHEDULE_UFRAMES];
 	u32 ls_start_schedule_slice;
 	u16 ntd;
+	u8 *dw_align_buf;
+	dma_addr_t dw_align_buf_dma;
 	struct list_head qtd_list;
 	struct dwc2_host_chan *channel;
 	struct list_head qh_list_entry;
drivers/usb/dwc2/hcd_intr.c +8 -0
@@ -938,6 +938,14 @@ static int dwc2_xfercomp_isoc_split_in(s
 
 	frame_desc->actual_length += len;
 
+	if (chan->align_buf) {
+		dev_vdbg(hsotg->dev, "non-aligned buffer\n");
+		dma_unmap_single(hsotg->dev, chan->qh->dw_align_buf_dma,
+				 DWC2_KMEM_UNALIGNED_BUF_SIZE, DMA_FROM_DEVICE);
+		memcpy(qtd->urb->buf + (chan->xfer_dma - qtd->urb->dma),
+		       chan->qh->dw_align_buf, len);
+	}
+
 	qtd->isoc_split_offset += len;
 
 	hctsiz = dwc2_readl(hsotg->regs + HCTSIZ(chnum));
drivers/usb/dwc2/hcd_queue.c +3 -0
@@ -1695,6 +1695,9 @@ void dwc2_hcd_qh_free(struct dwc2_hsotg
 
 	if (qh->desc_list)
 		dwc2_hcd_qh_free_ddma(hsotg, qh);
+	else if (hsotg->unaligned_cache && qh->dw_align_buf)
+		kmem_cache_free(hsotg->unaligned_cache, qh->dw_align_buf);
+
 	kfree(qh);
 }
 
author maintainer
#54 lore raw

PATCH 54/324 usb: dwc2: fix isoc split in transfer with no data

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: William Wu <[email protected]>

[ Upstream commit 70c3c8cb83856758025c2a211dd022bc0478922a ]

If isoc split in transfer with no data (the length of DATA0 packet is zero), we can't simply return immediately. Because the DATA0 can be the first transaction or the second transaction for the isoc split in transaction. If the DATA0 packet with no data is in the first transaction, we can return immediately. But if the DATA0 packet with no data is in the second transaction of isoc split in transaction sequence, we need to increase the qtd->isoc_frame_index and giveback urb to device driver if needed, otherwise, the MDATA packet will be lost.

A typical test case is that connect the dwc2 controller with an usb hs Hub (GL852G-12), and plug an usb fs audio device (Plantronics headset) into the downstream port of Hub. Then use the usb mic to record, we can find noise when playback.

In the case, the isoc split in transaction sequence like this:

- SSPLIT IN transaction
- CSPLIT IN transaction
- MDATA packet (176 bytes)
- CSPLIT IN transaction
- DATA0 packet (0 byte)

This patch use both the length of DATA0 and qtd->isoc_split_offset to check if the DATA0 is in the second transaction.

---
 drivers/usb/dwc2/hcd_intr.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/dwc2/hcd_intr.c +1 -2
@@ -930,9 +930,8 @@ static int dwc2_xfercomp_isoc_split_in(s
 	frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index];
 	len = dwc2_get_actual_xfer_length(hsotg, chan, chnum, qtd,
 					  DWC2_HC_XFER_COMPLETE, NULL);
-	if (!len) {
+	if (!len && !qtd->isoc_split_offset) {
 		qtd->complete_split = 0;
-		qtd->isoc_split_offset = 0;
 		return 0;
 	}
 
author maintainer
#40 lore raw

PATCH 39/324 arm64: dts: specify 1.8V EMMC capabilities for bcm958742k

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Scott Branden <[email protected]>

[ Upstream commit eba92503e980c08ac353d0d669d0bb143979abcd ]

Specify 1.8V EMMC capabilities for bcm958742k board to indicate support for UHS mode.

Fixes d4b4aba6be8a ("arm64: dts: Initial DTS files for Broadcom Stingray SOC")
---
 arch/arm64/boot/dts/broadcom/stingray/bcm958742k.dts |    4 ++++
 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/broadcom/stingray/bcm958742k.dts +4 -0
@@ -43,6 +43,10 @@
 	enet-phy-lane-swap;
 };
 
+&sdio0 {
+	mmc-ddr-1_8v;
+};
+
 &uart2 {
 	status = "okay";
 };
author maintainer
#58 lore raw

PATCH 58/324 powerpc: smp_send_stop do not offline stopped CPUs

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Nicholas Piggin <[email protected]>

[ Upstream commit de6e5d38417e6cdb005843db420a2974993d36ff ]

Marking CPUs stopped by smp_send_stop as offline can cause warnings due to cross-CPU wakeups. This trace was noticed on a busy system running a sysrq+c crash test, after the injected crash:

WARNING: CPU: 51 PID: 1546 at kernel/sched/core.c:1179 set_task_cpu+0x22c/0x240
CPU: 51 PID: 1546 Comm: kworker/u352:1 Tainted: G      D
Workqueue: mlx5e mlx5e_update_stats_work [mlx5_core]
[...]
NIP [c00000000017c21c] set_task_cpu+0x22c/0x240
LR [c00000000017d580] try_to_wake_up+0x230/0x720
Call Trace:
[c000000001017700] runqueues+0x0/0xb00 (unreliable)
[c00000000017d580] try_to_wake_up+0x230/0x720
[c00000000015a214] insert_work+0x104/0x140
[c00000000015adb0] __queue_work+0x230/0x690
[c000003fc5007910] [c00000000015b26c] queue_work_on+0x5c/0x90
[c0080000135fc8f8] mlx5_cmd_exec+0x538/0xcb0 [mlx5_core]
[c008000013608fd0] mlx5_core_access_reg+0x140/0x1d0 [mlx5_core]
[c00800001362777c] mlx5e_update_pport_counters.constprop.59+0x6c/0x90 [mlx5_core]
[c008000013628868] mlx5e_update_ndo_stats+0x28/0x90 [mlx5_core]
[c008000013625558] mlx5e_update_stats_work+0x68/0xb0 [mlx5_core]
[c00000000015bcec] process_one_work+0x1bc/0x5f0
[c00000000015ecac] worker_thread+0xac/0x6b0
[c000000000168338] kthread+0x168/0x1b0
[c00000000000b628] ret_from_kernel_thread+0x5c/0xb4

This happens because firstly the CPU is not really offline in the usual sense, processes and interrupts have not been migrated away. Secondly smp_send_stop does not happen atomically on all CPUs, so one CPU can have marked itself offline, while another CPU is still running processes or interrupts which can affect the first CPU.

Fix this by just not marking the CPU as offline. It's more like frozen in time, so offline does not really reflect its state properly anyway. There should be nothing in the crash/panic path that walks online CPUs and synchronously waits for them, so this change should not introduce new hangs.

---
 arch/powerpc/kernel/smp.c |    6 ------
 1 file changed, 6 deletions(-)
arch/powerpc/kernel/smp.c +0 -6
@@ -579,9 +579,6 @@ static void nmi_stop_this_cpu(struct pt_
 	nmi_ipi_busy_count--;
 	nmi_ipi_unlock();
 
-	/* Remove this CPU */
-	set_cpu_online(smp_processor_id(), false);
-
 	spin_begin();
 	while (1)
 		spin_cpu_relax();
@@ -596,9 +593,6 @@ void smp_send_stop(void)
 
 static void stop_this_cpu(void *dummy)
 {
-	/* Remove this CPU */
-	set_cpu_online(smp_processor_id(), false);
-
 	hard_irq_disable();
 	spin_begin();
 	while (1)
author maintainer
#59 lore raw

PATCH 59/324 xen: add error handling for xenbus_printf

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Zhouyang Jia <[email protected]>

[ Upstream commit 84c029a73327cef571eaa61c7d6e67e8031b52ec ]

When xenbus_printf fails, the lack of error-handling code may cause unexpected results.

This patch adds error-handling code after calling xenbus_printf.

---
 drivers/xen/manage.c |   18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/xen/manage.c +15 -3
@@ -289,8 +289,15 @@ static void sysrq_handler(struct xenbus_
 		return;
 	}
 
-	if (sysrq_key != '\0')
-		xenbus_printf(xbt, "control", "sysrq", "%c", '\0');
+	if (sysrq_key != '\0') {
+		err = xenbus_printf(xbt, "control", "sysrq", "%c", '\0');
+		if (err) {
+			pr_err("%s: Error %d writing sysrq in control/sysrq\n",
+			       __func__, err);
+			xenbus_transaction_end(xbt, 1);
+			return;
+		}
+	}
 
 	err = xenbus_transaction_end(xbt, 0);
 	if (err == -EAGAIN)
@@ -342,7 +349,12 @@ static int setup_shutdown_watcher(void)
 			continue;
 		snprintf(node, FEATURE_PATH_SIZE, "feature-%s",
 			 shutdown_handlers[idx].command);
-		xenbus_printf(XBT_NIL, "control", node, "%u", 1);
+		err = xenbus_printf(XBT_NIL, "control", node, "%u", 1);
+		if (err) {
+			pr_err("%s: Error %d writing %s\n", __func__,
+				err, node);
+			return err;
+		}
 	}
 
 	return 0;
author maintainer
#61 lore raw

PATCH 61/324 scsi: xen-scsifront: add error handling for xenbus_printf

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Zhouyang Jia <[email protected]>

[ Upstream commit 93efbd39870474cc536b9caf4a6efeb03b0bc56f ]

When xenbus_printf fails, the lack of error-handling code may cause unexpected results.

This patch adds error-handling code after calling xenbus_printf.

---
 drivers/scsi/xen-scsifront.c |   33 ++++++++++++++++++++++++++-------
 1 file changed, 26 insertions(+), 7 deletions(-)
drivers/scsi/xen-scsifront.c +26 -7
@@ -654,10 +654,17 @@ static int scsifront_dev_reset_handler(s
 static int scsifront_sdev_configure(struct scsi_device *sdev)
 {
 	struct vscsifrnt_info *info = shost_priv(sdev->host);
+	int err;
 
-	if (info && current == info->curr)
-		xenbus_printf(XBT_NIL, info->dev->nodename,
+	if (info && current == info->curr) {
+		err = xenbus_printf(XBT_NIL, info->dev->nodename,
 			      info->dev_state_path, "%d", XenbusStateConnected);
+		if (err) {
+			xenbus_dev_error(info->dev, err,
+				"%s: writing dev_state_path", __func__);
+			return err;
+		}
+	}
 
 	return 0;
 }
@@ -665,10 +672,15 @@ static int scsifront_sdev_configure(stru
 static void scsifront_sdev_destroy(struct scsi_device *sdev)
 {
 	struct vscsifrnt_info *info = shost_priv(sdev->host);
+	int err;
 
-	if (info && current == info->curr)
-		xenbus_printf(XBT_NIL, info->dev->nodename,
+	if (info && current == info->curr) {
+		err = xenbus_printf(XBT_NIL, info->dev->nodename,
 			      info->dev_state_path, "%d", XenbusStateClosed);
+		if (err)
+			xenbus_dev_error(info->dev, err,
+				"%s: writing dev_state_path", __func__);
+	}
 }
 
 static struct scsi_host_template scsifront_sht = {
@@ -1003,9 +1015,12 @@ static void scsifront_do_lun_hotplug(str
 
 			if (scsi_add_device(info->host, chn, tgt, lun)) {
 				dev_err(&dev->dev, "scsi_add_device\n");
-				xenbus_printf(XBT_NIL, dev->nodename,
+				err = xenbus_printf(XBT_NIL, dev->nodename,
 					      info->dev_state_path,
 					      "%d", XenbusStateClosed);
+				if (err)
+					xenbus_dev_error(dev, err,
+						"%s: writing dev_state_path", __func__);
 			}
 			break;
 		case VSCSIFRONT_OP_DEL_LUN:
@@ -1019,10 +1034,14 @@ static void scsifront_do_lun_hotplug(str
 			}
 			break;
 		case VSCSIFRONT_OP_READD_LUN:
-			if (device_state == XenbusStateConnected)
-				xenbus_printf(XBT_NIL, dev->nodename,
+			if (device_state == XenbusStateConnected) {
+				err = xenbus_printf(XBT_NIL, dev->nodename,
 					      info->dev_state_path,
 					      "%d", XenbusStateConnected);
+				if (err)
+					xenbus_dev_error(dev, err,
+						"%s: writing dev_state_path", __func__);
+			}
 			break;
 		default:
 			break;
author maintainer
#62 lore raw

PATCH 62/324 xen/scsiback: add error handling for xenbus_printf

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Zhouyang Jia <[email protected]>

[ Upstream commit 7c63ca24c878e0051c91904b72174029320ef4bd ]

When xenbus_printf fails, the lack of error-handling code may cause unexpected results.

This patch adds error-handling code after calling xenbus_printf.

---
 drivers/xen/xen-scsiback.c |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/xen/xen-scsiback.c +13 -3
@@ -1012,6 +1012,7 @@ static void scsiback_do_add_lun(struct v
 {
 	struct v2p_entry *entry;
 	unsigned long flags;
+	int err;
 
 	if (try) {
 		spin_lock_irqsave(&info->v2p_lock, flags);
@@ -1027,8 +1028,11 @@ static void scsiback_do_add_lun(struct v
 			scsiback_del_translation_entry(info, vir);
 		}
 	} else if (!try) {
-		xenbus_printf(XBT_NIL, info->dev->nodename, state,
+		err = xenbus_printf(XBT_NIL, info->dev->nodename, state,
 			      "%d", XenbusStateClosed);
+		if (err)
+			xenbus_dev_error(info->dev, err,
+				"%s: writing %s", __func__, state);
 	}
 }
 
@@ -1067,8 +1071,11 @@ static void scsiback_do_1lun_hotplug(str
 	snprintf(str, sizeof(str), "vscsi-devs/%s/p-dev", ent);
 	val = xenbus_read(XBT_NIL, dev->nodename, str, NULL);
 	if (IS_ERR(val)) {
-		xenbus_printf(XBT_NIL, dev->nodename, state,
+		err = xenbus_printf(XBT_NIL, dev->nodename, state,
 			      "%d", XenbusStateClosed);
+		if (err)
+			xenbus_dev_error(info->dev, err,
+				"%s: writing %s", __func__, state);
 		return;
 	}
 	strlcpy(phy, val, VSCSI_NAMELEN);
@@ -1079,8 +1086,11 @@ static void scsiback_do_1lun_hotplug(str
 	err = xenbus_scanf(XBT_NIL, dev->nodename, str, "%u:%u:%u:%u",
 			   &vir.hst, &vir.chn, &vir.tgt, &vir.lun);
 	if (XENBUS_EXIST_ERR(err)) {
-		xenbus_printf(XBT_NIL, dev->nodename, state,
+		err = xenbus_printf(XBT_NIL, dev->nodename, state,
 			      "%d", XenbusStateClosed);
+		if (err)
+			xenbus_dev_error(info->dev, err,
+				"%s: writing %s", __func__, state);
 		return;
 	}
 
author maintainer
#63 lore raw

PATCH 63/324 arm64: dma-mapping: clear buffers allocated with FORCE_CONTIGUOUS flag

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Marek Szyprowski <[email protected]>

[ Upstream commit dd65a941f6ba473a5cb9d013d57fa43b48450a04 ]

dma_alloc_*() buffers might be exposed to userspace via mmap() call, so they should be cleared on allocation. In case of IOMMU-based dma-mapping implementation such buffer clearing was missing in the code path for DMA_ATTR_FORCE_CONTIGUOUS flag handling, because dma_alloc_from_contiguous() doesn't honor __GFP_ZERO flag. This patch fixes this issue. For more information on clearing buffers allocated by dma_alloc_* functions, see commit 6829e274a623 ("arm64: dma-mapping: always clear allocated buffers").

Fixes 44176bb38fa4 ("arm64: Add support for DMA_ATTR_FORCE_CONTIGUOUS to IOMMU")
---
 arch/arm64/mm/dma-mapping.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
arch/arm64/mm/dma-mapping.c +5 -4
@@ -588,13 +588,14 @@ static void *__iommu_alloc_attrs(struct
 						    size >> PAGE_SHIFT);
 			return NULL;
 		}
-		if (!coherent)
-			__dma_flush_area(page_to_virt(page), iosize);
-
 		addr = dma_common_contiguous_remap(page, size, VM_USERMAP,
 						   prot,
 						   __builtin_return_address(0));
-		if (!addr) {
+		if (addr) {
+			memset(addr, 0, size);
+			if (!coherent)
+				__dma_flush_area(page_to_virt(page), iosize);
+		} else {
 			iommu_dma_unmap_page(dev, *handle, iosize, 0, attrs);
 			dma_release_from_contiguous(dev, page,
 						    size >> PAGE_SHIFT);
author maintainer
#41 lore raw

PATCH 40/324 arm64: dts: specify 1.8V EMMC capabilities for bcm958742t

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Scott Branden <[email protected]>

[ Upstream commit 37c2bd81a86ebb1cc934bf52a29c33d6f9abff7f ]

Specify 1.8V EMMC capabilities for bcm958742t board to indicate support for UHS mode.

Fixes d4b4aba6be8a ("arm64: dts: Initial DTS files for Broadcom Stingray SOC")
---
 arch/arm64/boot/dts/broadcom/stingray/bcm958742t.dts |    4 ++++
 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/broadcom/stingray/bcm958742t.dts +4 -0
@@ -42,3 +42,7 @@
 &gphy0 {
 	enet-phy-lane-swap;
 };
+
+&sdio0 {
+	mmc-ddr-1_8v;
+};
author maintainer
#44 lore raw

PATCH 43/324 arm64: dts: Stingray: Fix I2C controller interrupt type

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Ray Jui <[email protected]>

[ Upstream commit 75af23c4736c5633894ea0baf9bca1cf6b248ca4 ]

Fix I2C controller interrupt to use IRQ_TYPE_LEVEL_HIGH for Broadcom Stingray SoC.

Fixes 1256ea18875d ("arm64: dts: Add I2C DT nodes for Stingray SoC")
---
 arch/arm64/boot/dts/broadcom/stingray/stingray.dtsi |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/broadcom/stingray/stingray.dtsi +2 -2
@@ -409,7 +409,7 @@
 			reg = <0x000b0000 0x100>;
 			#address-cells = <1>;
 			#size-cells = <0>;
-			interrupts = <GIC_SPI 177 IRQ_TYPE_NONE>;
+			interrupts = <GIC_SPI 177 IRQ_TYPE_LEVEL_HIGH>;
 			clock-frequency = <100000>;
 			status = "disabled";
 		};
@@ -453,7 +453,7 @@
 			reg = <0x000e0000 0x100>;
 			#address-cells = <1>;
 			#size-cells = <0>;
-			interrupts = <GIC_SPI 178 IRQ_TYPE_NONE>;
+			interrupts = <GIC_SPI 178 IRQ_TYPE_LEVEL_HIGH>;
 			clock-frequency = <100000>;
 			status = "disabled";
 		};
author maintainer
#45 lore raw

PATCH 44/324 drivers/perf: xgene_pmu: Fix IOB SLOW PMU parser error

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Hoan Tran <[email protected]>

[ Upstream commit a45fc268db20ecd859bb61e25045912b3194b5e6 ]

This patch fixes the below parser error of the IOB SLOW PMU.

        # perf stat -a -e iob-slow0/cycle-count/ sleep 1
        evenf syntax error: 'iob-slow0/cycle-count/'
                                 \___ parser error

It replaces the "-" character by "_" character inside the PMU name.

---
 drivers/perf/xgene_pmu.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/perf/xgene_pmu.c +1 -1
@@ -1463,7 +1463,7 @@ static char *xgene_pmu_dev_name(struct d
 	case PMU_TYPE_IOB:
 		return devm_kasprintf(dev, GFP_KERNEL, "iob%d", id);
 	case PMU_TYPE_IOB_SLOW:
-		return devm_kasprintf(dev, GFP_KERNEL, "iob-slow%d", id);
+		return devm_kasprintf(dev, GFP_KERNEL, "iob_slow%d", id);
 	case PMU_TYPE_MCB:
 		return devm_kasprintf(dev, GFP_KERNEL, "mcb%d", id);
 	case PMU_TYPE_MC:
author maintainer
#46 lore raw

PATCH 45/324 drm/arm/malidp: Ensure that the crtcs are shutdown before removing any encoder/connector

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Ayan Kumar Halder <[email protected]>

[ Upstream commit 109c4d18e57445afcaf728b8716a69375a3daab2 ]

One needs to ensure that the crtcs are shutdown so that the drm_crtc_state->connector_mask reflects that no connectors are currently active. Further, it reduces the reference count for each connector. This ensures that the connectors and encoders can be cleanly removed either when _unbind
is called for the corresponding drivers or by drm_mode_config_cleanup().
We need drm_atomic_helper_shutdown() to be called before component_unbind_all() otherwise the connectors attached to the component device will have the wrong reference count value and will not be cleanly removed.

---
 drivers/gpu/drm/arm/malidp_drv.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/arm/malidp_drv.c +2 -1
@@ -278,7 +278,6 @@ static int malidp_init(struct drm_device
 
 static void malidp_fini(struct drm_device *drm)
 {
-	drm_atomic_helper_shutdown(drm);
 	drm_mode_config_cleanup(drm);
 }
 
@@ -646,6 +645,7 @@ vblank_fail:
 	malidp_de_irq_fini(drm);
 	drm->irq_enabled = false;
 irq_init_fail:
+	drm_atomic_helper_shutdown(drm);
 	component_unbind_all(dev, drm);
 bind_fail:
 	of_node_put(malidp->crtc.port);
@@ -681,6 +681,7 @@ static void malidp_unbind(struct device
 	malidp_se_irq_fini(drm);
 	malidp_de_irq_fini(drm);
 	drm->irq_enabled = false;
+	drm_atomic_helper_shutdown(drm);
 	component_unbind_all(dev, drm);
 	of_node_put(malidp->crtc.port);
 	malidp->crtc.port = NULL;
author maintainer
#38 lore raw

PATCH 37/324 ARM: dts: Cygnus: Fix I2C controller interrupt type

In reply to Greg Kroah-Hartman

4.17-stable review patch. If anyone has any objections, please let me know.

------------------

From: Ray Jui <[email protected]>

[ Upstream commit 71ca3409703b62b6a092d0d9d13f366c121bc5d3 ]

Fix I2C controller interrupt to use IRQ_TYPE_LEVEL_HIGH for Broadcom Cygnus SoC.

Fixes b51c05a331ff ("ARM: dts: add I2C device nodes for Broadcom Cygnus")
---
 arch/arm/boot/dts/bcm-cygnus.dtsi |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/bcm-cygnus.dtsi +2 -2
@@ -216,7 +216,7 @@
 			reg = <0x18008000 0x100>;
 			#address-cells = <1>;
 			#size-cells = <0>;
-			interrupts = <GIC_SPI 85 IRQ_TYPE_NONE>;
+			interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
 			clock-frequency = <100000>;
 			status = "disabled";
 		};
@@ -245,7 +245,7 @@
 			reg = <0x1800b000 0x100>;
 			#address-cells = <1>;
 			#size-cells = <0>;
-			interrupts = <GIC_SPI 86 IRQ_TYPE_NONE>;
+			interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
 			clock-frequency = <100000>;
 			status = "disabled";
 		};