linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.11 01/23] HID: google: add don USB id
@ 2021-04-19 20:43 Sasha Levin
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 02/23] HID: asus: Add support for 2021 ASUS N-Key keyboard Sasha Levin
                   ` (21 more replies)
  0 siblings, 22 replies; 25+ messages in thread
From: Sasha Levin @ 2021-04-19 20:43 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Shou-Chieh Hsu, Jiri Kosina, Sasha Levin, linux-input

From: Shou-Chieh Hsu <shouchieh@chromium.org>

[ Upstream commit 36b87cf302a4f13f8b4344bcf98f67405a145e2f ]

Add 1 additional hammer-like device.

Signed-off-by: Shou-Chieh Hsu <shouchieh@chromium.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/hid/hid-google-hammer.c | 2 ++
 drivers/hid/hid-ids.h           | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/hid/hid-google-hammer.c b/drivers/hid/hid-google-hammer.c
index 85a054f1ce38..2a176f77b32e 100644
--- a/drivers/hid/hid-google-hammer.c
+++ b/drivers/hid/hid-google-hammer.c
@@ -526,6 +526,8 @@ static void hammer_remove(struct hid_device *hdev)
 }
 
 static const struct hid_device_id hammer_devices[] = {
+	{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
+		     USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_DON) },
 	{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
 		     USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_HAMMER) },
 	{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index b60279aaed43..570bd0103a86 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -488,6 +488,7 @@
 #define USB_DEVICE_ID_GOOGLE_MASTERBALL	0x503c
 #define USB_DEVICE_ID_GOOGLE_MAGNEMITE	0x503d
 #define USB_DEVICE_ID_GOOGLE_MOONBALL	0x5044
+#define USB_DEVICE_ID_GOOGLE_DON	0x5050
 
 #define USB_VENDOR_ID_GOTOP		0x08f2
 #define USB_DEVICE_ID_SUPER_Q2		0x007f
-- 
2.30.2


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

* [PATCH AUTOSEL 5.11 02/23] HID: asus: Add support for 2021 ASUS N-Key keyboard
  2021-04-19 20:43 [PATCH AUTOSEL 5.11 01/23] HID: google: add don USB id Sasha Levin
@ 2021-04-19 20:43 ` Sasha Levin
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 03/23] HID: alps: fix error return code in alps_input_configured() Sasha Levin
                   ` (20 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Sasha Levin @ 2021-04-19 20:43 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Luke D Jones, Jiri Kosina, Sasha Levin, linux-input

From: Luke D Jones <luke@ljones.dev>

[ Upstream commit 9a0b44fbfea1932196a4879b44a37dd182e984c5 ]

Some new 2021 version of ASUS gamer laptops are using an updated
N-Key keyboard with the PID of 0x19b6. This version is using the
same init sequence and brightness control as the 0x1866 keyboard.

Signed-off-by: Luke D Jones <luke@ljones.dev>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/hid/hid-asus.c | 3 +++
 drivers/hid/hid-ids.h  | 1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index 1dfe184ebf5a..2ab22b925941 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -1221,6 +1221,9 @@ static const struct hid_device_id asus_devices[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
 	    USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD),
 	  QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
+	    USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD2),
+	  QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
 		USB_DEVICE_ID_ASUSTEK_T100TA_KEYBOARD),
 	  QUIRK_T100_KEYBOARD | QUIRK_NO_CONSUMER_USAGES },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 570bd0103a86..09d049986516 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -191,6 +191,7 @@
 #define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2 0x1837
 #define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD3 0x1822
 #define USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD	0x1866
+#define USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD2	0x19b6
 #define USB_DEVICE_ID_ASUSTEK_FX503VD_KEYBOARD	0x1869
 
 #define USB_VENDOR_ID_ATEN		0x0557
-- 
2.30.2


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

* [PATCH AUTOSEL 5.11 03/23] HID: alps: fix error return code in alps_input_configured()
  2021-04-19 20:43 [PATCH AUTOSEL 5.11 01/23] HID: google: add don USB id Sasha Levin
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 02/23] HID: asus: Add support for 2021 ASUS N-Key keyboard Sasha Levin
@ 2021-04-19 20:43 ` Sasha Levin
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 04/23] HID cp2112: fix support for multiple gpiochips Sasha Levin
                   ` (19 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Sasha Levin @ 2021-04-19 20:43 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Jia-Ju Bai, TOTE Robot, Jiri Kosina, Sasha Levin, linux-input

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

[ Upstream commit fa8ba6e5dc0e78e409e503ddcfceef5dd96527f4 ]

When input_register_device() fails, no error return code is assigned.
To fix this bug, ret is assigned with -ENOENT as error return code.

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/hid/hid-alps.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c
index 3feaece13ade..6b665931147d 100644
--- a/drivers/hid/hid-alps.c
+++ b/drivers/hid/hid-alps.c
@@ -761,6 +761,7 @@ static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi)
 
 		if (input_register_device(data->input2)) {
 			input_free_device(input2);
+			ret = -ENOENT;
 			goto exit;
 		}
 	}
-- 
2.30.2


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

* [PATCH AUTOSEL 5.11 04/23] HID cp2112: fix support for multiple gpiochips
  2021-04-19 20:43 [PATCH AUTOSEL 5.11 01/23] HID: google: add don USB id Sasha Levin
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 02/23] HID: asus: Add support for 2021 ASUS N-Key keyboard Sasha Levin
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 03/23] HID: alps: fix error return code in alps_input_configured() Sasha Levin
@ 2021-04-19 20:43 ` Sasha Levin
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 05/23] HID: wacom: Assign boolean values to a bool variable Sasha Levin
                   ` (18 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Sasha Levin @ 2021-04-19 20:43 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Douglas Gilbert, Jiri Kosina, Sasha Levin, linux-input

From: Douglas Gilbert <dgilbert@interlog.com>

[ Upstream commit 2a2b09c867fdac63f430a45051e7bd0c46edc381 ]

In lk 5.11.0-rc2 connecting a USB based Silicon Labs HID to I2C
bridge evaluation board (CP2112EK) causes this warning:
  gpio gpiochip0: (cp2112_gpio): detected irqchip that is shared
       with multiple gpiochips: please fix the driver

Simply copy what other gpio related drivers do to fix this
particular warning: replicate the struct irq_chip object in each
device instance rather than have a static object which makes that
object (incorrectly) shared by each device.

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/hid/hid-cp2112.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c
index 21e15627a461..477baa30889c 100644
--- a/drivers/hid/hid-cp2112.c
+++ b/drivers/hid/hid-cp2112.c
@@ -161,6 +161,7 @@ struct cp2112_device {
 	atomic_t read_avail;
 	atomic_t xfer_avail;
 	struct gpio_chip gc;
+	struct irq_chip irq;
 	u8 *in_out_buffer;
 	struct mutex lock;
 
@@ -1175,16 +1176,6 @@ static int cp2112_gpio_irq_type(struct irq_data *d, unsigned int type)
 	return 0;
 }
 
-static struct irq_chip cp2112_gpio_irqchip = {
-	.name = "cp2112-gpio",
-	.irq_startup = cp2112_gpio_irq_startup,
-	.irq_shutdown = cp2112_gpio_irq_shutdown,
-	.irq_ack = cp2112_gpio_irq_ack,
-	.irq_mask = cp2112_gpio_irq_mask,
-	.irq_unmask = cp2112_gpio_irq_unmask,
-	.irq_set_type = cp2112_gpio_irq_type,
-};
-
 static int __maybe_unused cp2112_allocate_irq(struct cp2112_device *dev,
 					      int pin)
 {
@@ -1339,8 +1330,17 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id)
 	dev->gc.can_sleep		= 1;
 	dev->gc.parent			= &hdev->dev;
 
+	dev->irq.name = "cp2112-gpio";
+	dev->irq.irq_startup = cp2112_gpio_irq_startup;
+	dev->irq.irq_shutdown = cp2112_gpio_irq_shutdown;
+	dev->irq.irq_ack = cp2112_gpio_irq_ack;
+	dev->irq.irq_mask = cp2112_gpio_irq_mask;
+	dev->irq.irq_unmask = cp2112_gpio_irq_unmask;
+	dev->irq.irq_set_type = cp2112_gpio_irq_type;
+	dev->irq.flags = IRQCHIP_MASK_ON_SUSPEND;
+
 	girq = &dev->gc.irq;
-	girq->chip = &cp2112_gpio_irqchip;
+	girq->chip = &dev->irq;
 	/* The event comes from the outside so no parent handler */
 	girq->parent_handler = NULL;
 	girq->num_parents = 0;
-- 
2.30.2


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

* [PATCH AUTOSEL 5.11 05/23] HID: wacom: Assign boolean values to a bool variable
  2021-04-19 20:43 [PATCH AUTOSEL 5.11 01/23] HID: google: add don USB id Sasha Levin
                   ` (2 preceding siblings ...)
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 04/23] HID cp2112: fix support for multiple gpiochips Sasha Levin
@ 2021-04-19 20:43 ` Sasha Levin
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 06/23] soc: qcom: geni: shield geni_icc_get() for ACPI boot Sasha Levin
                   ` (17 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Sasha Levin @ 2021-04-19 20:43 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Jiapeng Zhong, Abaci Robot, Jiri Kosina, Sasha Levin, linux-input

From: Jiapeng Zhong <abaci-bugfix@linux.alibaba.com>

[ Upstream commit e29c62ffb008829dc8bcc0a2ec438adc25a8255e ]

Fix the following coccicheck warnings:

./drivers/hid/wacom_wac.c:2536:2-6: WARNING: Assignment of
0/1 to bool variable.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Zhong <abaci-bugfix@linux.alibaba.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/hid/wacom_wac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 44d715c12f6a..bdd9ba577150 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -2533,7 +2533,7 @@ static void wacom_wac_finger_slot(struct wacom_wac *wacom_wac,
 	    !wacom_wac->shared->is_touch_on) {
 		if (!wacom_wac->shared->touch_down)
 			return;
-		prox = 0;
+		prox = false;
 	}
 
 	wacom_wac->hid_data.num_received++;
-- 
2.30.2


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

* [PATCH AUTOSEL 5.11 06/23] soc: qcom: geni: shield geni_icc_get() for ACPI boot
  2021-04-19 20:43 [PATCH AUTOSEL 5.11 01/23] HID: google: add don USB id Sasha Levin
                   ` (3 preceding siblings ...)
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 05/23] HID: wacom: Assign boolean values to a bool variable Sasha Levin
@ 2021-04-19 20:43 ` Sasha Levin
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 07/23] dmaengine: xilinx: dpdma: Fix descriptor issuing on video group Sasha Levin
                   ` (16 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Sasha Levin @ 2021-04-19 20:43 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Shawn Guo, Bjorn Andersson, Sasha Levin, linux-arm-msm

From: Shawn Guo <shawn.guo@linaro.org>

[ Upstream commit 0c9fdcdba68208270ae85d39600ea97da1718344 ]

Currently, GENI devices like i2c-qcom-geni fails to probe in ACPI boot,
if interconnect support is enabled.  That's because interconnect driver
only supports DT right now.  As interconnect is not necessarily required
for basic function of GENI devices, let's shield geni_icc_get() call,
and then all other ICC calls become nop due to NULL icc_path, so that
GENI devices keep working for ACPI boot.

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Link: https://lore.kernel.org/r/20210114112928.11368-1-shawn.guo@linaro.org
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/soc/qcom/qcom-geni-se.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c
index 1fd29f93ff6d..5bdfb1565c14 100644
--- a/drivers/soc/qcom/qcom-geni-se.c
+++ b/drivers/soc/qcom/qcom-geni-se.c
@@ -756,6 +756,9 @@ int geni_icc_get(struct geni_se *se, const char *icc_ddr)
 	int i, err;
 	const char *icc_names[] = {"qup-core", "qup-config", icc_ddr};
 
+	if (has_acpi_companion(se->dev))
+		return 0;
+
 	for (i = 0; i < ARRAY_SIZE(se->icc_paths); i++) {
 		if (!icc_names[i])
 			continue;
-- 
2.30.2


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

* [PATCH AUTOSEL 5.11 07/23] dmaengine: xilinx: dpdma: Fix descriptor issuing on video group
  2021-04-19 20:43 [PATCH AUTOSEL 5.11 01/23] HID: google: add don USB id Sasha Levin
                   ` (4 preceding siblings ...)
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 06/23] soc: qcom: geni: shield geni_icc_get() for ACPI boot Sasha Levin
@ 2021-04-19 20:43 ` Sasha Levin
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 08/23] dmaengine: xilinx: dpdma: Fix race condition in done IRQ Sasha Levin
                   ` (15 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Sasha Levin @ 2021-04-19 20:43 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Laurent Pinchart, Vinod Koul, Sasha Levin, dmaengine, linux-arm-kernel

From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

[ Upstream commit 1cbd44666216278bbb6a55bcb6b9283702171c77 ]

When multiple channels are part of a video group, the transfer is
triggered only when all channels in the group are ready. The logic to do
so is incorrect, as it causes the descriptors for all channels but the
last one in a group to not being pushed to the hardware. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://lore.kernel.org/r/20210307040629.29308-2-laurent.pinchart@ideasonboard.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/dma/xilinx/xilinx_dpdma.c | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/drivers/dma/xilinx/xilinx_dpdma.c b/drivers/dma/xilinx/xilinx_dpdma.c
index 55df63dead8d..d504112c609e 100644
--- a/drivers/dma/xilinx/xilinx_dpdma.c
+++ b/drivers/dma/xilinx/xilinx_dpdma.c
@@ -839,6 +839,7 @@ static void xilinx_dpdma_chan_queue_transfer(struct xilinx_dpdma_chan *chan)
 	struct xilinx_dpdma_tx_desc *desc;
 	struct virt_dma_desc *vdesc;
 	u32 reg, channels;
+	bool first_frame;
 
 	lockdep_assert_held(&chan->lock);
 
@@ -852,14 +853,6 @@ static void xilinx_dpdma_chan_queue_transfer(struct xilinx_dpdma_chan *chan)
 		chan->running = true;
 	}
 
