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: 162229 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp2991845vqu; Mon, 6 Nov 2023 15:34:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IGKcgDlnSAqdzTn/niENkr1ObErn93ERIC/nGsPpW3Jz7jQ5aY2pC7P6d/Ua6qHoe7hH2Dn X-Received: by 2002:a17:903:22cd:b0:1cc:4fe8:c6c6 with SMTP id y13-20020a17090322cd00b001cc4fe8c6c6mr1433637plg.6.1699313659088; Mon, 06 Nov 2023 15:34:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699313659; cv=none; d=google.com; s=arc-20160816; b=P3SRm6jbgIWQFffQVDgLamQylBYEOyqfFUs5mMfHFMcKWRXLYcRVGa4B9AdYvEJNer DitsFZ5MBOAgI04twcruwHvqVZbw0RRSs9TkH/H4MapZQrGfaughwaxkcHBoKw0IB0P5 jmhRSxSTeZQ2jJad0NFHMMGPHHBYloRw48KgCffWGwzTIBaMKkeDKmeWlgAus9UquqTP UcH2i7/9Z4LwW+oHMd+IEWTk7oQ3xHE4L1a1f8dtsEj//0vdKNBHswJm/qZMqF1tVw8u NRUjjL4xL9RMogsRxMKVxciVTCIql5mMnFvw+3KQBmiLzWraFgscPXN4/I7l+GWJKqMI lSJQ== 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 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id h17-20020a170902f7d100b001b7ea20dbf2si8782205plw.224.2023.11.06.15.34.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 15:34:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; 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 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 3FED880FA863; Mon, 6 Nov 2023 15:34:18 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233390AbjKFXeP (ORCPT + 33 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Mon, 06 Nov 2023 15:34:18 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781859519664064307 X-GMAIL-MSGID: 1781859519664064307 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);