linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.4 01/12] pwm: spear: Don't modify HW state in .remove callback
@ 2021-07-10 23:52 Sasha Levin
  2021-07-10 23:52 ` [PATCH AUTOSEL 4.4 02/12] power: supply: ab8500: Avoid NULL pointers Sasha Levin
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Sasha Levin @ 2021-07-10 23:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Uwe Kleine-König, Thierry Reding, Sasha Levin, linux-pwm

From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

[ Upstream commit b601a18f12383001e7a8da238de7ca1559ebc450 ]

A consumer is expected to disable a PWM before calling pwm_put(). And if
they didn't there is hopefully a good reason (or the consumer needs
fixing). Also if disabling an enabled PWM was the right thing to do,
this should better be done in the framework instead of in each low level
driver.

So drop the hardware modification from the .remove() callback.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/pwm/pwm-spear.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/pwm/pwm-spear.c b/drivers/pwm/pwm-spear.c
index 6c6b44fd3f43..2d11ac277de8 100644
--- a/drivers/pwm/pwm-spear.c
+++ b/drivers/pwm/pwm-spear.c
@@ -231,10 +231,6 @@ static int spear_pwm_probe(struct platform_device *pdev)
 static int spear_pwm_remove(struct platform_device *pdev)
 {
 	struct spear_pwm_chip *pc = platform_get_drvdata(pdev);
-	int i;
-
-	for (i = 0; i < NUM_PWM; i++)
-		pwm_disable(&pc->chip.pwms[i]);
 
 	/* clk was prepared in probe, hence unprepare it here */
 	clk_unprepare(pc->clk);
-- 
2.30.2


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

* [PATCH AUTOSEL 4.4 02/12] power: supply: ab8500: Avoid NULL pointers
  2021-07-10 23:52 [PATCH AUTOSEL 4.4 01/12] pwm: spear: Don't modify HW state in .remove callback Sasha Levin
@ 2021-07-10 23:52 ` Sasha Levin
  2021-07-10 23:52 ` [PATCH AUTOSEL 4.4 03/12] power: reset: gpio-poweroff: add missing MODULE_DEVICE_TABLE Sasha Levin
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Sasha Levin @ 2021-07-10 23:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Linus Walleij, Sebastian Reichel, Sasha Levin

From: Linus Walleij <linus.walleij@linaro.org>

[ Upstream commit 5bcb5087c9dd3dca1ff0ebd8002c5313c9332b56 ]

Sometimes the code will crash because we haven't enabled
AC or USB charging and thus not created the corresponding
psy device. Fix it by checking that it is there before
notifying.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/power/ab8500_charger.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c
index e388171f4e58..98724c3a28e5 100644
--- a/drivers/power/ab8500_charger.c
+++ b/drivers/power/ab8500_charger.c
@@ -409,6 +409,14 @@ static void ab8500_enable_disable_sw_fallback(struct ab8500_charger *di,
 static void ab8500_power_supply_changed(struct ab8500_charger *di,
 					struct power_supply *psy)
 {
+	/*
+	 * This happens if we get notifications or interrupts and
+	 * the platform has been configured not to support one or
+	 * other type of charging.
+	 */
+	if (!psy)
+		return;
+
 	if (di->autopower_cfg) {
 		if (!di->usb.charger_connected &&
 		    !di->ac.charger_connected &&
@@ -435,7 +443,15 @@ static void ab8500_charger_set_usb_connected(struct ab8500_charger *di,
 		if (!connected)
 			di->flags.vbus_drop_end = false;
 
-		sysfs_notify(&di->usb_chg.psy->dev.kobj, NULL, "present");
+		/*
+		 * Sometimes the platform is configured not to support
+		 * USB charging and no psy has been created, but we still
+		 * will get these notifications.
+		 */
+		if (di->usb_chg.psy) {
+			sysfs_notify(&di->usb_chg.psy->dev.kobj, NULL,
+				     "present");
+		}
 
 		if (connected) {
 			mutex_lock(&di->charger_attached_mutex);
-- 
2.30.2


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

* [PATCH AUTOSEL 4.4 03/12] power: reset: gpio-poweroff: add missing MODULE_DEVICE_TABLE
  2021-07-10 23:52 [PATCH AUTOSEL 4.4 01/12] pwm: spear: Don't modify HW state in .remove callback Sasha Levin
  2021-07-10 23:52 ` [PATCH AUTOSEL 4.4 02/12] power: supply: ab8500: Avoid NULL pointers Sasha Levin