-	if (chan->video_group)
-		channels = xilinx_dpdma_chan_video_group_ready(chan);
-	else
-		channels = BIT(chan->id);
-
-	if (!channels)
-		return;
-
 	vdesc = vchan_next_desc(&chan->vchan);
 	if (!vdesc)
 		return;
@@ -884,13 +877,26 @@ static void xilinx_dpdma_chan_queue_transfer(struct xilinx_dpdma_chan *chan)
 			    FIELD_PREP(XILINX_DPDMA_CH_DESC_START_ADDRE_MASK,
 				       upper_32_bits(sw_desc->dma_addr)));
 
-	if (chan->first_frame)
+	first_frame = chan->first_frame;
+	chan->first_frame = false;
+
+	if (chan->video_group) {
+		channels = xilinx_dpdma_chan_video_group_ready(chan);
+		/*
+		 * Trigger the transfer only when all channels in the group are
+		 * ready.
+		 */
+		if (!channels)
+			return;
+	} else {
+		channels = BIT(chan->id);
+	}
+
+	if (first_frame)
 		reg = XILINX_DPDMA_GBL_TRIG_MASK(channels);
 	else
 		reg = XILINX_DPDMA_GBL_RETRIG_MASK(channels);
 
-	chan->first_frame = false;
-
 	dpdma_write(xdev->reg, XILINX_DPDMA_GBL, reg);
 }
 
-- 
2.30.2


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

