kcsan: Use GFP_ATOMIC under spin lock
authorWei Yongjun <weiyongjun1@huawei.com>
Fri, 17 Apr 2020 02:58:37 +0000 (02:58 +0000)
committerPaul E. McKenney <paulmck@kernel.org>
Mon, 27 Apr 2020 18:10:10 +0000 (11:10 -0700)
A spin lock is held in insert_report_filterlist(), so the krealloc()
should use GFP_ATOMIC.  This commit therefore makes this change.

Reviewed-by: Marco Elver <elver@google.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
kernel/kcsan/debugfs.c

index 1a08664a7fabb24f6af1d2e9312dba8b177e9e7f..023e49c58d55ec48c9e559e63429db87e17dc3fa 100644 (file)
@@ -230,7 +230,7 @@ static ssize_t insert_report_filterlist(const char *func)
                /* initial allocation */
                report_filterlist.addrs =
                        kmalloc_array(report_filterlist.size,
-                                     sizeof(unsigned long), GFP_KERNEL);
+                                     sizeof(unsigned long), GFP_ATOMIC);
                if (report_filterlist.addrs == NULL) {
                        ret = -ENOMEM;
                        goto out;
@@ -240,7 +240,7 @@ static ssize_t insert_report_filterlist(const char *func)
                size_t new_size = report_filterlist.size * 2;
                unsigned long *new_addrs =
                        krealloc(report_filterlist.addrs,
-                                new_size * sizeof(unsigned long), GFP_KERNEL);
+                                new_size * sizeof(unsigned long), GFP_ATOMIC);
 
                if (new_addrs == NULL) {
                        /* leave filterlist itself untouched */