Message ID | 20231106233408.51159-4-sj@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp2991891vqu; Mon, 6 Nov 2023 15:34:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IFKbz5VU8eS/1o2RWIDxRrjOZ4ShCSRVPLlIPmjTeiv0rnD+0o/aO0rGGcYpTRQ+s48orad X-Received: by 2002:a05:6e02:1d11:b0:352:a2f8:999a with SMTP id i17-20020a056e021d1100b00352a2f8999amr1463014ila.3.1699313667613; Mon, 06 Nov 2023 15:34:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699313667; cv=none; d=google.com; s=arc-20160816; b=sYjul97mBgbKNHbsXMMZ2t8P3/fETGcfMs046eWBAnzLNsK1QKOLzLybLGrQUU+Z8G nvDVZ9Du/4KaeZ5nZbqMdFGWTbX96bC3bSfcAtUAgjYV88+SdQrmDvmOqcKD7/rlcI7I N6q4czXux9Nby+j8wmVPf3Pb08g1C7WoBNY7fSSwIJswvramYWLxIAqj8JdP+5qvzcRn li0dj6t35CeqlYwoXMSOB3wRc8nVKJU7Vw3PgtZtXEvjoqeu1jpxQ+N7Xt6iK/G4O8VF QfurO7jNdy8XgApVr8SQua2+0HW8/gEnP7uK03vyjXVVCMA6NEgJ858Z6F/zQZmPkJpP 3s4w== 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=ED/5VRqDjeQ3vhbsBXBAmAewjBcby2wVIAxcWWWm3uU=; fh=WXAAPMfSxLmsB2WJ8A0s7FPd+eTotx5bYas/XF5lzN4=; b=zz9qcvY4Ud2eKqIKHeDyjaRSR+HxAEFTypPom31q5ETrDx727x38PSFa2PHWgmuzVz kxVzIvA/MBdwd44Hg/xlwVlU/SZKQ7NZWwX6fKJBaiqvBbfx8qQkQ7+wZDHrqvJ4VE/2 obuRnAAeRmMhXSzYdMx6P2lhB0eXjLWgejHCZTD/kv5vGuENJrKMJV+BGPTPZ9d7l4bt V/cHYkAeFNUV5GgJ6jWhqtCRrzxhF6EHFzsKvos8JixS9yxMK8eKS489t6MDzACcPVI4 zC+PRwkCrlqCRU4E91jG4Gefmt1+bQlHuMEZRSZUG8CaSIOydLUomboWTZL1GenNCTG1 8tHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=D1wTspPU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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. [23.128.96.37]) by mx.google.com with ESMTPS id bq7-20020a056a02044700b00578eafd0826si883112pgb.398.2023.11.06.15.34.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 15:34:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=D1wTspPU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 717FC81043B6; Mon, 6 Nov 2023 15:34:26 -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 S233438AbjKFXeU (ORCPT <rfc822;heyuhang3455@gmail.com> + 33 others); Mon, 6 Nov 2023 18:34:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233321AbjKFXeQ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 6 Nov 2023 18:34:16 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17C6983; Mon, 6 Nov 2023 15:34:14 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55F12C433CA; Mon, 6 Nov 2023 23:34:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1699313653; bh=19smz8vjkknnlftKxQDFJP/XhxeknF20W/DyGkIS8Os=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D1wTspPUeGLo6x8Q/O1NGf9r8R7Y77Rea13Em+t/uPG+M8MB1RkYbqzvbkzEFu/2o +EbJZr5EpmuJNr37DT7pK4w7FQz0S3gGCgTdLEjwu0j0llYH7NAk8oU5KIZyMrGTDa xU8ou+PE7Hw8IjLv9dyB+hxXwQngY+1i+Ioz1CMmAr4QR9KqCjMOtErZW426EoDG0n ZWwH3Jx6nAAnd11/pOFJY9vSHUNoDTRFu1AngsTYsvE2korQlJDZmaQT6CsbPoIwr5 yzi1Mp+MivvdfbKoUGQsKHXEJT583q7JL2Znk9lwUlXiHrruB3lltIK3NLWFk4pDhE SzPy2Mk286CAw== From: SeongJae Park <sj@kernel.org> To: Andrew Morton <akpm@linux-foundation.org> Cc: SeongJae Park <sj@kernel.org>, damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 3/3] mm/damon/sysfs-schemes: handle tried region directory allocation failure Date: Mon, 6 Nov 2023 23:34:08 +0000 Message-Id: <20231106233408.51159-4-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=-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: <linux-kernel.vger.kernel.org> 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:26 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781859528113413670 X-GMAIL-MSGID: 1781859528113413670 |
Series |
mm/damon/sysfs: fix unhandled return values
|
|
Commit Message
SeongJae Park
Nov. 6, 2023, 11:34 p.m. UTC
DAMON sysfs interface's before_damos_apply callback
(damon_sysfs_before_damos_apply()), which creates the DAMOS tried
regions for each DAMOS action applied region, is not handling the
allocation failure for the sysfs directory data. As a result, NULL
pointer derefeence is possible. Fix it by handling the case.
Fixes: f1d13cacabe1 ("mm/damon/sysfs: implement DAMOS tried regions update command")
Cc: <stable@vger.kernel.org> # 6.2.x
Signed-off-by: SeongJae Park <sj@kernel.org>
---
mm/damon/sysfs-schemes.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index 7413cb35c5a9..be667236b8e6 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -1826,6 +1826,8 @@ static int damon_sysfs_before_damos_apply(struct damon_ctx *ctx, return 0; region = damon_sysfs_scheme_region_alloc(r); + if (!region) + return 0; list_add_tail(®ion->list, &sysfs_regions->regions_list); sysfs_regions->nr_regions++; if (kobject_init_and_add(®ion->kobj,