* [PATCH AUTOSEL 5.11 08/23] dmaengine: xilinx: dpdma: Fix race condition in done IRQ
  2021-04-19 20:43 [PATCH AUTOSEL 5.11 01/23] HID: google: add don USB id Sasha Levin
                   ` (5 preceding siblings ...)
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 07/23] dmaengine: xilinx: dpdma: Fix descriptor issuing on video group Sasha Levin
@ 2021-04-19 20:43 ` Sasha Levin
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 09/23] ARM: dts: Fix swapped mmc order for omap3 Sasha Levin
                   ` (14 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Sasha Levin @ 2021-04-19 20:43 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Laurent Pinchart, Vinod Koul, Sasha Levin, dmaengine, linux-arm-kernel

From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

[ Upstream commit 868833fbffbe51c487df4f95d4de9194264a4b30 ]

The active descriptor pointer is accessed from different contexts,
including different interrupt handlers, and its access must be protected
by the channel's lock. This wasn't done in the done IRQ handler. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://lore.kernel.org/r/20210307040629.29308-3-laurent.pinchart@ideasonboard.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/dma/xilinx/xilinx_dpdma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/xilinx/xilinx_dpdma.c b/drivers/dma/xilinx/xilinx_dpdma.c
index d504112c609e..70b29bd079c9 100644
--- a/drivers/dma/xilinx/xilinx_dpdma.c
+++ b/drivers/dma/xilinx/xilinx_dpdma.c
@@ -1048,13 +1048,14 @@ static int xilinx_dpdma_chan_stop(struct xilinx_dpdma_chan *chan)
  */
 static void xilinx_dpdma_chan_done_irq(struct xilinx_dpdma_chan *chan)
 {
-	struct xilinx_dpdma_tx_desc *active = chan->desc.active;
+	struct xilinx_dpdma_tx_desc *active;
 	unsigned long flags;
 
 	spin_lock_irqsave(&chan->lock, flags);
 
 	xilinx_dpdma_debugfs_desc_done_irq(chan);
 
+	active = chan->desc.active;
 	if (active)
 		vchan_cyclic_callback(&active->vdesc);
 	else
-- 
2.30.2


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

* [PATCH AUTOSEL 5.11 09/23] ARM: dts: Fix swapped mmc order for omap3
  2021-04-19 20:43 [PATCH AUTOSEL 5.11 01/23] HID: google: add don USB id Sasha Levin
                   ` (6 preceding siblings ...)
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 08/23] dmaengine: xilinx: dpdma: Fix race condition in done IRQ Sasha Levin
@ 2021-04-19 20:43 ` Sasha Levin
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 10/23] m68k: fix flatmem memory model setup Sasha Levin
                   ` (13 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Sasha Levin @ 2021-04-19 20:43 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Tony Lindgren, Aaro Koskinen, Peter Ujfalusi, Sasha Levin,
	linux-omap, devicetree

From: Tony Lindgren <tony@atomide.com>

[ Upstream commit a1ebdb3741993f853865d1bd8f77881916ad53a7 ]

Also some omap3 devices like n900 seem to have eMMC and micro-sd swapped
around with commit 21b2cec61c04 ("mmc: Set PROBE_PREFER_ASYNCHRONOUS for
drivers that existed in v4.4").

Let's fix the issue with aliases as discussed on the mailing lists. While
the mmc aliases should be board specific, let's first fix the issue with
minimal changes.

Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/boot/dts/omap3.dtsi | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index 9dcae1f2bc99..c5b9da0d7e6c 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -24,6 +24,9 @@ aliases {
 		i2c0 = &i2c1;
 		i2c1 = &i2c2;
 		i2c2 = &i2c3;
+		mmc0 = &mmc1;
+		mmc1 = &mmc2;
+		mmc2 = &mmc3;
 		serial0 = &uart1;
 		serial1 = &uart2;
 		serial2 = &uart3;
-- 
2.30.2


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

* [PATCH AUTOSEL 5.11 10/23] m68k: fix flatmem memory model setup
  2021-04-19 20:43 [PATCH AUTOSEL 5.11 01/23] HID: google: add don USB id Sasha Levin
                   ` (7 preceding siblings ...)
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 09/23] ARM: dts: Fix swapped mmc order for omap3 Sasha Levin
@ 2021-04-19 20:43 ` Sasha Levin
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 11/23] net: geneve: check skb is large enough for IPv4/IPv6 header Sasha Levin
                   ` (12 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Sasha Levin @ 2021-04-19 20:43 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Angelo Dureghello, Mike Rapoport, Greg Ungerer, Sasha Levin, linux-m68k

From: Angelo Dureghello <angelo@kernel-space.org>

[ Upstream commit d2bd44c4c05d043fb65cfdf26c54e6d8b94a4b41 ]

Detected a broken boot on mcf54415, likely introduced from

commit 4bfc848e0981
("m68k/mm: enable use of generic memory_model.h for !DISCONTIGMEM")

Fix ARCH_PFN_OFFSET to be a pfn.

Signed-off-by: Angelo Dureghello <angelo@kernel-space.org>
Acked-by: Mike Rapoport <rppt@linux.ibm.com>
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/m68k/include/asm/page_mm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/m68k/include/asm/page_mm.h b/arch/m68k/include/asm/page_mm.h
index 7f5912af2a52..21b1071e0a34 100644
--- a/arch/m68k/include/asm/page_mm.h
+++ b/arch/m68k/include/asm/page_mm.h
@@ -167,7 +167,7 @@ static inline __attribute_const__ int __virt_to_node_shift(void)
 	((__p) - pgdat->node_mem_map) + pgdat->node_start_pfn;		\
 })
 #else
-#define ARCH_PFN_OFFSET (m68k_memory[0].addr)
+#define ARCH_PFN_OFFSET (m68k_memory[0].addr >> PAGE_SHIFT)
 #include <asm-generic/memory_model.h>
 #endif
 
-- 
2.30.2


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

* [PATCH AUTOSEL 5.11 11/23] net: geneve: check skb is large enough for IPv4/IPv6 header
  2021-04-19 20:43 [PATCH AUTOSEL 5.11 01/23] HID: google: add don USB id Sasha Levin
                   ` (8 preceding siblings ...)
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 10/23] m68k: fix flatmem memory model setup Sasha Levin
@ 2021-04-19 20:43 ` Sasha Levin
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 12/23] dmaengine: tegra20: Fix runtime PM imbalance on error Sasha Levin
                   ` (11 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Sasha Levin @ 2021-04-19 20:43 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Phillip Potter, Eric Dumazet, syzbot+2e406a9ac75bb71d4b7a,
	David S . Miller, Sasha Levin, netdev

From: Phillip Potter <phil@philpotter.co.uk>

[ Upstream commit 6628ddfec7580882f11fdc5c194a8ea781fdadfa ]

Check within geneve_xmit_skb/geneve6_xmit_skb that sk_buff structure
is large enough to include IPv4 or IPv6 header, and reject if not. The
geneve_xmit_skb portion and overall idea was contributed by Eric Dumazet.
Fixes a KMSAN-found uninit-value bug reported by syzbot at:
https://syzkaller.appspot.com/bug?id=abe95dc3e3e9667fc23b8d81f29ecad95c6f106f

Suggested-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot+2e406a9ac75bb71d4b7a@syzkaller.appspotmail.com
Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/geneve.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index f35b0b83fe85..040edc6fc560 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -891,6 +891,9 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev,
 	__be16 sport;
 	int err;
 
+	if (!pskb_network_may_pull(skb, sizeof(struct iphdr)))
+		return -EINVAL;
+
 	sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
 	rt = geneve_get_v4_rt(skb, dev, gs4, &fl4, info,
 			      geneve->cfg.info.key.tp_dst, sport);
@@ -985,6 +988,9 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
 	__be16 sport;
 	int err;
 
+	if (!pskb_network_may_pull(skb, sizeof(struct ipv6hdr)))
+		return -EINVAL;
+
 	sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
 	dst = geneve_get_v6_dst(skb, dev, gs6, &fl6, info,
 				geneve->cfg.info.key.tp_dst, sport);
-- 
2.30.2


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

* [PATCH AUTOSEL 5.11 12/23] dmaengine: tegra20: Fix runtime PM imbalance on error
  2021-04-19 20:43 [PATCH AUTOSEL 5.11 01/23] HID: google: add don USB id Sasha Levin
                   ` (9 preceding siblings ...)
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 11/23] net: geneve: check skb is large enough for IPv4/IPv6 header Sasha Levin
@ 2021-04-19 20:43 ` Sasha Levin
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 13/23] s390/entry: save the caller of psw_idle Sasha Levin
                   ` (10 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Sasha Levin @ 2021-04-19 20:43 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Dinghao Liu, Thierry Reding, Vinod Koul, Sasha Levin, dmaengine,
	linux-tegra

From: Dinghao Liu <dinghao.liu@zju.edu.cn>

[ Upstream commit 917a3200b9f467a154999c7572af345f2470aaf4 ]

pm_runtime_get_sync() will increase the runtime PM counter
even it returns an error. Thus a pairing decrement is needed
to prevent refcount leak. Fix this by replacing this API with
pm_runtime_resume_and_get(), which will not change the runtime
PM counter on error.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20210409082805.23643-1-dinghao.liu@zju.edu.cn
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/dma/tegra20-apb-dma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
index 71827d9b0aa1..b7260749e8ee 100644
--- a/drivers/dma/tegra20-apb-dma.c
+++ b/drivers/dma/tegra20-apb-dma.c
@@ -723,7 +723,7 @@ static void tegra_dma_issue_pending(struct dma_chan *dc)
 		goto end;
 	}
 	if (!tdc->busy) {
-		err = pm_runtime_get_sync(tdc->tdma->dev);
+		err = pm_runtime_resume_and_get(tdc->tdma->dev);
 		if (err < 0) {
 			dev_err(tdc2dev(tdc), "Failed to enable DMA\n");
 			goto end;
@@ -818,7 +818,7 @@ static void tegra_dma_synchronize(struct dma_chan *dc)
 	struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc);
 	int err;
 
-	err = pm_runtime_get_sync(tdc->tdma->dev);
+	err = pm_runtime_resume_and_get(tdc->tdma->dev);
 	if (err < 0) {
 		dev_err(tdc2dev(tdc), "Failed to synchronize DMA: %d\n", err);
 		return;
-- 
2.30.2


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

* [PATCH AUTOSEL 5.11 13/23] s390/entry: save the caller of psw_idle
  2021-04-19 20:43 [PATCH AUTOSEL 5.11 01/23] HID: google: add don USB id Sasha Levin
                   ` (10 preceding siblings ...)
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 12/23] dmaengine: tegra20: Fix runtime PM imbalance on error Sasha Levin
@ 2021-04-19 20:43 ` Sasha Levin
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 14/23] arm64: kprobes: Restore local irqflag if kprobes is cancelled Sasha Levin
                   ` (9 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Sasha Levin @ 2021-04-19 20:43 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Vasily Gorbik, Sven Schnelle, Heiko Carstens, Sasha Levin, linux-s390

From: Vasily Gorbik <gor@linux.ibm.com>

[ Upstream commit a994eddb947ea9ebb7b14d9a1267001699f0a136 ]

Currently psw_idle does not allocate a stack frame and does not
save its r14 and r15 into the save area. Even though this is valid from
call ABI point of view, because psw_idle does not make any calls
explicitly, in reality psw_idle is an entry point for controlled
transition into serving interrupts. So, in practice, psw_idle stack
frame is analyzed during stack unwinding. Depending on build options
that r14 slot in the save area of psw_idle might either contain a value
saved by previous sibling call or complete garbage.

  [task    0000038000003c28] do_ext_irq+0xd6/0x160
  [task    0000038000003c78] ext_int_handler+0xba/0xe8
  [task   *0000038000003dd8] psw_idle_exit+0x0/0x8 <-- pt_regs
 ([task    0000038000003dd8] 0x0)
  [task    0000038000003e10] default_idle_call+0x42/0x148
  [task    0000038000003e30] do_idle+0xce/0x160
  [task    0000038000003e70] cpu_startup_entry+0x36/0x40
  [task    0000038000003ea0] arch_call_rest_init+0x76/0x80

So, to make a stacktrace nicer and actually point for the real caller of
psw_idle in this frequently occurring case, make psw_idle save its r14.

  [task    0000038000003c28] do_ext_irq+0xd6/0x160
  [task    0000038000003c78] ext_int_handler+0xba/0xe8
  [task   *0000038000003dd8] psw_idle_exit+0x0/0x6 <-- pt_regs
 ([task    0000038000003dd8] arch_cpu_idle+0x3c/0xd0)
  [task    0000038000003e10] default_idle_call+0x42/0x148
  [task    0000038000003e30] do_idle+0xce/0x160
  [task    0000038000003e70] cpu_startup_entry+0x36/0x40
  [task    0000038000003ea0] arch_call_rest_init+0x76/0x80

Reviewed-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/s390/kernel/entry.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index f1ba197b10c0..f0a215cf010c 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -976,6 +976,7 @@ ENDPROC(ext_int_handler)
  * Load idle PSW.
  */
 ENTRY(psw_idle)
+	stg	%r14,(__SF_GPRS+8*8)(%r15)
 	stg	%r3,__SF_EMPTY(%r15)
 	larl	%r1,.Lpsw_idle_exit
 	stg	%r1,__SF_EMPTY+8(%r15)
-- 
2.30.2


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

* [PATCH AUTOSEL 5.11 14/23] arm64: kprobes: Restore local irqflag if kprobes is cancelled
  2021-04-19 20:43 [PATCH AUTOSEL 5.11 01/23] HID: google: add don USB id Sasha Levin
                   ` (11 preceding siblings ...)
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 13/23] s390/entry: save the caller of psw_idle Sasha Levin
@ 2021-04-19 20:43 ` Sasha Levin
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 15/23] xen-netback: Check for hotplug-status existence before watching Sasha Levin
                   ` (8 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Sasha Levin @ 2021-04-19 20:43 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Jisheng Zhang, Masami Hiramatsu, Will Deacon, Sasha Levin,
	linux-arm-kernel, linux-riscv

From: Jisheng Zhang <Jisheng.Zhang@synaptics.com>

[ Upstream commit 738fa58ee1328481d1d7889e7c430b3401c571b9 ]

If instruction being single stepped caused a page fault, the kprobes
is cancelled to let the page fault handler continue as a normal page
fault. But the local irqflags are disabled so cpu will restore pstate
with DAIF masked. After pagefault is serviced, the kprobes is
triggerred again, we overwrite the saved_irqflag by calling
kprobes_save_local_irqflag(). NOTE, DAIF is masked in this new saved
irqflag. After kprobes is serviced, the cpu pstate is retored with
DAIF masked.

This patch is inspired by one patch for riscv from Liao Chang.

Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Link: https://lore.kernel.org/r/20210412174101.6bfb0594@xhacker.debian
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm64/kernel/probes/kprobes.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/kernel/probes/kprobes.c b/arch/arm64/kernel/probes/kprobes.c
index 66aac2881ba8..85645b2b0c7a 100644
--- a/arch/arm64/kernel/probes/kprobes.c
+++ b/arch/arm64/kernel/probes/kprobes.c
@@ -267,10 +267,12 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr)
 		if (!instruction_pointer(regs))
 			BUG();
 
-		if (kcb->kprobe_status == KPROBE_REENTER)
+		if (kcb->kprobe_status == KPROBE_REENTER) {
 			restore_previous_kprobe(kcb);
-		else
+		} else {
+			kprobes_restore_local_irqflag(kcb, regs);
 			reset_current_kprobe();
+		}
 
 		break;
 	case KPROBE_HIT_ACTIVE:
-- 
2.30.2


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

* [PATCH AUTOSEL 5.11 15/23] xen-netback: Check for hotplug-status existence before watching
  2021-04-19 20:43 [PATCH AUTOSEL 5.11 01/23] HID: google: add don USB id Sasha Levin
                   ` (12 preceding siblings ...)
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 14/23] arm64: kprobes: Restore local irqflag if kprobes is cancelled Sasha Levin
@ 2021-04-19 20:43 ` Sasha Levin
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 16/23] cavium/liquidio: Fix duplicate argument Sasha Levin
                   ` (7 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Sasha Levin @ 2021-04-19 20:43 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Michael Brown, Paul Durrant, David S . Miller, Sasha Levin,
	xen-devel, netdev

From: Michael Brown <mbrown@fensystems.co.uk>

[ Upstream commit 2afeec08ab5c86ae21952151f726bfe184f6b23d ]

The logic in connect() is currently written with the assumption that
xenbus_watch_pathfmt() will return an error for a node that does not
exist.  This assumption is incorrect: xenstore does allow a watch to
be registered for a nonexistent node (and will send notifications
should the node be subsequently created).

As of commit 1f2565780 ("xen-netback: remove 'hotplug-status' once it
has served its purpose"), this leads to a failure when a domU
transitions into XenbusStateConnected more than once.  On the first
domU transition into Connected state, the "hotplug-status" node will
be deleted by the hotplug_status_changed() callback in dom0.  On the
second or subsequent domU transition into Connected state, the
hotplug_status_changed() callback will therefore never be invoked, and
so the backend will remain stuck in InitWait.

This failure prevents scenarios such as reloading the xen-netfront
module within a domU, or booting a domU via iPXE.  There is
unfortunately no way for the domU to work around this dom0 bug.

Fix by explicitly checking for existence of the "hotplug-status" node,
thereby creating the behaviour that was previously assumed to exist.

Signed-off-by: Michael Brown <mbrown@fensystems.co.uk>
Reviewed-by: Paul Durrant <paul@xen.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/xen-netback/xenbus.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index 6f10e0998f1c..94d19158efc1 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -824,11 +824,15 @@ static void connect(struct backend_info *be)
 	xenvif_carrier_on(be->vif);
 
 	unregister_hotplug_status_watch(be);
-	err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch, NULL,
-				   hotplug_status_changed,
-				   "%s/%s", dev->nodename, "hotplug-status");
-	if (!err)
+	if (xenbus_exists(XBT_NIL, dev->nodename, "hotplug-status")) {
+		err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch,
+					   NULL, hotplug_status_changed,
+					   "%s/%s", dev->nodename,
+					   "hotplug-status");
+		if (err)
+			goto err;
 		be->have_hotplug_status_watch = 1;
+	}
 
 	netif_tx_wake_all_queues(be->vif->dev);
 
