mm/damon/dbgfs: use '__GFP_NOWARN' for user-specified size buffer allocation
authorSeongJae Park <sj@kernel.org>
Sat, 20 Nov 2021 00:43:49 +0000 (16:43 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 20 Nov 2021 18:35:54 +0000 (10:35 -0800)
commitdb7a347b26fe05d2e8c115bb24dfd908d0252bc3
treeb123d99dbb6f6e783eaa1a9910d639fc82b57c4a
parentcab71f7495f7aa639ca4b8508f4c3e426e9cb2f7
mm/damon/dbgfs: use '__GFP_NOWARN' for user-specified size buffer allocation

Patch series "DAMON fixes".

This patch (of 2):

DAMON users can trigger below warning in '__alloc_pages()' by invoking
write() to some DAMON debugfs files with arbitrarily high count
argument, because DAMON debugfs interface allocates some buffers based
on the user-specified 'count'.

        if (unlikely(order >= MAX_ORDER)) {
                WARN_ON_ONCE(!(gfp & __GFP_NOWARN));
                return NULL;
        }

Because the DAMON debugfs interface code checks failure of the
'kmalloc()', this commit simply suppresses the warnings by adding
'__GFP_NOWARN' flag.

Link: https://lkml.kernel.org/r/20211110145758.16558-1-sj@kernel.org
Link: https://lkml.kernel.org/r/20211110145758.16558-2-sj@kernel.org
Fixes: 4bc05954d007 ("mm/damon: implement a debugfs-based user space interface")
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/damon/dbgfs.c