Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2469127rdf; Mon, 6 Nov 2023 15:36:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJjI7q+9Eqzge7saoyUW4AZVUIM33+QNEjXqLnVryEQ75Trm+per2H/rydz6QLmDpNIsKe X-Received: by 2002:a05:6a20:7488:b0:17a:e981:7fe4 with SMTP id p8-20020a056a20748800b0017ae9817fe4mr1285351pzd.16.1699313795937; Mon, 06 Nov 2023 15:36:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699313795; cv=none; d=google.com; s=arc-20160816; b=1G5jhHGY65pZfza+0Jl60OcWLyNv/7z7LKFpGhB8mqTwKY/czCZxVSUYJBMUNPAHF7 w8vt8r1uYyZmP4lKSuSVi7gy4FXiJaMaC9PwUYC0I+fbimwuhLXVzPh6fntL/wh251+S ms0ardDnP0e9c39XYaYrtxDy2Si2x0jgsfoLFLuwl6Qlcl3iXJGh0T3vaxioMXHPGdRt 8siZLpOfO7A6xXxuksUgqKy5YtvuF5BSb46Shv8jVU5kEF7Ry/cbvpF5NVng37BWiI+h zjAZDmTyqaXIhn/IL4MRZsAJH7BiisYbtJhO3f1aATr1QfZibX0+lECgGRsei8TUH7SH Q2WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bjxQ1LmSyqWFZikG6cYNs/ewKsq9df3Hd0LideRpIcQ=; fh=WXAAPMfSxLmsB2WJ8A0s7FPd+eTotx5bYas/XF5lzN4=; b=VHlTJykluF9iyNWFIxOGpj6crvfav6Bd40kC6OrXne6rNm+jjkRHI63tnCAjZEmGr0 jfcy0mrBrXohuRHUeE06wstkhScqsQO8u+QigO7+9Rsm7BxjW6owQsOuNW58eoxJButL yMIKOeoYUmAaa6Yw2eKE219JRvzc7ORCgorb3O3rCO2LUxZBxnISjFnCGLAbQvyzfcTc rKg1rD0mr9OJgux/W5MdMXvFStMKg8H6NYD1q/k/Ns/erW5HplwE/SMpP5laPd35Fk9C hTsN8dXuvgOvfFLanDVorVpu8gMyUWu2efSB1MnVgL2KBl3vug4SZovNsf27R4r/wu9m ihQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UyoPvSX0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id i123-20020a639d81000000b005ab190f9504si751156pgd.602.2023.11.06.15.36.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 15:36:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UyoPvSX0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id A01928078C93; Mon, 6 Nov 2023 15:35:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233386AbjKFXeP (ORCPT + 99 others); Mon, 6 Nov 2023 18:34:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233321AbjKFXeN (ORCPT ); Mon, 6 Nov 2023 18:34:13 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90F9883; Mon, 6 Nov 2023 15:34:11 -0800 (PST) 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 06 Nov 2023 15:35:09 -0800 (PST) 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); -- 2.34.1