-- 
2.30.2


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

* [PATCH AUTOSEL 5.11 16/23] cavium/liquidio: Fix duplicate argument
  2021-04-19 20:43 [PATCH AUTOSEL 5.11 01/23] HID: google: add don USB id Sasha Levin
                   ` (13 preceding siblings ...)
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 15/23] xen-netback: Check for hotplug-status existence before watching Sasha Levin
@ 2021-04-19 20:43 ` Sasha Levin
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 17/23] i2c: mv64xxx: Fix random system lock caused by runtime PM Sasha Levin
                   ` (6 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Sasha Levin @ 2021-04-19 20:43 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Wan Jiabing, David S . Miller, Sasha Levin, netdev

From: Wan Jiabing <wanjiabing@vivo.com>

[ Upstream commit 416dcc5ce9d2a810477171c62ffa061a98f87367 ]

Fix the following coccicheck warning:

./drivers/net/ethernet/cavium/liquidio/cn66xx_regs.h:413:6-28:
duplicated argument to & or |

The CN6XXX_INTR_M1UPB0_ERR here is duplicate.
Here should be CN6XXX_INTR_M1UNB0_ERR.

Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/cavium/liquidio/cn66xx_regs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/cavium/liquidio/cn66xx_regs.h b/drivers/net/ethernet/cavium/liquidio/cn66xx_regs.h
index b248966837b4..7aad40b2aa73 100644
--- a/drivers/net/ethernet/cavium/liquidio/cn66xx_regs.h
+++ b/drivers/net/ethernet/cavium/liquidio/cn66xx_regs.h
@@ -412,7 +412,7 @@
 	   | CN6XXX_INTR_M0UNWI_ERR             \
 	   | CN6XXX_INTR_M1UPB0_ERR             \
 	   | CN6XXX_INTR_M1UPWI_ERR             \
-	   | CN6XXX_INTR_M1UPB0_ERR             \
+	   | CN6XXX_INTR_M1UNB0_ERR             \
 	   | CN6XXX_INTR_M1UNWI_ERR             \
 	   | CN6XXX_INTR_INSTR_DB_OF_ERR        \
 	   | CN6XXX_INTR_SLIST_DB_OF_ERR        \
-- 
2.30.2


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

* [PATCH AUTOSEL 5.11 17/23] i2c: mv64xxx: Fix random system lock caused by runtime PM
  2021-04-19 20:43 [PATCH AUTOSEL 5.11 01/23] HID: google: add don USB id Sasha Levin
                   ` (14 preceding siblings ...)
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 16/23] cavium/liquidio: Fix duplicate argument Sasha Levin
@ 2021-04-19 20:43 ` Sasha Levin
  2021-04-20  6:30   ` Marek Behún
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 18/23] kasan: fix hwasan build for gcc Sasha Levin
                   ` (5 subsequent siblings)
  21 siblings, 1 reply; 25+ messages in thread
From: Sasha Levin @ 2021-04-19 20:43 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Marek Behún, Gregory CLEMENT, Samuel Holland, Wolfram Sang,
	Sasha Levin, linux-i2c

From: Marek Behún <kabel@kernel.org>

[ Upstream commit 39930213e7779b9c4257499972b8afb8858f1a2d ]

I noticed a weird bug with this driver on Marvell CN9130 Customer
Reference Board.

Sometime after boot, the system locks with the following message:
 [104.071363] i2c i2c-0: mv64xxx: I2C bus locked, block: 1, time_left: 0

The system does not respond afterwards, only warns about RCU stalls.

This first appeared with commit e5c02cf54154 ("i2c: mv64xxx: Add runtime
PM support").

With further experimentation I discovered that adding a delay into
mv64xxx_i2c_hw_init() fixes this issue. This function is called before
every xfer, due to how runtime PM works in this driver. It seems that in
order to work correctly, a delay is needed after the bus is reset in
this function.

Since there already is a known erratum with this controller needing a
delay, I assume that this is just another place this needs to be
applied. Therefore I apply the delay only if errata_delay is true.

Signed-off-by: Marek Behún <kabel@kernel.org>
Acked-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/i2c/busses/i2c-mv64xxx.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index 5cfe70aedced..1b55352abbe8 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -220,6 +220,10 @@ mv64xxx_i2c_hw_init(struct mv64xxx_i2c_data *drv_data)
 	writel(0, drv_data->reg_base + drv_data->reg_offsets.ext_addr);
 	writel(MV64XXX_I2C_REG_CONTROL_TWSIEN | MV64XXX_I2C_REG_CONTROL_STOP,
 		drv_data->reg_base + drv_data->reg_offsets.control);
+
+	if (drv_data->errata_delay)
+		udelay(5);
+
 	drv_data->state = MV64XXX_I2C_STATE_IDLE;
 }
 
-- 
2.30.2


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

* [PATCH AUTOSEL 5.11 18/23] kasan: fix hwasan build for gcc
  2021-04-19 20:43 [PATCH AUTOSEL 5.11 01/23] HID: google: add don USB id Sasha Levin
                   ` (15 preceding siblings ...)
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 17/23] i2c: mv64xxx: Fix random system lock caused by runtime PM Sasha Levin
@ 2021-04-19 20:43 ` Sasha Levin
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 19/23] csky: change a Kconfig symbol name to fix e1000 build error Sasha Levin
                   ` (4 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Sasha Levin @ 2021-04-19 20:43 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Arnd Bergmann, Marco Elver, Andrey Konovalov, Masahiro Yamada,
	Michal Marek, Andrey Ryabinin, Nathan Chancellor,
	Nick Desaulniers, Alexander Potapenko, Dmitry Vyukov,
	Andrew Morton, Linus Torvalds, Sasha Levin, linux-kbuild,
	kasan-dev, clang-built-linux

From: Arnd Bergmann <arnd@arndb.de>

[ Upstream commit 5c595ac4c776c44b5c59de22ab43b3fe256d9fbb ]

gcc-11 adds support for -fsanitize=kernel-hwaddress, so it becomes
possible to enable CONFIG_KASAN_SW_TAGS.

Unfortunately this fails to build at the moment, because the
corresponding command line arguments use llvm specific syntax.

Change it to use the cc-param macro instead, which works on both clang
and gcc.

[elver@google.com: fixup for "kasan: fix hwasan build for gcc"]
  Link: https://lkml.kernel.org/r/YHQZVfVVLE/LDK2v@elver.google.com

Link: https://lkml.kernel.org/r/20210323124112.1229772-1-arnd@kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Marco Elver <elver@google.com>
Reviewed-by: Marco Elver <elver@google.com>
Acked-by: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Michal Marek <michal.lkml@markovi.net>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 scripts/Makefile.kasan | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan
index 1e000cc2e7b4..127012f45166 100644
--- a/scripts/Makefile.kasan
+++ b/scripts/Makefile.kasan
@@ -2,6 +2,8 @@
 CFLAGS_KASAN_NOSANITIZE := -fno-builtin
 KASAN_SHADOW_OFFSET ?= $(CONFIG_KASAN_SHADOW_OFFSET)
 
+cc-param = $(call cc-option, -mllvm -$(1), $(call cc-option, --param $(1)))
+
 ifdef CONFIG_KASAN_GENERIC
 
 ifdef CONFIG_KASAN_INLINE
@@ -12,8 +14,6 @@ endif
 
 CFLAGS_KASAN_MINIMAL := -fsanitize=kernel-address
 
-cc-param = $(call cc-option, -mllvm -$(1), $(call cc-option, --param $(1)))
-
 # -fasan-shadow-offset fails without -fsanitize
 CFLAGS_KASAN_SHADOW := $(call cc-option, -fsanitize=kernel-address \
 			-fasan-shadow-offset=$(KASAN_SHADOW_OFFSET), \
@@ -36,14 +36,14 @@ endif # CONFIG_KASAN_GENERIC
 ifdef CONFIG_KASAN_SW_TAGS
 
 ifdef CONFIG_KASAN_INLINE
-    instrumentation_flags := -mllvm -hwasan-mapping-offset=$(KASAN_SHADOW_OFFSET)
+    instrumentation_flags := $(call cc-param,hwasan-mapping-offset=$(KASAN_SHADOW_OFFSET))
 else
-    instrumentation_flags := -mllvm -hwasan-instrument-with-calls=1
+    instrumentation_flags := $(call cc-param,hwasan-instrument-with-calls=1)
 endif
 
 CFLAGS_KASAN := -fsanitize=kernel-hwaddress \
-		-mllvm -hwasan-instrument-stack=$(CONFIG_KASAN_STACK) \
-		-mllvm -hwasan-use-short-granules=0 \
+		$(call cc-param,hwasan-instrument-stack=$(CONFIG_KASAN_STACK)) \
+		$(call cc-param,hwasan-use-short-granules=0) \
 		$(instrumentation_flags)
 
 endif # CONFIG_KASAN_SW_TAGS
-- 
2.30.2


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

* [PATCH AUTOSEL 5.11 19/23] csky: change a Kconfig symbol name to fix e1000 build error
  2021-04-19 20:43 [PATCH AUTOSEL 5.11 01/23] HID: google: add don USB id Sasha Levin
                   ` (16 preceding siblings ...)
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 18/23] kasan: fix hwasan build for gcc Sasha Levin
@ 2021-04-19 20:43 ` Sasha Levin
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 20/23] ia64: fix discontig.c section mismatches Sasha Levin
                   ` (3 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Sasha Levin @ 2021-04-19 20:43 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Randy Dunlap, kernel test robot, Guo Ren, Jesse Brandeburg,
	Andrew Morton, Linus Torvalds, Sasha Levin, linux-csky

From: Randy Dunlap <rdunlap@infradead.org>

[ Upstream commit d199161653d612b8fb96ac51bfd5b2d2782ecef3 ]

e1000's #define of CONFIG_RAM_BASE conflicts with a Kconfig symbol in
arch/csky/Kconfig.

The symbol in e1000 has been around longer, so change arch/csky/ to use
DRAM_BASE instead of RAM_BASE to remove the conflict.  (although e1000
is also a 2-line change)

Link: https://lkml.kernel.org/r/20210411055335.7111-1-rdunlap@infradead.org
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: kernel test robot <lkp@intel.com>
Acked-by: Guo Ren <guoren@kernel.org>
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/csky/Kconfig            | 2 +-
 arch/csky/include/asm/page.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/csky/Kconfig b/arch/csky/Kconfig
index 89dd2fcf38fa..3b16d081b4d7 100644
--- a/arch/csky/Kconfig
+++ b/arch/csky/Kconfig
@@ -292,7 +292,7 @@ config FORCE_MAX_ZONEORDER
 	int "Maximum zone order"
 	default "11"
 
-config RAM_BASE
+config DRAM_BASE
 	hex "DRAM start addr (the same with memory-section in dts)"
 	default 0x0
 
diff --git a/arch/csky/include/asm/page.h b/arch/csky/include/asm/page.h
index 9b98bf31d57c..16878240ef9a 100644
--- a/arch/csky/include/asm/page.h
+++ b/arch/csky/include/asm/page.h
@@ -28,7 +28,7 @@
 #define SSEG_SIZE	0x20000000
 #define LOWMEM_LIMIT	(SSEG_SIZE * 2)
 
-#define PHYS_OFFSET_OFFSET (CONFIG_RAM_BASE & (SSEG_SIZE - 1))
+#define PHYS_OFFSET_OFFSET (CONFIG_DRAM_BASE & (SSEG_SIZE - 1))
 
 #ifndef __ASSEMBLY__
 
-- 
2.30.2


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

* [PATCH AUTOSEL 5.11 20/23] ia64: fix discontig.c section mismatches
  2021-04-19 20:43 [PATCH AUTOSEL 5.11 01/23] HID: google: add don USB id Sasha Levin
                   ` (17 preceding siblings ...)
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 19/23] csky: change a Kconfig symbol name to fix e1000 build error Sasha Levin
@ 2021-04-19 20:43 ` Sasha Levin
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 21/23] ia64: tools: remove duplicate definition of ia64_mf() on ia64 Sasha Levin
                   ` (2 subsequent siblings)
  21 siblings, 0 replies; 25+ messages in thread
