pwm: spear: Don't modify HW state in .remove callback
Subsystems (5)
Sasha Levin
maintainerPATCH 1/12 pwm: spear: Don't modify HW state in .remove callback
From: Uwe Kleine-König <[email protected]>
[ 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.
--- drivers/pwm/pwm-spear.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/pwm/pwm-spear.c +0 -4
@@ -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);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 2/12 power: supply: ab8500: Avoid NULL pointers
From: Linus Walleij <[email protected]>
[ 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.
--- drivers/power/ab8500_charger.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/power/ab8500_charger.c +17 -1
@@ -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);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 3/12 power: reset: gpio-poweroff: add missing MODULE_DEVICE_TABLE
In reply to Sasha LevinFrom: Bixuan Cui <[email protected]>
[ 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.
--- drivers/power/reset/gpio-poweroff.c | 1 + 1 file changed, 1 insertion(+)
drivers/power/reset/gpio-poweroff.c +1 -0
@@ -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,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 4/12 ARM: 9087/1: kprobes: test-thumb: fix for LLVM_IAS=1
In reply to Sasha LevinFrom: Nick Desaulniers <[email protected]>
[ 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
--- arch/arm/probes/kprobes/test-thumb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm/probes/kprobes/test-thumb.c +5 -5
@@ -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)" )
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 5/12 watchdog: Fix possible use-after-free in wdt_startup()
In reply to Sasha LevinFrom: Zou Wei <[email protected]>
[ 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.
--- drivers/watchdog/sbc60xxwdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/sbc60xxwdt.c +1 -1
@@ -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" ); }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 6/12 watchdog: sc520_wdt: Fix possible use-after-free in wdt_turnoff()
In reply to Sasha LevinFrom: Zou Wei <[email protected]>
[ 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.
--- drivers/watchdog/sc520_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/sc520_wdt.c +1 -1
@@ -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 );
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 7/12 watchdog: Fix possible use-after-free by calling del_timer_sync()
In reply to Sasha LevinFrom: Zou Wei <[email protected]>
[ 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.
--- drivers/watchdog/lpc18xx_wdt.c | 2 +- drivers/watchdog/w83877f_wdt.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/watchdog/lpc18xx_wdt.c +1 -1
@@ -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);
drivers/watchdog/w83877f_wdt.c +1 -1
@@ -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 );
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 8/12 ceph: remove bogus checks and WARN_ONs from ceph_set_page_dirty
In reply to Sasha LevinFrom: Jeff Layton <[email protected]>
[ 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.
--- fs/ceph/addr.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
fs/ceph/addr.c +1 -9
@@ -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); }/*
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 9/12 power: supply: charger-manager: add missing MODULE_DEVICE_TABLE
In reply to Sasha LevinFrom: Zou Wei <[email protected]>
[ 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.
--- drivers/power/charger-manager.c | 1 + 1 file changed, 1 insertion(+)
drivers/power/charger-manager.c +1 -0
@@ -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) {
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 10/12 power: supply: ab8500: add missing MODULE_DEVICE_TABLE
In reply to Sasha LevinFrom: Zou Wei <[email protected]>
[ 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.
--- drivers/power/ab8500_btemp.c | 1 + drivers/power/ab8500_charger.c | 1 + drivers/power/ab8500_fg.c | 1 + 3 files changed, 3 insertions(+)
drivers/power/ab8500_btemp.c +1 -0
@@ -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,
drivers/power/ab8500_charger.c +1 -0
@@ -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,
drivers/power/ab8500_fg.c +1 -0
@@ -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,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 11/12 virtio-blk: Fix memory leak among suspend/resume procedure
In reply to Sasha LevinFrom: Xie Yongji <[email protected]>
[ Upstream commit b71ba22e7c6c6b279c66f53ee7818709774efa1f ]
The vblk->vqs should be freed before we call init_vqs() in virtblk_restore().
--- drivers/block/virtio_blk.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/block/virtio_blk.c +2 -0
@@ -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 ; }
Signature · 6 lines
2.30.2 _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Sasha Levin
maintainerPATCH 12/12 virtio_console: Assure used length from device is limited
In reply to Sasha LevinFrom: Xie Yongji <[email protected]>
[ 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.
--- drivers/char/virtio_console.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/virtio_console.c +2 -2
@@ -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);
Signature · 6 lines
2.30.2 _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization