From patchwork Mon Nov 6 23:34:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13447594 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 A6839C4708E for ; Mon, 6 Nov 2023 23:34:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 40FF96B0255; Mon, 6 Nov 2023 18:34:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 34B1B6B0256; Mon, 6 Nov 2023 18:34:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1767C6B0258; Mon, 6 Nov 2023 18:34:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 05C3B6B0255 for ; Mon, 6 Nov 2023 18:34:15 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id CEF17C084F for ; Mon, 6 Nov 2023 23:34:14 +0000 (UTC) X-FDA: 81429135228.29.643E950 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf11.hostedemail.com (Postfix) with ESMTP id 16BB140005 for ; Mon, 6 Nov 2023 23:34:12 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=UyoPvSX0; spf=pass (imf11.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1699313653; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=bjxQ1LmSyqWFZikG6cYNs/ewKsq9df3Hd0LideRpIcQ=; b=H4UGAkrobJUvRiypnMbL5XBAiHu4vcUaTCq1LLhHF8p/NEAwb8EUsW/86v7/M6FVUV+ZjY 80wJVueLGcrmXn+LXwCRCvBzi+xJU3M5RZ0tSDvsh607D5zTRfAXqyznuIptFz15S3/U1I 5XXCKYGVv3kUWR1r9HLaIyuRS+YSeaM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1699313653; a=rsa-sha256; cv=none; b=0m4lN8xqu2weFDPRKyGGSVBUsO1nsRLxBxCABfE/caamCwgmQ/jz5JrfodGFBjs1UYECAU SC6ugaGLb+pA8YNvhPDf0uICoUh6p9aySR0d0UVqFeSrEBAtlgeBiny5Q67nfU3/GuYeCm y/PBx6RR4JA8aMMpRylWOSCK2Kxdsik= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=UyoPvSX0; spf=pass (imf11.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id D8374B811E1; Mon, 6 Nov 2023 23:34:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D15AEC433C8; Mon, 6 Nov 2023 23:34:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1699313651; bh=MtIChiGlAMl9WTJvVSRQmuDT6RxSD+NBrsKsO1Hl6Io=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UyoPvSX0uc/PWJFKoa+VUDxKq/E/FXknGdVXc5LledMo3lXe9IT0oRt5RQemS8eDn ofZwHuP518ZGSpd/p2iBOmqYK51qD8Jfy+GUrzPHxN3Efbc12q8lf3CyJVlx5SCaeE yyTR10BkFHQeE4KhahwXsPuOaDPe+rBdNAWYOwCW6mxNfkOc3H8kz/nw9ziN3Td/B8 ccVLiR9YzBxtkhVjVtOTIIqYPB4+2MiBrqNyFMGGVzs2/Q+OeJiPYZYodODtGKExOQ eRaMsQXN36VQLRMi6tPFYVJJYI+AA75HN3DJf9l/fg/xDKdWUtd7iRuYq0d/eUxfZz YOYXIHDrJhrhA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 1/3] mm/damon/sysfs: check error from damon_sysfs_update_target() Date: Mon, 6 Nov 2023 23:34:06 +0000 Message-Id: <20231106233408.51159-2-sj@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231106233408.51159-1-sj@kernel.org> References: <20231106233408.51159-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 16BB140005 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: bj6rj9insmaptwe8psbq8omokfgx6uu6 X-HE-Tag: 1699313652-299381 X-HE-Meta: U2FsdGVkX1/OFxxNbMUDbwtZCPkuwU/Sj/PFixoFCymlKvhVjxBSGdGiB+HNqZuX5Iadbl2cNRryjOOqLPvGatPWpZsX8sNpFeVFHiLAj8iAenRllB3uxt02ng3hPcSDObF6VqLCyo9KP1MeFbsHXO4XZMYvDIOkVqrR8XzItlZBoJtICad3zvApTFByq53tqGzxY8lLM9BzApSF9yPzB9CVaM/s28P7avjkrXRh98xDB9CySABh6MDRBjHml6x6rBY8oqyn3c6d4YnGs7z0nbYg2pU/fCpMBRTzRYTT/NklLV4TPIcd7liVUly5CKM2NFmfybJysuoS9a5iyCiFXji9aXv/wurWzlHpMIQYFufTqa7f4cVVp9S7LBUwfcXiZnKb9Uug1f+C4CRj+WKfXEgqTqZ1vp11uuJft1wROTX6/vbODaZTHvUOx7jRiqVtz93jR7q4yPMiCDOEAh37aWqKBnSHlTuG+DZ1psA1o5PCGXvAerp4IbiJNzbezUS8b2lxfkHFNm9ZCkmd4ken9JAhz+O+VClsJHvrQss7HMYtr2+/9G75r2X90MRpEv+WSIvr5QjXzmpMBd4UluTtkdabXv5EePEzxRpsr/7h6HyU7kg67ZkfLr2QQTotHd+1JifvtqGmDLHyyLbF6C9qb3Cr25cgwTUTZrxsywPrGI/COmrlzHtuXvrcWqtJUdyFfGfbVt5tJttRUIDGL+ixE1Lq7coi02v6RHkJ6sgmZXZUuU4Z7b5VCv7Pq6p3gHxRqBJ8HJqCVVZRq7KDycfyySDf6zU+7mhCmp+bT/z841uVG1xTozVT6g63YtC6vCGLF38kT56+pix646fGP/OycD+bHfgWbkYihZ//8Xivxmlt142tvlXD0Ddi10+YcAZOy+CqvQ9hLh2gi4qEOirkNViAbxVey+NbIvMfw1FOo0q07QeH5cj5hrFHtH4AnkgaZosmPq0CFzrKldMga+0 PlMXXsl0 4M52EJelrHh8+gNdth0Vm8/igHBO3i8jDAd23btysMOUcSWZyAzsPx/pXAyit2+UhCPQQ6GlQ5zTom4a6MuhpJQaPXk01kFzrmb4etUoGaI1WS+h1nfwFgMew/zHrG1W9BICdU9UH95DnB/ZvjGzFq1i3PlEwOpn8v9jBRZJT8UqA+WiGYK2VpT1Tb/IzyaibCwcUS6qKUSY//6erOCm/rYmgDsa85k/JqKqnlpzmRvFjxAKNR9a0dY+T2i/IfooWR5k1RUS5OJuZeg/3JdNE58uk8g== 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: List-Subscribe: List-Unsubscribe: damon_sysfs_update_target() returns error code for failures, but its caller, damon_sysfs_set_targets() is ignoring that. The update function seems making no critical change in case of such failures, but the behavior will look like DAMON sysfs is silently ignoring or only partially accepting the user input. Fix it. Fixes: 19467a950b49 ("mm/damon/sysfs: remove requested targets when online-commit inputs") Cc: # 5.19.x Signed-off-by: SeongJae Park --- Note that yet another fix[1] should be applied before this. [1] https://lore.kernel.org/all/739e6aaf-a634-4e33-98a8-16546379ec9f@moroto.mountain/ mm/damon/sysfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index 1dfa96d4de99..7472404456aa 100644 --- a/mm/damon/sysfs.c +++ b/mm/damon/sysfs.c @@ -1203,8 +1203,10 @@ static int damon_sysfs_set_targets(struct damon_ctx *ctx, damon_for_each_target_safe(t, next, ctx) { if (i < sysfs_targets->nr) { - damon_sysfs_update_target(t, ctx, + err = damon_sysfs_update_target(t, ctx, sysfs_targets->targets_arr[i]); + if (err) + return err; } else { if (damon_target_has_pid(ctx)) put_pid(t->pid);