From: Sasha Levin @ 2021-04-19 20:43 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Randy Dunlap, Mike Rapoport, Andrew Morton, Linus Torvalds,
	Sasha Levin, linux-ia64

From: Randy Dunlap <rdunlap@infradead.org>

[ Upstream commit e2af9da4f867a1a54f1252bf3abc1a5c63951778 ]

Fix IA64 discontig.c Section mismatch warnings.

When CONFIG_SPARSEMEM=y and CONFIG_MEMORY_HOTPLUG=y, the functions
computer_pernodesize() and scatter_node_data() should not be marked as
__meminit because they are needed after init, on any memory hotplug
event.  Also, early_nr_cpus_node() is called by compute_pernodesize(),
so early_nr_cpus_node() cannot be __meminit either.

  WARNING: modpost: vmlinux.o(.text.unlikely+0x1612): Section mismatch in reference from the function arch_alloc_nodedata() to the function .meminit.text:compute_pernodesize()
  The function arch_alloc_nodedata() references the function __meminit compute_pernodesize().
  This is often because arch_alloc_nodedata lacks a __meminit annotation or the annotation of compute_pernodesize is wrong.

  WARNING: modpost: vmlinux.o(.text.unlikely+0x1692): Section mismatch in reference from the function arch_refresh_nodedata() to the function .meminit.text:scatter_node_data()
  The function arch_refresh_nodedata() references the function __meminit scatter_node_data().
  This is often because arch_refresh_nodedata lacks a __meminit annotation or the annotation of scatter_node_data is wrong.

  WARNING: modpost: vmlinux.o(.text.unlikely+0x1502): Section mismatch in reference from the function compute_pernodesize() to the function .meminit.text:early_nr_cpus_node()
  The function compute_pernodesize() references the function __meminit early_nr_cpus_node().
  This is often because compute_pernodesize lacks a __meminit annotation or the annotation of early_nr_cpus_node is wrong.

