diff --git a/mm/kasan/report.c b/mm/kasan/report.c index d3577f70e90e..12de00a3cbd4 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -125,6 +125,8 @@ static DEFINE_SPINLOCK(report_lock); static void start_report(unsigned long *flags, bool sync) { + /* Respect the /proc/sys/kernel/traceoff_on_warning interface. */ + disable_trace_on_warning(); /* Update status of the currently running KASAN test. */ update_kunit_status(sync); /* Make sure we don't end up in loop. */ @@ -408,7 +410,6 @@ static void __kasan_report(unsigned long addr, size_t size, bool is_write, void *untagged_addr; unsigned long flags; - disable_trace_on_warning(); start_report(&flags, true); tagged_addr = (void *)addr;