lkml.org 
[lkml]   [2018]   [Sep]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 4.4 45/47] MIPS: WARN_ON invalid DMA cache maintenance, not BUG_ON
    Date
    From: Paul Burton <paul.burton@imgtec.com>

    [ Upstream commit d4da0e97baea8768b3d66ccef3967bebd50dfc3b ]

    If a driver causes DMA cache maintenance with a zero length then we
    currently BUG and kill the kernel. As this is a scenario that we may
    well be able to recover from, WARN & return in the condition instead.

    Signed-off-by: Paul Burton <paul.burton@mips.com>
    Acked-by: Florian Fainelli <f.fainelli@gmail.com>
    Patchwork: https://patchwork.linux-mips.org/patch/14623/
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Cc: linux-mips@linux-mips.org
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    ---
    arch/mips/mm/c-r4k.c | 6 ++++--
    1 file changed, 4 insertions(+), 2 deletions(-)

    diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
    index 5d3a25e1cfae..52e8c2026853 100644
    --- a/arch/mips/mm/c-r4k.c
    +++ b/arch/mips/mm/c-r4k.c
    @@ -712,7 +712,8 @@ static void r4k_flush_icache_range(unsigned long start, unsigned long end)
    static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
    {
    /* Catch bad driver code */
    - BUG_ON(size == 0);
    + if (WARN_ON(size == 0))
    + return;

    preempt_disable();
    if (cpu_has_inclusive_pcaches) {
    @@ -745,7 +746,8 @@ static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
    static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
    {
    /* Catch bad driver code */
    - BUG_ON(size == 0);
    + if (WARN_ON(size == 0))
    + return;

    preempt_disable();
    if (cpu_has_inclusive_pcaches) {
    --
    2.17.1
    \
     
     \ /
      Last update: 2018-09-02 15:18    [W:2.100 / U:0.044 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site