Link: https://lkml.kernel.org/r/20210411001201.3069-1-rdunlap@infradead.org
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Mike Rapoport <rppt@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/ia64/mm/discontig.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index c7311131156e..ba3edb8a04b1 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -94,7 +94,7 @@ static int __init build_node_maps(unsigned long start, unsigned long len,
  * acpi_boot_init() (which builds the node_to_cpu_mask array) hasn't been
  * called yet.  Note that node 0 will also count all non-existent cpus.
  */
-static int __meminit early_nr_cpus_node(int node)
+static int early_nr_cpus_node(int node)
 {
 	int cpu, n = 0;
 
@@ -109,7 +109,7 @@ static int __meminit early_nr_cpus_node(int node)
  * compute_pernodesize - compute size of pernode data
  * @node: the node id.
  */
-static unsigned long __meminit compute_pernodesize(int node)
+static unsigned long compute_pernodesize(int node)
 {
 	unsigned long pernodesize = 0, cpus;
 
@@ -366,7 +366,7 @@ static void __init reserve_pernode_space(void)
 	}
 }
 
-static void __meminit scatter_node_data(void)
+static void scatter_node_data(void)
 {
 	pg_data_t **dst;
 	int node;
-- 
2.30.2


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

* [PATCH AUTOSEL 5.11 21/23] ia64: tools: remove duplicate definition of ia64_mf() on ia64
  2021-04-19 20:43 [PATCH AUTOSEL 5.11 01/23] HID: google: add don USB id Sasha Levin
                   ` (18 preceding siblings ...)
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 20/23] ia64: fix discontig.c section mismatches Sasha Levin
@ 2021-04-19 20:43 ` Sasha Levin
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 22/23] gcov: clang: fix clang-11+ build Sasha Levin
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 23/23] readdir: make sure to verify directory entry for legacy interfaces too Sasha Levin
  21 siblings, 0 replies; 25+ messages in thread