@ 2021-07-10 23:52 ` Sasha Levin
  2021-07-10 23:52 ` [PATCH AUTOSEL 4.4 04/12] ARM: 9087/1: kprobes: test-thumb: fix for LLVM_IAS=1 Sasha Levin
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Sasha Levin @ 2021-07-10 23:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Bixuan Cui, Hulk Robot, Sebastian Reichel, Sasha Levin, linux-pm

From: Bixuan Cui <cuibixuan@huawei.com>

[ Upstream commit ed3443fb4df4e140a22f65144546c8a8e1e27f4e ]

This patch adds missing MODULE_DEVICE_TABLE definition which generates
correct modalias for automatic loading of this driver when it is built
as an external module.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/power/reset/gpio-poweroff.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/power/reset/gpio-poweroff.c b/drivers/power/reset/gpio-poweroff.c
index be3d81ff51cc..a44e3427fdeb 100644
--- a/drivers/power/reset/gpio-poweroff.c
+++ b/drivers/power/reset/gpio-poweroff.c
@@ -84,6 +84,7 @@ static const struct of_device_id of_gpio_poweroff_match[] = {
 	{ .compatible = "gpio-poweroff", },
 	{},
 };
+MODULE_DEVICE_TABLE(of, of_gpio_poweroff_match);
 
 static struct platform_driver gpio_poweroff_driver = {
 	.probe = gpio_poweroff_probe,
-- 
2.30.2


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

* [PATCH AUTOSEL 4.4 04/12] ARM: 9087/1: kprobes: test-thumb: fix for LLVM_IAS=1
  2021-07-10 23:52 [PATCH AUTOSEL 4.4 01/12] pwm: spear: Don't modify HW state in .remove callback Sasha Levin
  2021-07-10 23:52 ` [PATCH AUTOSEL 4.4 02/12] power: supply: ab8500: Avoid NULL pointers Sasha Levin
  2021-07-10 23:52 ` [PATCH AUTOSEL 4.4 03/12] power: reset: gpio-poweroff: add missing MODULE_DEVICE_TABLE Sasha Levin
@ 2021-07-10 23:52 ` Sasha Levin
  2021-07-10 23:52 ` [PATCH AUTOSEL 4.4 05/12] watchdog: Fix possible use-after-free in wdt_startup() Sasha Levin
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Sasha Levin @ 2021-07-10 23:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Nick Desaulniers, Jian Cai, Russell King, Sasha Levin,
	linux-arm-kernel, clang-built-linux

From: Nick Desaulniers <ndesaulniers@google.com>

[ Upstream commit 8b95a7d90ce8160ac5cffd5bace6e2eba01a871e ]

There's a few instructions that GAS infers operands but Clang doesn't;
from what I can tell the Arm ARM doesn't say these are optional.

F5.1.257 TBB, TBH T1 Halfword variant
F5.1.238 STREXD T1 variant
F5.1.84 LDREXD T1 variant

Link: https://github.com/ClangBuiltLinux/linux/issues/1309

Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Jian Cai <jiancai@google.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/probes/kprobes/test-thumb.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/probes/kprobes/test-thumb.c b/arch/arm/probes/kprobes/test-thumb.c
index b683b4517458..4254391f3906 100644
--- a/arch/arm/probes/kprobes/test-thumb.c
+++ b/arch/arm/probes/kprobes/test-thumb.c
@@ -444,21 +444,21 @@ void kprobe_thumb32_test_cases(void)
 		"3:	mvn	r0, r0	\n\t"
 		"2:	nop		\n\t")
 
