Message ID | 20231106233408.51159-4-sj@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 ED463C4332F for <linux-mm@archiver.kernel.org>; Mon, 6 Nov 2023 23:34:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D3ACE6B025A; Mon, 6 Nov 2023 18:34:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C27B46B025C; Mon, 6 Nov 2023 18:34:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A9D986B025E; Mon, 6 Nov 2023 18:34:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 99F186B025A for <linux-mm@kvack.org>; Mon, 6 Nov 2023 18:34:19 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 6DB4D140955 for <linux-mm@kvack.org>; Mon, 6 Nov 2023 23:34:19 +0000 (UTC) X-FDA: 81429135438.17.B6A41E6 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf30.hostedemail.com (Postfix) with ESMTP id 4E30780011 for <linux-mm@kvack.org>; Mon, 6 Nov 2023 23:34:16 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=D1wTspPU; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf30.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1699313657; 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=ED/5VRqDjeQ3vhbsBXBAmAewjBcby2wVIAxcWWWm3uU=; b=cLoLDGpTlLSHfK+BcW+WlBNAznGs0JgJPW2TQRm72XyHQ37OUXWtq+TC2LLK3BpV3Be/kS V30bcO2UprE+Xe29CR8vM1/w02FJZucxq6q2hv44fth+WF6WUrIIYel1Ea4QmY37D3EdX7 TO6QupvifhCvpcY6M+tuEU1RwbBz7NQ= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=D1wTspPU; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf30.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1699313657; a=rsa-sha256; cv=none; b=ecnKcn8JQfMXZnuTnBXv3ZSaLefdHwQ+TWt6F5j1+6E009gI1rLLzCL/mhga79JiBoSZFc se0MAKM0w0iABDYnj+iNTN/mTk45jLbEYtshzdV3VVIBbnNQcoDWL7egCMl+L47hlePska fW0oSF9JOrDjVZQN+LLxUZQ450kDJ+4= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 7BAADCE0E33; Mon, 6 Nov 2023 23:34:14 +0000 (UTC) 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-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 4E30780011 X-Stat-Signature: utfzf19fgdd13p7j7ypxm3jj89k1sfh9 X-HE-Tag: 1699313656-924233 X-HE-Meta: U2FsdGVkX180zTDYZ6//ZpzRw0rGVPHO6zsiC7/204hmkFgAHipSSM8U59qIjB7A00vkwWIJa/ivmUS3zOI+qETbpIjtRXx8HrirYqGsOquGgRhQaUUPA3eovkxrRMyyprdSXWdfvZcho6zcnc3vP9atIBL25MaIdeGIku4qRrfHKHGUOVcB2lLPngNFv7Upx4cg39+wxmhhOdOK9bQ0BstnfbaQNtW4x2WU6M907bmMbuLciz2F+d421bQpYi3h1iEJheLrcaVkEoksmdvs6zIXffmehiOl/8YO9yzc39Ge+eltBZZlcAwxaw60RA31KqIAMGbQ3OrnhUSKn0+PgkEmbIsjvlYmI6N87lfW5u/E6lO0yul4tPlVCUKZkrHIx31dpOdEnt0gjHSNzDyXts3pGkkqN2mqh8tkRp4AJSeq2JZqd2MEwvqAnGtHY7DQnoOvPDK7CbTc5SwNGV9+TFnD8LLPxH5HCSdZkf19jLU8BVrFdSJJGFm9PmGqlUbf0+5Fwwys24FOmjXsghHoVvTq7b6Ey/For1xdtxrpRjG3fipsa9M4jjY0UkSYWjrOz/MOAOV7hT3dwM7e0w4o7KKVChTqZmEdBIS+EAr+gEEOABHk2FIz6WQoyku1Lo7jbxpMZX7jO8qiJfmYeRThYN62JJqIztGQvypcibF0JqSteRgYWXD2LMZ/c+bSpbYo4/ewgGZJpjEA3hpbwTiSXbYJw9qUQAsCm+DIfQyOdkPmkCX3GmU1bEr1lDP512JcbaBoPTkHq+VSnr4/DcZDbLcJ7I9ZP1G4m4+zFwXDau+jY4U7KF6mzEYvT6LKC17o39trfVOfqutQIYlOuJJIGMRdI4yEIoGfgtXkINhKkGFJbuZYYUfiRIDCcXMnhm9AHoZ/rXci7t2afuiIRkBnrZQZy35tFuGiuSvTVMqqUtt8q89/JRNWUuDe4CsHG56cHFiHsBQg8Vhd5wx3ob9 7hQOpQ6r +j/o+EAXP9jsSuLLoHHcrijlrYiW3ei4XvcPn3GkWy3JGBHb7cShJzfXYvEKVuQQz6zua0i4R9ajyIffXv4+XIV7ytsOA39FzuHImY+d2JIk9R0qfDrDDBKVBNBgliIHyaGRNgNlwsMQs/idz/z7y03xyk9C7xFjTkhHF6Tu84dE3WxMdh924mK9wT63nDQYVqHpQAjbK/LxQf0BTsniB25EqMfBTI7VvURoueA1YpNdLHPM= 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
mm/damon/sysfs: fix unhandled return values
|
expand
|
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,
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(+)