Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp693051pxj; Fri, 28 May 2021 13:15:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2YRs4j2QEi09mZUYdOnD18R6uXHONww09+AcSaeHlnAr+nMLds5cTHrgQlnOMQUUF61xp X-Received: by 2002:a17:906:aac8:: with SMTP id kt8mr10364101ejb.402.1622232901144; Fri, 28 May 2021 13:15:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622232901; cv=none; d=google.com; s=arc-20160816; b=oMpQ9EwBFYLeOXylhpO0k1lbUQ1CGTtwwFMCMuojenFK6JhzvSIkbUo6t3mOi6IpdT BCgnD8uST4fnQIIl0NpcWcD15jRr1M3bdsXtoy00qCubdJb6fMZiUY8LQPeXnIwJM6xy 7izQIG868KYkCZlehr1ClTBtaERupw1B5Sy8beDsB3j5VB2cdxpUJUSjErc/DSyXhZkm +7J3ICI5WKJepnbqi7t6Z3pMysvNwuzK9phZUpL6n6HbtwZrqHZfFzvMK0S1ldfd2n9/ nFCe1yhyvZawXxFu8yNVr7V7+r3QcOnYJ4fJLWzGZPKY0VVy1x57gTOlMjWiBAYWHQ+N dVuQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=mFwW7XSfRNsT3aVWbSn7LULfilPfTjG62qQhaigJR5c=; b=emS4T3EiHfx+x4vfbsosMOiP8ZO5/XoDYOYoe0zZtj6ikVyAAPu1RNyUJsCqxygbCm FUUn6YJ8NfPfEhvHmiBMQNlwHGjfl9KRrMR/ol3U91/RwqAMLWyJ0+djvH2+BYcycPFe kIurH1RxHAzt4H6ExrhEUE5PSsPKGTqjSRtG2TrIQ0fhAUg+4H2rqk5aclLKuChd6Rqk Bue3UxDhGQ4nr8BP1MgSNAc5G1oBSK8nFOWbd6NXR2mxv5obE1T3+HgW6ZkW5Hz+WTpx 1uPMXn0sKIwhOaN7Du18YdWNRgxwQm7B1QZ3CzNAcaT64+Fu7UhKAxp8bhS8l3zM/3l5 E1mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZNdLRror; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ec4si5832004ejb.244.2021.05.28.13.14.37; Fri, 28 May 2021 13:15:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZNdLRror; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229644AbhE1UMx (ORCPT + 99 others); Fri, 28 May 2021 16:12:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229555AbhE1UMw (ORCPT ); Fri, 28 May 2021 16:12:52 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F84AC061574 for ; Fri, 28 May 2021 13:11:17 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id r5so7010157lfr.5 for ; Fri, 28 May 2021 13:11:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=mFwW7XSfRNsT3aVWbSn7LULfilPfTjG62qQhaigJR5c=; b=ZNdLRror0pn19p7uk00GzZaNSenk8XqlWfTCrVR+jaDZejhhZrWZyJlTXxBS2Cx+xD K+25E150fWJDiLyUVJXXdrYv0oMwFOAjWtiCqu6WqP36l43eouWbfrHRQklMwl+UYqUp lQXKvJ7KfSZda5bIxXoHHhO0QrfmhzfNAuRK1eaJ50SeeM0I83c+1X0TBDGgoQ7hxGuH las9tONL1mPRZ6Bqgdx5GIJSZNrmaRz4qYPbMcOoYE4wugCE2oMKV+lgWcbEMESDEk7C c3m58l5E/F/Y2vuHqPWmxFVTwTubfn1pmt1vingxEN38sTElMn8VBxMZDSPuysNDwYbH JEkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=mFwW7XSfRNsT3aVWbSn7LULfilPfTjG62qQhaigJR5c=; b=Pz0z0edG+SMT6qED2E9lXJYdLeLFQkfWK2VGK7UyzsdDH3OhBatqfegBW536kgH2eK qariCVg0WgX8Q4DCY1kAq4H+zkLyN9SngZHn7ivVMmOT2+PnqkNQEWUYay46sRJl0jxo V03fWcWkFMfYYv1cQnHTGYA2b6RnIBoWfTx4mOA1L87E2/2J4F41Qrvq1EBS0jk8Eo4U kM0oF760hWpWPmF9tLZCG5AbCE0rric3bnH7JblGwK2oJreerA3Lp8576VxPObq7Fo22 a/qFqQlIvQdZtMQQoNNNWuWJg1n31unhV2yUiVpUru1adom/PkQsWq5S0k+6Vj6/Nx+0 JTdA== X-Gm-Message-State: AOAM531tSszkXbyhLNUYoWTmUMDcKxbmd8ap6dQD04k87py0A5YXb+iZ /NsGOkrtrokBDRVnd3sUqzZBMBPRJJfi5Q== X-Received: by 2002:a05:6512:3487:: with SMTP id v7mr7055648lfr.467.1622232675866; Fri, 28 May 2021 13:11:15 -0700 (PDT) Received: from HyperiorArchMachine.bb.dnainternet.fi (dcx7x4yg81q1---xrfn1y-3.rev.dnainternet.fi. [2001:14ba:14f7:3c00:bcab:6bff:fe6e:22ea]) by smtp.gmail.com with ESMTPSA id v26sm548511lfd.291.2021.05.28.13.11.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 May 2021 13:11:15 -0700 (PDT) From: Jarmo Tiitto To: samitolvanen@google.com Cc: wcw@google.com, nathan@kernel.org, ndesaulniers@google.com, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Jarmo Tiitto Subject: [PATCH 5/6] pgo: modules Fixup memory leak. Date: Fri, 28 May 2021 23:11:07 +0300 Message-Id: <20210528201107.459362-1-jarmo.tiitto@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Jarmo Tiitto --- kernel/pgo/fs_mod.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/pgo/fs_mod.c b/kernel/pgo/fs_mod.c index 0808d44227f1..2d1ff99e7982 100644 --- a/kernel/pgo/fs_mod.c +++ b/kernel/pgo/fs_mod.c @@ -261,6 +261,8 @@ static int prf_module_open(struct inode *inode, struct file *file) if (!pinfo->buffer) { err = -ENOMEM; + kfree(pinfo); + module_put(mod); goto out; } } @@ -373,7 +375,7 @@ static int pgo_module_notifier(struct notifier_block *nb, unsigned long event, if (strcmp(data->mod->name, mod->name) == 0) { mutex_lock(&prf_mod_lock); - /* remofe from profiled modules */ + /* remove from profiled modules */ list_del_rcu(&data->link); /* mark it stale */ WRITE_ONCE(data->mod, NULL); -- 2.31.1