From: Sasha Levin @ 2021-04-19 20:43 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: John Paul Adrian Glaubitz, Andrew Morton, Linus Torvalds,
	Sasha Levin, netdev, bpf

From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>

[ Upstream commit f4bf09dc3aaa4b07cd15630f2023f68cb2668809 ]

The ia64_mf() macro defined in tools/arch/ia64/include/asm/barrier.h is
already defined in <asm/gcc_intrin.h> on ia64 which causes libbpf
failing to build:

    CC       /usr/src/linux/tools/bpf/bpftool//libbpf/staticobjs/libbpf.o
  In file included from /usr/src/linux/tools/include/asm/barrier.h:24,
                   from /usr/src/linux/tools/include/linux/ring_buffer.h:4,
                   from libbpf.c:37:
  /usr/src/linux/tools/include/asm/../../arch/ia64/include/asm/barrier.h:43: error: "ia64_mf" redefined [-Werror]
     43 | #define ia64_mf()       asm volatile ("mf" ::: "memory")
        |
  In file included from /usr/include/ia64-linux-gnu/asm/intrinsics.h:20,
                   from /usr/include/ia64-linux-gnu/asm/swab.h:11,
                   from /usr/include/linux/swab.h:8,
                   from /usr/include/linux/byteorder/little_endian.h:13,
                   from /usr/include/ia64-linux-gnu/asm/byteorder.h:5,
                   from /usr/src/linux/tools/include/uapi/linux/perf_event.h:20,
                   from libbpf.c:36:
  /usr/include/ia64-linux-gnu/asm/gcc_intrin.h:382: note: this is the location of the previous definition
    382 | #define ia64_mf() __asm__ volatile ("mf" ::: "memory")
        |
  cc1: all warnings being treated as errors

Thus, remove the definition from tools/arch/ia64/include/asm/barrier.h.

Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 tools/arch/ia64/include/asm/barrier.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/tools/arch/ia64/include/asm/barrier.h b/tools/arch/ia64/include/asm/barrier.h
index 4d471d9511a5..6fffe5682713 100644
--- a/tools/arch/ia64/include/asm/barrier.h
+++ b/tools/arch/ia64/include/asm/barrier.h
@@ -39,9 +39,6 @@
  * sequential memory pages only.
  */
 
-/* XXX From arch/ia64/include/uapi/asm/gcc_intrin.h */
-#define ia64_mf()       asm volatile ("mf" ::: "memory")
-
 #define mb()		ia64_mf()
 #define rmb()		mb()
 #define wmb()		mb()
-- 
2.30.2


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

* [PATCH AUTOSEL 5.11 22/23] gcov: clang: fix clang-11+ build
  2021-04-19 20:43 [PATCH AUTOSEL 5.11 01/23] HID: google: add don USB id Sasha Levin
                   ` (19 preceding siblings ...)
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 21/23] ia64: tools: remove duplicate definition of ia64_mf() on ia64 Sasha Levin
@ 2021-04-19 20:43 ` Sasha Levin
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 23/23] readdir: make sure to verify directory entry for legacy interfaces too Sasha Levin
  21 siblings, 0 replies; 25+ messages in thread
From: Sasha Levin @ 2021-04-19 20:43 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Johannes Berg, Nick Desaulniers, Andrew Morton, Linus Torvalds,
	Sasha Levin, clang-built-linux

From: Johannes Berg <johannes.berg@intel.com>

[ Upstream commit 04c53de57cb6435738961dace8b1b71d3ecd3c39 ]

With clang-11+, the code is broken due to my kvmalloc() conversion
(which predated the clang-11 support code) leaving one vmalloc() in
place.  Fix that.

Link: https://lkml.kernel.org/r/20210412214210.6e1ecca9cdc5.I24459763acf0591d5e6b31c7e3a59890d802f79c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Tested-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 kernel/gcov/clang.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/gcov/clang.c b/kernel/gcov/clang.c
index c466c7fbdece..b81f2823630d 100644
--- a/kernel/gcov/clang.c
+++ b/kernel/gcov/clang.c
@@ -369,7 +369,7 @@ static struct gcov_fn_info *gcov_fn_info_dup(struct gcov_fn_info *fn)
 	INIT_LIST_HEAD(&fn_dup->head);
 
 	cv_size = fn->num_counters * sizeof(fn->counters[0]);
