Message ID | 20221219171807.55708-2-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 D6EEFC4332F for <linux-mm@archiver.kernel.org>; Mon, 19 Dec 2022 17:18:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5BB328E0002; Mon, 19 Dec 2022 12:18:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 56B9F8E0001; Mon, 19 Dec 2022 12:18:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 433DC8E0002; Mon, 19 Dec 2022 12:18:18 -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 3377B8E0001 for <linux-mm@kvack.org>; Mon, 19 Dec 2022 12:18:18 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id DD4471409E2 for <linux-mm@kvack.org>; Mon, 19 Dec 2022 17:18:17 +0000 (UTC) X-FDA: 80259714234.21.6E96CEB Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf05.hostedemail.com (Postfix) with ESMTP id 21B6110001C for <linux-mm@kvack.org>; Mon, 19 Dec 2022 17:18:15 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=L7iuXB5Z; spf=pass (imf05.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 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=1671470296; 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=028VkuVj4jjygfiyG/8RNBMLnORgopVRbdgD0WylOOo=; b=hM+xao56OEFNaclPV2SaP7Mw650zoBe9NhD0/ui+aYHLfTEBb/D8cnfZ0+2Y1phUIKkrqg ZaO3kDBYfNZO6/qw515PcVaINonmpg/8oeI6Otv0ZxEqbSqMkkrRCFm22FGBP8bDvET+Lk sKn+Py7aUaGnQXhj5oNB1w0JVQybIeQ= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=L7iuXB5Z; spf=pass (imf05.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1671470296; a=rsa-sha256; cv=none; b=zL5X/UmDO3BOWE7t9EsxpScyf8EwhOTzHY2Mc/yYrJnW3L7U+F6DjJDCi7uY51VmSyhTIf GOSihBP0ngbxC/8+YUDEKutgxB7EMmm81BVuMc04UBF5hDxcgR5XUlESW+i8nN5qxJYihy 4m6ZtS30Gg0UnUVFPvxtm6zkxqigKJA= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0FDE3610A0; Mon, 19 Dec 2022 17:18:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 588B5C433F0; Mon, 19 Dec 2022 17:18:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671470293; bh=Az1DXboUgRl+YAMk48Zah7TQBLUIJ4ua1EMPirQ5/3o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L7iuXB5ZEm6O0EUjdxu5DQDi6cpCEpzeu3Zsa9iJyPi1H/rZSq/6M5VA7cUOv1WH8 NVdoiSN3kxcVWbmlgVaZARrAW6n7M3KikLiJxzQKSc8wJkL+dPjnJs0eHGv1VmJFep 4PejNW+g758e7hTjmRmXx/epWzJrVzgg9d3jH1rTSyByV7g1kCvlqvOJ3mtLtC+xwz 107NmX9Um9h8GKmqextgzKBM75180RfQ0OKBM7t17wNxns3jG9UT+l8hhtX7ss46GO L8UX0b7e/kkSZJHB/zhPcbEiNjGNKHGkL+ERT9H9Rww1MgZRTiQVat2VYr0EDmOc7g wRi4h5+o1tB7Q== From: SeongJae Park <sj@kernel.org> To: Andrew Morton <akpm@linux-foundation.org> Cc: damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park <sj@kernel.org> Subject: [PATCH mm-unstable 1/2] mm/damon/sysfs-schemes: Fix leaking a filter for wrong cgroup path Date: Mon, 19 Dec 2022 17:18:06 +0000 Message-Id: <20221219171807.55708-2-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221219171807.55708-1-sj@kernel.org> References: <20221219171807.55708-1-sj@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 21B6110001C X-Rspam-User: X-Stat-Signature: qrnbzco3ypfe5zjjc8byy7j5afr97c3h X-HE-Tag: 1671470295-919156 X-HE-Meta: U2FsdGVkX18iO2il/9KFx1N2AacvFFZi+V8TzFr4+cLypWptETY5qdMzuenZKEKZp/vK0UN5po+oMTu3jSmlL3r9VZZmigqT18zrYRwJFKHWwSG6mB8TykWFXSEJ+ffFpg6UqBJwgOkYaQZwxM2nSn+KtLxS7HOGQY/geW/tEARcurAWerd43CxoqZR3firMK6oXw5g47lvPaLUVHHkkJz3t176ItyOkLQ6BzfC5/We+c1YLspeLbtQhoxi9ZRDYYJyZo8gTRaZWvCklfav37dUjqmQFeFCltIKqBEi4KkkQLaMUDnITZLtHoVUG/eOpzlM0WD7dukiGAX3VXMHVV0tdPGNabLg5RDzaQV63lXgtna1DGgbDHrP+PVNTUVhbr/eva+zK6EWXkhPMzBV4PTSosyD1VlkU7dTTzmIo3diHvGpE5yl8bYHcpY5wq3L6dHnbIs9WM+XipDTb9N5F9cuv3Xq7lf6qU7Ao5kLT8nO0KbRjkROtmpVwKwJYFXzjhnEDOM2l1IK/glS+9KSMWO9GpOHTm9NDvUYaBGlfB9V1q30ylGLsrofKUaVfPJPFN9qrtgYWtrcYx6gz8JAeHDin/vC9TNoP/mmMDhOwVuaKXmSs92xeoVXRohPsjTx8zW1NHaXoc0eCUMHpy0skBN7cApAx9swv1OecWjaiydpRdHnQAC5uLJdoqVY2rM3P0hJKM0F2g5IBaoH/eTsA5sxbpnwxowCLSVb7oVIKHBQBh6U2oV4hB4sYY4XTZWECzgAV01piADvuorVurhYCg1SpW98qbWCeI4XncJ4BRYkzUA40ELu8Ihhysn1fACFST8TNB40NugCEw6tDMRmwvHzGMLh97j8DF+zQb+U7NX/nKdOqXNCKEK7N2Cg35Ed3rugIN8xpdmJviJfwmy1ADKXhQglJ+7SJaBCr6SyqYRDfbszngBNmY/8nF88LSK+6RQUjTbva991K6nGL8Nb wDY5+Rsp qgt6H+RISt/ChogX86QpPgDjXzIMPqA0BUgwZWwb4KzkPbX/15GtT20+pxw+xtdCf9sMX 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> |
Series |
two fixups for DAMON sysfs' scheme filters support
|
expand
|
diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index 0501862534f2..5d3ac3107927 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -1464,8 +1464,10 @@ static int damon_sysfs_set_scheme_filters(struct damos *scheme, err = damon_sysfs_memcg_path_to_id( sysfs_filter->memcg_path, &filter->memcg_id); - if (err) + if (err) { + damos_destroy_filter(filter); return err; + } } damos_add_filter(scheme, filter); }
Commit f36f860207efa ("mm/damon/sysfs-schemes: implement scheme filters") on mm-unstable introduced 'damon_syfs_set_scheme_filters()', which does not free newly allocated filter when it fails setting memcg id for the filter. As a result, the memory for the filter leaks. Fix it by freeing the filter before returning the error. Coverity CID: 1530032 Fixes: f36f860207ef ("mm/damon/sysfs-schemes: implement scheme filters") on mm-unstable Signed-off-by: SeongJae Park <sj@kernel.org> --- mm/damon/sysfs-schemes.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)