Skip to content

Commit 6b8bb5b

Browse files
committed
Merge tag 'sh-for-v6.6-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/glaubitz/sh-linux
Pull sh updates from Adrian Glaubitz: - Fix a use-after-free bug in the push-switch driver (Duoming Zhou) - Fix calls to dma_declare_coherent_memory() that incorrectly passed the buffer end address instead of the buffer size as the size parameter * tag 'sh-for-v6.6-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/glaubitz/sh-linux: sh: push-switch: Reorder cleanup operations to avoid use-after-free bug sh: boards: Fix CEU buffer size passed to dma_declare_coherent_memory()
2 parents 1b37a0a + 246f80a commit 6b8bb5b

File tree

6 files changed

+8
-12
lines changed

6 files changed

+8
-12
lines changed

arch/sh/boards/mach-ap325rxa/setup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ static int __init ap325rxa_devices_setup(void)
531531
device_initialize(&ap325rxa_ceu_device.dev);
532532
dma_declare_coherent_memory(&ap325rxa_ceu_device.dev,
533533
ceu_dma_membase, ceu_dma_membase,
534-
ceu_dma_membase + CEU_BUFFER_MEMORY_SIZE - 1);
534+
CEU_BUFFER_MEMORY_SIZE);
535535

536536
platform_device_add(&ap325rxa_ceu_device);
537537

arch/sh/boards/mach-ecovec24/setup.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,15 +1454,13 @@ static int __init arch_setup(void)
14541454
device_initialize(&ecovec_ceu_devices[0]->dev);
14551455
dma_declare_coherent_memory(&ecovec_ceu_devices[0]->dev,
14561456
ceu0_dma_membase, ceu0_dma_membase,
1457-
ceu0_dma_membase +
1458-
CEU_BUFFER_MEMORY_SIZE - 1);
1457+
CEU_BUFFER_MEMORY_SIZE);
14591458
platform_device_add(ecovec_ceu_devices[0]);
14601459

14611460
device_initialize(&ecovec_ceu_devices[1]->dev);
14621461
dma_declare_coherent_memory(&ecovec_ceu_devices[1]->dev,
14631462
ceu1_dma_membase, ceu1_dma_membase,
1464-
ceu1_dma_membase +
1465-
CEU_BUFFER_MEMORY_SIZE - 1);
1463+
CEU_BUFFER_MEMORY_SIZE);
14661464
platform_device_add(ecovec_ceu_devices[1]);
14671465

14681466
gpiod_add_lookup_table(&cn12_power_gpiod_table);

arch/sh/boards/mach-kfr2r09/setup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ static int __init kfr2r09_devices_setup(void)
603603
device_initialize(&kfr2r09_ceu_device.dev);
604604
dma_declare_coherent_memory(&kfr2r09_ceu_device.dev,
605605
ceu_dma_membase, ceu_dma_membase,
606-
ceu_dma_membase + CEU_BUFFER_MEMORY_SIZE - 1);
606+
CEU_BUFFER_MEMORY_SIZE);
607607

608608
platform_device_add(&kfr2r09_ceu_device);
609609

arch/sh/boards/mach-migor/setup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ static int __init migor_devices_setup(void)
604604
device_initialize(&migor_ceu_device.dev);
605605
dma_declare_coherent_memory(&migor_ceu_device.dev,
606606
ceu_dma_membase, ceu_dma_membase,
607-
ceu_dma_membase + CEU_BUFFER_MEMORY_SIZE - 1);
607+
CEU_BUFFER_MEMORY_SIZE);
608608

609609
platform_device_add(&migor_ceu_device);
610610

arch/sh/boards/mach-se/7724/setup.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -940,15 +940,13 @@ static int __init devices_setup(void)
940940
device_initialize(&ms7724se_ceu_devices[0]->dev);
941941
dma_declare_coherent_memory(&ms7724se_ceu_devices[0]->dev,
942942
ceu0_dma_membase, ceu0_dma_membase,
943-
ceu0_dma_membase +
944-
CEU_BUFFER_MEMORY_SIZE - 1);
943+
CEU_BUFFER_MEMORY_SIZE);
945944
platform_device_add(ms7724se_ceu_devices[0]);
946945

947946
device_initialize(&ms7724se_ceu_devices[1]->dev);
948947
dma_declare_coherent_memory(&ms7724se_ceu_devices[1]->dev,
949948
ceu1_dma_membase, ceu1_dma_membase,
950-
ceu1_dma_membase +
951-
CEU_BUFFER_MEMORY_SIZE - 1);
949+
CEU_BUFFER_MEMORY_SIZE);
952950
platform_device_add(ms7724se_ceu_devices[1]);
953951

954952
return platform_add_devices(ms7724se_devices,

arch/sh/drivers/push-switch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ static int switch_drv_remove(struct platform_device *pdev)
101101
device_remove_file(&pdev->dev, &dev_attr_switch);
102102

103103
platform_set_drvdata(pdev, NULL);
104-
flush_work(&psw->work);
105104
timer_shutdown_sync(&psw->debounce);
105+
flush_work(&psw->work);
106106
free_irq(irq, pdev);
107107

108108
kfree(psw);

0 commit comments

Comments
 (0)