-	fn_dup->counters = vmalloc(cv_size);
+	fn_dup->counters = kvmalloc(cv_size, GFP_KERNEL);
 	if (!fn_dup->counters) {
 		kfree(fn_dup);
 		return NULL;
-- 
2.30.2


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

* [PATCH AUTOSEL 5.11 23/23] readdir: make sure to verify directory entry for legacy interfaces too
  2021-04-19 20:43 [PATCH AUTOSEL 5.11 01/23] HID: google: add don USB id Sasha Levin
                   ` (20 preceding siblings ...)
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 22/23] gcov: clang: fix clang-11+ build Sasha Levin
@ 2021-04-19 20:43 ` Sasha Levin
  21 siblings, 0 replies; 25+ messages in thread
From: Sasha Levin @ 2021-04-19 20:43 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Linus Torvalds, Al Viro, Sasha Levin, linux-fsdevel

From: Linus Torvalds <torvalds@linux-foundation.org>

[ Upstream commit 0c93ac69407d63a85be0129aa55ffaec27ffebd3 ]

This does the directory entry name verification for the legacy
"fillonedir" (and compat) interface that goes all the way back to the
dark ages before we had a proper dirent, and the readdir() system call
returned just a single entry at a time.

Nobody should use this interface unless you still have binaries from
1991, but let's do it right.

This came up during discussions about unsafe_copy_to_user() and proper
checking of all the inputs to it, as the networking layer is looking to
use it in a few new places.  So let's make sure the _old_ users do it
all right and proper, before we add new ones.

See also commit 8a23eb804ca4 ("Make filldir[64]() verify the directory
entry filename is valid") which did the proper modern interfaces that
people actually use. It had a note:

    Note that I didn't bother adding the checks to any legacy interfaces
    that nobody uses.

which this now corrects.  Note that we really don't care about POSIX and
the presense of '/' in a directory entry, but verify_dirent_name() also
ends up doing the proper name length verification which is what the
input checking discussion was about.

[ Another option would be to remove the support for this particular very
  old interface: any binaries that use it are likely a.out binaries, and
  they will no longer run anyway since we removed a.out binftm support
  in commit eac616557050 ("x86: Deprecate a.out support").

  But I'm not sure which came first: getdents() or ELF support, so let's
  pretend somebody might still have a working binary that uses the
  legacy readdir() case.. ]

Link: https://lore.kernel.org/lkml/CAHk-=wjbvzCAhAtvG0d81W5o0-KT5PPTHhfJ5ieDFq+bGtgOYg@mail.gmail.com/
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/readdir.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/readdir.c b/fs/readdir.c
index 19434b3c982c..09e8ed7d4161 100644
--- a/fs/readdir.c
+++ b/fs/readdir.c
@@ -150,6 +150,9 @@ static int fillonedir(struct dir_context *ctx, const char *name, int namlen,
 
 	if (buf->result)
 		return -EINVAL;
+	buf->result = verify_dirent_name(name, namlen);
+	if (buf->result < 0)
+		return buf->result;
 	d_ino = ino;
 	if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) {
 		buf->result = -EOVERFLOW;
@@ -405,6 +408,9 @@ static int compat_fillonedir(struct dir_context *ctx, const char *name,
 
 	if (buf->result)
 		return -EINVAL;
+	buf->result = verify_dirent_name(name, namlen);
+	if (buf->result < 0)
+		return buf->result;
 	d_ino = ino;
 	if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) {
 		buf->result = -EOVERFLOW;
-- 
2.30.2


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

* Re: [PATCH AUTOSEL 5.11 17/23] i2c: mv64xxx: Fix random system lock caused by runtime PM
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 17/23] i2c: mv64xxx: Fix random system lock caused by runtime PM Sasha Levin
@ 2021-04-20  6:30   ` Marek Behún
  2021-04-25 21:41     ` Sasha Levin
  0 siblings, 1 reply; 25+ messages in thread
From: Marek Behún @ 2021-04-20  6:30 UTC (permalink / raw)
  To: Sasha Levin
  Cc: linux-kernel, stable, Gregory CLEMENT, Samuel Holland,
	Wolfram Sang, linux-i2c

On Mon, 19 Apr 2021 16:43:36 -0400
Sasha Levin <sashal@kernel.org> wrote:

> This first appeared with commit e5c02cf54154 ("i2c: mv64xxx: Add runtime
> PM support").

I forgot to add Fixes: tag to this commit. But the bug first appeared with
commit
  e5c02cf54154 ("i2c: mv64xxx: Add runtime PM support")
which is in 5.12, but not 5.11 or any others.

So this fix is not needed for the stable releases (althogh it does not
break anything on those...).

Marek

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

* Re: [PATCH AUTOSEL 5.11 17/23] i2c: mv64xxx: Fix random system lock caused by runtime PM
  2021-04-20  6:30   ` Marek Behún
@ 2021-04-25 21:41     ` Sasha Levin
  0 siblings, 0 replies; 25+ messages in thread
From: Sasha Levin @ 2021-04-25 21:41 UTC (permalink / raw)
  To: Marek Behún
  Cc: linux-kernel, stable, Gregory CLEMENT, Samuel Holland,
	Wolfram Sang, linux-i2c

On Tue, Apr 20, 2021 at 08:30:50AM +0200, Marek Behún wrote:
>On Mon, 19 Apr 2021 16:43:36 -0400
>Sasha Levin <sashal@kernel.org> wrote:
>
>> This first appeared with commit e5c02cf54154 ("i2c: mv64xxx: Add runtime
>> PM support").
>
>I forgot to add Fixes: tag to this commit. But the bug first appeared with
>commit
>  e5c02cf54154 ("i2c: mv64xxx: Add runtime PM support")
>which is in 5.12, but not 5.11 or any others.
>
>So this fix is not needed for the stable releases (althogh it does not
>break anything on those...).

I'll drop it, thanks!

-- 
Thanks,
Sasha

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

end of thread, other threads:[~2021-04-25 21:41 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-19 20:43 [PATCH AUTOSEL 5.11 01/23] HID: google: add don USB id Sasha Levin
2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 02/23] HID: asus: Add support for 2021 ASUS N-Key keyboard Sasha Levin
2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 03/23] HID: alps: fix error return code in alps_input_configured() Sasha Levin
2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 04/23] HID cp2112: fix support for multiple gpiochips Sasha Levin
2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 05/23] HID: wacom: Assign boolean values to a bool variable Sasha Levin
2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 06/23] soc: qcom: geni: shield geni_icc_get() for ACPI boot Sasha Levin
2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 07/23] dmaengine: xilinx: dpdma: Fix descriptor issuing on video group Sasha Levin
2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 08/23] dmaengine: xilinx: dpdma: Fix race condition in done IRQ Sasha Levin
2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 09/23] ARM: dts: Fix swapped mmc order for omap3 Sasha Levin
2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 10/23] m68k: fix flatmem memory model setup Sasha Levin
2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 11/23] net: geneve: check skb is large enough for IPv4/IPv6 header Sasha Levin
2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 12/23] dmaengine: tegra20: Fix runtime PM imbalance on error Sasha Levin
2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 13/23] s390/entry: save the caller of psw_idle Sasha Levin
2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 14/23] arm64: kprobes: Restore local irqflag if kprobes is cancelled Sasha Levin
2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 15/23] xen-netback: Check for hotplug-status existence before watching Sasha Levin
2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 16/23] cavium/liquidio: Fix duplicate argument Sasha Levin
2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 17/23] i2c: mv64xxx: Fix random system lock caused by runtime PM Sasha Levin
2021-04-20  6:30   ` Marek Behún
2021-04-25 21:41     ` Sasha Levin
2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 18/23] kasan: fix hwasan build for gcc Sasha Levin
2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 19/23] csky: change a Kconfig symbol name to fix e1000 build error Sasha Levin
2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 20/23] ia64: fix discontig.c section mismatches Sasha Levin
2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 21/23] ia64: tools: remove duplicate definition of ia64_mf() on ia64 Sasha Levin
2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 22/23] gcov: clang: fix clang-11+ build Sasha Levin
2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 23/23] readdir: make sure to verify directory entry for legacy interfaces too Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).