From 8edb589abf5c5221df0491fc7450ce0da89d0eb0 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Tue, 14 Jan 2020 17:18:55 -0800 Subject: [PATCH] mhi: core: Treat MHI_ASSERT as fatal error Currently MHI_ASSERT causes kernel panic in debug mode. In performance mode it just prints warning and continues. This can cause memory over-read, out of bound memory read. All the places driver is asserting need to result into a kernel panic to root cause the issue and prevent unwanted memory access. Change-Id: Ica8e1fec7be916621398cd4c5f8bfa6718c33d72 Signed-off-by: Hemant Kumar --- drivers/bus/mhi/core/mhi_internal.h | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/bus/mhi/core/mhi_internal.h b/drivers/bus/mhi/core/mhi_internal.h index da76271371c3..0c50be382507 100644 --- a/drivers/bus/mhi/core/mhi_internal.h +++ b/drivers/bus/mhi/core/mhi_internal.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. */ +/* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #include @@ -919,22 +919,9 @@ irqreturn_t mhi_intvec_threaded_handlr(int irq_number, void *dev); irqreturn_t mhi_intvec_handlr(int irq_number, void *dev); void mhi_ev_task(unsigned long data); -#ifdef CONFIG_MHI_DEBUG - -#define MHI_ASSERT(cond, msg) do { \ +#define MHI_ASSERT(cond, fmt, ...) do { \ if (cond) \ - panic(msg); \ + panic(fmt); \ } while (0) -#else - -#define MHI_ASSERT(cond, msg) do { \ - if (cond) { \ - MHI_ERR(msg); \ - WARN_ON(cond); \ - } \ -} while (0) - -#endif - #endif /* _MHI_INT_H */