From patchwork Sun Nov 21 11:02:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 12630733 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AF1DC433EF for ; Sun, 21 Nov 2021 11:03:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 12ED76B0072; Sun, 21 Nov 2021 06:02:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0DF4F6B0073; Sun, 21 Nov 2021 06:02:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F0F986B0074; Sun, 21 Nov 2021 06:02:37 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0104.hostedemail.com [216.40.44.104]) by kanga.kvack.org (Postfix) with ESMTP id E37586B0072 for ; Sun, 21 Nov 2021 06:02:37 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id AAEB48CA5C for ; Sun, 21 Nov 2021 11:02:27 +0000 (UTC) X-FDA: 78832648734.29.F2EBA10 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf16.hostedemail.com (Postfix) with ESMTP id 50A83F00009F for ; Sun, 21 Nov 2021 11:02:24 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id A60C660E75; Sun, 21 Nov 2021 11:02:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637492546; bh=3WQ4Hy7C4N5e4Mvc456YSywZpMU1nWyWDKWdhSHcNnA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qnFzF2aA3uKsbVnIMdsR+RLFjNe1tXP0MbB5i1nVyhrrqjApWcsueb/B8SOzynnwY OEFmo/XVkpyCvv0aR8wZ4hzphjiT+uWsWQ8EsluTRaUuKaiOJBOomPN/3F1K74sjzx ymwiXeksCEmPM7dlaglJ9g4oai2za8L3UXKMGzqW01epFW/F3LFuJWpAOHdNASxI0l KmV1TpNCQY6tbn/QVYu4Cbfz27WIAlDPCHc2UW161w3w23MznuhnfKd6ADgVQiU17z SUZvMFRBD8WolDjiSSAjypWIJefIYIvDSaNXiGYvGEdwH/vbYrltN50AhVyPYqV4nC PflKb1MCumrmw== From: SeongJae Park To: stable@vger.kernel.org, gregkh@linuxfoundation.org Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park , Linus Torvalds Subject: [PATCH for-5.15.x 1/2] mm/damon/dbgfs: use '__GFP_NOWARN' for user-specified size buffer allocation Date: Sun, 21 Nov 2021 11:02:10 +0000 Message-Id: <20211121110211.17032-2-sj@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211121110211.17032-1-sj@kernel.org> References: <20211121110211.17032-1-sj@kernel.org> X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 50A83F00009F X-Stat-Signature: t3cnytrbgqek3cgb7e3j1sy8kttrqijh Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=qnFzF2aA; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf16.hostedemail.com: domain of sj@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=sj@kernel.org X-HE-Tag: 1637492544-577997 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: commit db7a347b26fe05d2e8c115bb24dfd908d0252bc3 upstream. 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 Cc: # 5.15.x Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- mm/damon/dbgfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/damon/dbgfs.c b/mm/damon/dbgfs.c index faee070977d8..2741ff79e8e8 100644 --- a/mm/damon/dbgfs.c +++ b/mm/damon/dbgfs.c @@ -32,7 +32,7 @@ static char *user_input_str(const char __user *buf, size_t count, loff_t *ppos) if (*ppos) return ERR_PTR(-EINVAL); - kbuf = kmalloc(count + 1, GFP_KERNEL); + kbuf = kmalloc(count + 1, GFP_KERNEL | __GFP_NOWARN); if (!kbuf) return ERR_PTR(-ENOMEM); @@ -247,7 +247,7 @@ static ssize_t dbgfs_kdamond_pid_read(struct file *file, char *kbuf; ssize_t len; - kbuf = kmalloc(count, GFP_KERNEL); + kbuf = kmalloc(count, GFP_KERNEL | __GFP_NOWARN); if (!kbuf) return -ENOMEM;