-	TEST_RX("tbh	[pc, r",7, (9f-(1f+4))>>1,"]",
+	TEST_RX("tbh	[pc, r",7, (9f-(1f+4))>>1,", lsl #1]",
 		"9:			\n\t"
 		".short	(2f-1b-4)>>1	\n\t"
 		".short	(3f-1b-4)>>1	\n\t"
 		"3:	mvn	r0, r0	\n\t"
 		"2:	nop		\n\t")
 
-	TEST_RX("tbh	[pc, r",12, ((9f-(1f+4))>>1)+1,"]",
+	TEST_RX("tbh	[pc, r",12, ((9f-(1f+4))>>1)+1,", lsl #1]",
 		"9:			\n\t"
 		".short	(2f-1b-4)>>1	\n\t"
 		".short	(3f-1b-4)>>1	\n\t"
 		"3:	mvn	r0, r0	\n\t"
 		"2:	nop		\n\t")
 
-	TEST_RRX("tbh	[r",1,9f, ", r",14,1,"]",
+	TEST_RRX("tbh	[r",1,9f, ", r",14,1,", lsl #1]",
 		"9:			\n\t"
 		".short	(2f-1b-4)>>1	\n\t"
 		".short	(3f-1b-4)>>1	\n\t"
@@ -471,10 +471,10 @@ void kprobe_thumb32_test_cases(void)
 
 	TEST_UNSUPPORTED("strexb	r0, r1, [r2]")
 	TEST_UNSUPPORTED("strexh	r0, r1, [r2]")
-	TEST_UNSUPPORTED("strexd	r0, r1, [r2]")
+	TEST_UNSUPPORTED("strexd	r0, r1, r2, [r2]")
 	TEST_UNSUPPORTED("ldrexb	r0, [r1]")
 	TEST_UNSUPPORTED("ldrexh	r0, [r1]")
-	TEST_UNSUPPORTED("ldrexd	r0, [r1]")
+	TEST_UNSUPPORTED("ldrexd	r0, r1, [r1]")
 
 	TEST_GROUP("Data-processing (shifted register) and (modified immediate)")
 
-- 
2.30.2


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

* [PATCH AUTOSEL 4.4 05/12] watchdog: Fix possible use-after-free in wdt_startup()
  2021-07-10 23:52 [PATCH AUTOSEL 4.4 01/12] pwm: spear: Don't modify HW state in .remove callback Sasha Levin
                   ` (2 preceding siblings ...)
  2021-07-10 23:52 ` [PATCH AUTOSEL 4.4 04/12] ARM: 9087/1: kprobes: test-thumb: fix for LLVM_IAS=1 Sasha Levin
@ 2021-07-10 23:52 ` Sasha Levin
  2021-07-10 23:52 ` [PATCH AUTOSEL 4.4 06/12] watchdog: sc520_wdt: Fix possible use-after-free in wdt_turnoff() Sasha Levin
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Sasha Levin @ 2021-07-10 23:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Zou Wei, Hulk Robot, Guenter Roeck, Wim Van Sebroeck,
	Sasha Levin, linux-watchdog

From: Zou Wei <zou_wei@huawei.com>

[ Upstream commit c08a6b31e4917034f0ed0cb457c3bb209576f542 ]

This module's remove path calls del_timer(). However, that function
does not wait until the timer handler finishes. This means that the
timer handler may still be running after the driver's remove function
has finished, which would result in a use-after-free.

Fix by calling del_timer_sync(), which makes sure the timer handler
has finished, and unable to re-schedule itself.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/1620716495-108352-1-git-send-email-zou_wei@huawei.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/watchdog/sbc60xxwdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/sbc60xxwdt.c b/drivers/watchdog/sbc60xxwdt.c
index 2eef58a0cf05..152db059d5aa 100644
--- a/drivers/watchdog/sbc60xxwdt.c
+++ b/drivers/watchdog/sbc60xxwdt.c
@@ -152,7 +152,7 @@ static void wdt_startup(void)
 static void wdt_turnoff(void)
 {
 	/* Stop the timer */
-	del_timer(&timer);
+	del_timer_sync(&timer);
 	inb_p(wdt_stop);
 	pr_info("Watchdog timer is now disabled...\n");
 }
-- 
2.30.2


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

* [PATCH AUTOSEL 4.4 06/12] watchdog: sc520_wdt: Fix possible use-after-free in wdt_turnoff()
  2021-07-10 23:52 [PATCH AUTOSEL 4.4 01/12] pwm: spear: Don't modify HW state in .remove callback Sasha Levin
                   ` (3 preceding siblings ...)
  2021-07-10 23:52 ` [PATCH AUTOSEL 4.4 05/12] watchdog: Fix possible use-after-free in wdt_startup() Sasha Levin
@ 2021-07-10 23:52 ` Sasha Levin
  2021-07-10 23:52 ` [PATCH AUTOSEL 4.4 07/12] watchdog: Fix possible use-after-free by calling del_timer_sync() Sasha Levin
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Sasha Levin @ 2021-07-10 23:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Zou Wei, Hulk Robot, Guenter Roeck, Wim Van Sebroeck,
	Sasha Levin, linux-watchdog

From: Zou Wei <zou_wei@huawei.com>

[ Upstream commit 90b7c141132244e8e49a34a4c1e445cce33e07f4 ]

This module's remove path calls del_timer(). However, that function
does not wait until the timer handler finishes. This means that the
timer handler may still be running after the driver's remove function
has finished, which would result in a use-after-free.

Fix by calling del_timer_sync(), which makes sure the timer handler
has finished, and unable to re-schedule itself.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/1620716691-108460-1-git-send-email-zou_wei@huawei.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/watchdog/sc520_wdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/sc520_wdt.c b/drivers/watchdog/sc520_wdt.c
index 1cfd3f6a13d5..08500db8324f 100644
--- a/drivers/watchdog/sc520_wdt.c
+++ b/drivers/watchdog/sc520_wdt.c
@@ -190,7 +190,7 @@ static int wdt_startup(void)
 static int wdt_turnoff(void)
 {
 	/* Stop the timer */
-	del_timer(&timer);
+	del_timer_sync(&timer);
 
 	/* Stop the watchdog */
 	wdt_config(0);
-- 
2.30.2


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

* [PATCH AUTOSEL 4.4 07/12] watchdog: Fix possible use-after-free by calling del_timer_sync()
  2021-07-10 23:52 [PATCH AUTOSEL 4.4 01/12] pwm: spear: Don't modify HW state in .remove callback Sasha Levin
                   ` (4 preceding siblings ...)
  2021-07-10 23:52 ` [PATCH AUTOSEL 4.4 06/12] watchdog: sc520_wdt: Fix possible use-after-free in wdt_turnoff() Sasha Levin
@ 2021-07-10 23:52 ` Sasha Levin
  2021-07-10 23:52 ` [PATCH AUTOSEL 4.4 08/12] ceph: remove bogus checks and WARN_ONs from ceph_set_page_dirty Sasha Levin
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Sasha Levin @ 2021-07-10 23:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Zou Wei, Hulk Robot, Guenter Roeck, Vladimir Zapolskiy,
	Wim Van Sebroeck, Sasha Levin, linux-watchdog, linux-arm-kernel

From: Zou Wei <zou_wei@huawei.com>

[ Upstream commit d0212f095ab56672f6f36aabc605bda205e1e0bf ]

This driver's remove path calls del_timer(). However, that function
does not wait until the timer handler finishes. This means that the
timer handler may still be running after the driver's remove function
has finished, which would result in a use-after-free.

Fix by calling del_timer_sync(), which makes sure the timer handler
has finished, and unable to re-schedule itself.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Vladimir Zapolskiy <vz@mleia.com>
Link: https://lore.kernel.org/r/1620802676-19701-1-git-send-email-zou_wei@huawei.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/watchdog/lpc18xx_wdt.c | 2 +-
 drivers/watchdog/w83877f_wdt.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/lpc18xx_wdt.c b/drivers/watchdog/lpc18xx_wdt.c
index ab7b8b185d99..fbdc0f32e666 100644
--- a/drivers/watchdog/lpc18xx_wdt.c
+++ b/drivers/watchdog/lpc18xx_wdt.c
@@ -309,7 +309,7 @@ static int lpc18xx_wdt_remove(struct platform_device *pdev)
 	unregister_restart_handler(&lpc18xx_wdt->restart_handler);
 
 	dev_warn(&pdev->dev, "I quit now, hardware will probably reboot!\n");
-	del_timer(&lpc18xx_wdt->timer);
+	del_timer_sync(&lpc18xx_wdt->timer);
 
 	watchdog_unregister_device(&lpc18xx_wdt->wdt_dev);
 	clk_disable_unprepare(lpc18xx_wdt->wdt_clk);
diff --git a/drivers/watchdog/w83877f_wdt.c b/drivers/watchdog/w83877f_wdt.c
index f0483c75ed32..4b52cf321747 100644
--- a/drivers/watchdog/w83877f_wdt.c
+++ b/drivers/watchdog/w83877f_wdt.c
@@ -170,7 +170,7 @@ static void wdt_startup(void)
 static void wdt_turnoff(void)
 {
 	/* Stop the timer */
-	del_timer(&timer);
+	del_timer_sync(&timer);
 
 	wdt_change(WDT_DISABLE);
 
-- 
2.30.2


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

* [PATCH AUTOSEL 4.4 08/12] ceph: remove bogus checks and WARN_ONs from ceph_set_page_dirty
  2021-07-10 23:52 [PATCH AUTOSEL 4.4 01/12] pwm: spear: Don't modify HW state in .remove callback Sasha Levin
                   ` (5 preceding siblings ...)
  2021-07-10 23:52 ` [PATCH AUTOSEL 4.4 07/12] watchdog: Fix possible use-after-free by calling del_timer_sync() Sasha Levin
@ 2021-07-10 23:52 ` Sasha Levin
  2021-07-10 23:52 ` [PATCH AUTOSEL 4.4 09/12] power: supply: charger-manager: add missing MODULE_DEVICE_TABLE Sasha Levin
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Sasha Levin @ 2021-07-10 23:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Jeff Layton, Matthew Wilcox, Ilya Dryomov, Sasha Levin, ceph-devel

From: Jeff Layton <jlayton@kernel.org>

[ Upstream commit 22d41cdcd3cfd467a4af074165357fcbea1c37f5 ]

The checks for page->mapping are odd, as set_page_dirty is an
address_space operation, and I don't see where it would be called on a
non-pagecache page.

The warning about the page lock also seems bogus.  The comment over
set_page_dirty() says that it can be called without the page lock in
some rare cases. I don't think we want to warn if that's the case.

Reported-by: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/ceph/addr.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index fbf383048409..26de74684c17 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -72,10 +72,6 @@ static int ceph_set_page_dirty(struct page *page)
 	struct inode *inode;
 	struct ceph_inode_info *ci;
 	struct ceph_snap_context *snapc;
-	int ret;
-
-	if (unlikely(!mapping))
-		return !TestSetPageDirty(page);
 
 	if (PageDirty(page)) {
 		dout("%p set_page_dirty %p idx %lu -- already dirty\n",
@@ -121,11 +117,7 @@ static int ceph_set_page_dirty(struct page *page)
 	page->private = (unsigned long)snapc;
 	SetPagePrivate(page);
 
-	ret = __set_page_dirty_nobuffers(page);
-	WARN_ON(!PageLocked(page));
-	WARN_ON(!page->mapping);
-
-	return ret;
+	return __set_page_dirty_nobuffers(page);
 }
 
 /*
-- 
2.30.2


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

* [PATCH AUTOSEL 4.4 09/12] power: supply: charger-manager: add missing MODULE_DEVICE_TABLE
  2021-07-10 23:52 [PATCH AUTOSEL 4.4 01/12] pwm: spear: Don't modify HW state in .remove callback Sasha Levin
                   ` (6 preceding siblings ...)
  2021-07-10 23:52 ` [PATCH AUTOSEL 4.4 08/12] ceph: remove bogus checks and WARN_ONs from ceph_set_page_dirty Sasha Levin
@ 2021-07-10 23:52 ` Sasha Levin
  2021-07-10 23:53 ` [PATCH AUTOSEL 4.4 10/12] power: supply: ab8500: " Sasha Levin
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Sasha Levin @ 2021-07-10 23:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Zou Wei, Hulk Robot, Sebastian Reichel, Sasha Levin

From: Zou Wei <zou_wei@huawei.com>

[ Upstream commit 073b5d5b1f9cc94a3eea25279fbafee3f4f5f097 ]

This patch adds missing MODULE_DEVICE_TABLE definition which generates
correct modalias for automatic loading of this driver when it is built
as an external module.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/power/charger-manager.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index 1ea5d1aa268b..6656f847ed93 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -1490,6 +1490,7 @@ static const struct of_device_id charger_manager_match[] = {
 	},
 	{},
 };
+MODULE_DEVICE_TABLE(of, charger_manager_match);
 
 static struct charger_desc *of_cm_parse_desc(struct device *dev)
 {
-- 
2.30.2


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

* [PATCH AUTOSEL 4.4 10/12] power: supply: ab8500: add missing MODULE_DEVICE_TABLE
  2021-07-10 23:52 [PATCH AUTOSEL 4.4 01/12] pwm: spear: Don't modify HW state in .remove callback Sasha Levin
                   ` (7 preceding siblings ...)
  2021-07-10 23:52 ` [PATCH AUTOSEL 4.4 09/12] power: supply: charger-manager: add missing MODULE_DEVICE_TABLE Sasha Levin
@ 2021-07-10 23:53 ` Sasha Levin
  2021-07-10 23:53 ` [PATCH AUTOSEL 4.4 11/12] virtio-blk: Fix memory leak among suspend/resume procedure Sasha Levin
  2021-07-10 23:53 ` [PATCH AUTOSEL 4.4 12/12] virtio_console: Assure used length from device is limited Sasha Levin
  10 siblings, 0 replies; 12+ messages in thread
From: Sasha Levin @ 2021-07-10 23:53 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Zou Wei, Hulk Robot, Sebastian Reichel, Sasha Levin

From: Zou Wei <zou_wei@huawei.com>

[ Upstream commit dfe52db13ab8d24857a9840ec7ca75eef800c26c ]

This patch adds missing MODULE_DEVICE_TABLE definition which generates
correct modalias for automatic loading of this driver when it is built
as an external module.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/power/ab8500_btemp.c   | 1 +
 drivers/power/ab8500_charger.c | 1 +
 drivers/power/ab8500_fg.c      | 1 +
 3 files changed, 3 insertions(+)

diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c
index 8f8044e1acf3..24732df01cf9 100644
--- a/drivers/power/ab8500_btemp.c
+++ b/drivers/power/ab8500_btemp.c
@@ -1186,6 +1186,7 @@ static const struct of_device_id ab8500_btemp_match[] = {
 	{ .compatible = "stericsson,ab8500-btemp", },
 	{ },
 };
+MODULE_DEVICE_TABLE(of, ab8500_btemp_match);
 
 static struct platform_driver ab8500_btemp_driver = {
 	.probe = ab8500_btemp_probe,
diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c
index 98724c3a28e5..1a7013ec0caf 100644
--- a/drivers/power/ab8500_charger.c
+++ b/drivers/power/ab8500_charger.c
@@ -3756,6 +3756,7 @@ static const struct of_device_id ab8500_charger_match[] = {
 	{ .compatible = "stericsson,ab8500-charger", },
 	{ },
 };
+MODULE_DEVICE_TABLE(of, ab8500_charger_match);
 
 static struct platform_driver ab8500_charger_driver = {
 	.probe = ab8500_charger_probe,
diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c
index d91111200dde..c58b496ca05a 100644
--- a/drivers/power/ab8500_fg.c
+++ b/drivers/power/ab8500_fg.c
@@ -3239,6 +3239,7 @@ static const struct of_device_id ab8500_fg_match[] = {
 	{ .compatible = "stericsson,ab8500-fg", },
 	{ },
 };
+MODULE_DEVICE_TABLE(of, ab8500_fg_match);
 
 static struct platform_driver ab8500_fg_driver = {
 	.probe = ab8500_fg_probe,
-- 
2.30.2


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

* [PATCH AUTOSEL 4.4 11/12] virtio-blk: Fix memory leak among suspend/resume procedure
  2021-07-10 23:52 [PATCH AUTOSEL 4.4 01/12] pwm: spear: Don't modify HW state in .remove callback Sasha Levin
                   ` (8 preceding siblings ...)
  2021-07-10 23:53 ` [PATCH AUTOSEL 4.4 10/12] power: supply: ab8500: " Sasha Levin
@ 2021-07-10 23:53 ` Sasha Levin
  2021-07-10 23:53 ` [PATCH AUTOSEL 4.4 12/12] virtio_console: Assure used length from device is limited Sasha Levin
  10 siblings, 0 replies; 12+ messages in thread
From: Sasha Levin @ 2021-07-10 23:53 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Xie Yongji, Jason Wang, Michael S . Tsirkin, Sasha Levin,
	virtualization, linux-block

From: Xie Yongji <xieyongji@bytedance.com>

[ Upstream commit b71ba22e7c6c6b279c66f53ee7818709774efa1f ]

The vblk->vqs should be freed before we call init_vqs()
in virtblk_restore().

Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Link: https://lore.kernel.org/r/20210517084332.280-1-xieyongji@bytedance.com
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/block/virtio_blk.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index bdc3efacd0d2..2bcc2bc64149 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -808,6 +808,8 @@ static int virtblk_freeze(struct virtio_device *vdev)
 	blk_mq_stop_hw_queues(vblk->disk->queue);
 
 	vdev->config->del_vqs(vdev);
+	kfree(vblk->vqs);
+
 	return 0;
 }
 
-- 
2.30.2


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

* [PATCH AUTOSEL 4.4 12/12] virtio_console: Assure used length from device is limited
  2021-07-10 23:52 [PATCH AUTOSEL 4.4 01/12] pwm: spear: Don't modify HW state in .remove callback Sasha Levin
                   ` (9 preceding siblings ...)
  2021-07-10 23:53 ` [PATCH AUTOSEL 4.4 11/12] virtio-blk: Fix memory leak among suspend/resume procedure Sasha Levin
@ 2021-07-10 23:53 ` Sasha Levin
  10 siblings, 0 replies; 12+ messages in thread
From: Sasha Levin @ 2021-07-10 23:53 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Xie Yongji, Jason Wang, Michael S . Tsirkin, Sasha Levin, virtualization

From: Xie Yongji <xieyongji@bytedance.com>

[ Upstream commit d00d8da5869a2608e97cfede094dfc5e11462a46 ]

The buf->len might come from an untrusted device. This
ensures the value would not exceed the size of the buffer
to avoid data corruption or loss.

Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Link: https://lore.kernel.org/r/20210525125622.1203-1-xieyongji@bytedance.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/char/virtio_console.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 226ccb7891d4..c2f1c921cb2c 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -487,7 +487,7 @@ static struct port_buffer *get_inbuf(struct port *port)
 
 	buf = virtqueue_get_buf(port->in_vq, &len);
 	if (buf) {
-		buf->len = len;
+		buf->len = min_t(size_t, len, buf->size);
 		buf->offset = 0;
 		port->stats.bytes_received += len;
 	}
@@ -1752,7 +1752,7 @@ static void control_work_handler(struct work_struct *work)
 	while ((buf = virtqueue_get_buf(vq, &len))) {
 		spin_unlock(&portdev->c_ivq_lock);
 
-		buf->len = len;
+		buf->len = min_t(size_t, len, buf->size);
 		buf->offset = 0;
 
 		handle_control_message(vq->vdev, portdev, buf);
-- 
2.30.2


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

end of thread, other threads:[~2021-07-10 23:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-10 23:52 [PATCH AUTOSEL 4.4 01/12] pwm: spear: Don't modify HW state in .remove callback Sasha Levin
2021-07-10 23:52 ` [PATCH AUTOSEL 4.4 02/12] power: supply: ab8500: Avoid NULL pointers Sasha Levin
2021-07-10 23:52 ` [PATCH AUTOSEL 4.4 03/12] power: reset: gpio-poweroff: add missing MODULE_DEVICE_TABLE Sasha Levin
2021-07-10 23:52 ` [PATCH AUTOSEL 4.4 04/12] ARM: 9087/1: kprobes: test-thumb: fix for LLVM_IAS=1 Sasha Levin
2021-07-10 23:52 ` [PATCH AUTOSEL 4.4 05/12] watchdog: Fix possible use-after-free in wdt_startup() Sasha Levin
2021-07-10 23:52 ` [PATCH AUTOSEL 4.4 06/12] watchdog: sc520_wdt: Fix possible use-after-free in wdt_turnoff() Sasha Levin
2021-07-10 23:52 ` [PATCH AUTOSEL 4.4 07/12] watchdog: Fix possible use-after-free by calling del_timer_sync() Sasha Levin
2021-07-10 23:52 ` [PATCH AUTOSEL 4.4 08/12] ceph: remove bogus checks and WARN_ONs from ceph_set_page_dirty Sasha Levin
2021-07-10 23:52 ` [PATCH AUTOSEL 4.4 09/12] power: supply: charger-manager: add missing MODULE_DEVICE_TABLE Sasha Levin
2021-07-10 23:53 ` [PATCH AUTOSEL 4.4 10/12] power: supply: ab8500: " Sasha Levin
2021-07-10 23:53 ` [PATCH AUTOSEL 4.4 11/12] virtio-blk: Fix memory leak among suspend/resume procedure Sasha Levin
2021-07-10 23:53 ` [PATCH AUTOSEL 4.4 12/12] virtio_console: Assure used length from device is limited 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).