Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp834932pxu; Mon, 23 Nov 2020 05:30:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJxptAmo4h4AJ9HXJBl1h7zKgVnN0dRjSAfemVc+wX0FY0m3icXC3MTv/GJf4XlsqiL2kBOO X-Received: by 2002:a05:6402:1456:: with SMTP id d22mr46016893edx.77.1606138203837; Mon, 23 Nov 2020 05:30:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606138203; cv=none; d=google.com; s=arc-20160816; b=xQ816pvVW9+Wd9wVrxqb0eIAisaWwISKjinWExpiOihxzxWu2RqFKW2UFlBUwAngkC s74KIYb9BPO1MvxZWdNbKrSbloN9imZm5pQrhSumcJmYkqRY1STFio88q5PspOz4EDhY SRSROnv3cbb04z/DFu4Z0PjvZWSeLwrsWQAvDMjZXl/39Og9r9ov4elv5lFXzN4Czl+X DeDc+XNA5X/Ytcwz1lwA2gB40tU2Gdz4LP3twurcRYjmtjbcGTEeFGElQlgITGSDZUYl EIFoZh4HIpQQ9apgb14seFEWoMxliwphpe0WkV/g/YfgaXuwYnFkDIPt7uNlN2QjsAZO Hy/Q== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xz8EkJwWJh9ynSMQwcVu73n7++x48Kt6TMdmmuKtkAU=; b=TurGK7TmyPP0TPrFdsvcsNStD6bvQKTBaNvPKMu/cwSFdH2PdKFYDkqkMoEccEUzwX 1UhGc+QKMEcw/tbCPTeaqWWyt6lk8ihO6ImIFg9rzHVHloi9IW83LjFdQeoyg+2PmNkc LumUow2O/UVu2COVkh6QS9nb4rQjUIL3p3hgLVfqyGuuqQE31Wv2SgJTB36odadtHW7g cGH9UYyf0bSFxh1g6Lrxj1ExFQ2A25MQOh073HjQg6mHTuUja95PvgunmgAPpuRdds89 Qw1sygDxahg8yizh8gFOIJlOiSVKan0fVHwIZ6z7XepU4kEMMrCGmuO2IbteBF7rL4xC NVhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=p5HxP0zi; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a14si6459143ejf.629.2020.11.23.05.29.40; Mon, 23 Nov 2020 05:30:03 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=p5HxP0zi; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389075AbgKWNYs (ORCPT + 99 others); Mon, 23 Nov 2020 08:24:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:45036 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730549AbgKWMdp (ORCPT ); Mon, 23 Nov 2020 07:33:45 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5805720888; Mon, 23 Nov 2020 12:33:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606134824; bh=lYUHFsfMSCvVN1o385q1QZefOqjlrdDMMZNDJSIOhaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p5HxP0zi21e/kjp/W+Z6FG9N82ha5U1vmJw3u5UNHDQUG13gCn5aWLRVVOphuO0ZI Anbkh2SCXtiwD7DdvPlzK0l4Hss4NIxqEQaVJmjOTP8OSqWpC+/WMdXZz1AdMkdtep RGaBV1jme4nKKr2NA1bu9nPe5/V9vFTDDwrLFvGk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vamshi K Sthambamkadi , Ard Biesheuvel Subject: [PATCH 4.19 73/91] efivarfs: fix memory leak in efivarfs_create() Date: Mon, 23 Nov 2020 13:22:33 +0100 Message-Id: <20201123121812.868073417@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121809.285416732@linuxfoundation.org> References: <20201123121809.285416732@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vamshi K Sthambamkadi commit fe5186cf12e30facfe261e9be6c7904a170bd822 upstream. kmemleak report: unreferenced object 0xffff9b8915fcb000 (size 4096): comm "efivarfs.sh", pid 2360, jiffies 4294920096 (age 48.264s) hex dump (first 32 bytes): 2d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -............... 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<00000000cc4d897c>] kmem_cache_alloc_trace+0x155/0x4b0 [<000000007d1dfa72>] efivarfs_create+0x6e/0x1a0 [<00000000e6ee18fc>] path_openat+0xe4b/0x1120 [<000000000ad0414f>] do_filp_open+0x91/0x100 [<00000000ce93a198>] do_sys_openat2+0x20c/0x2d0 [<000000002a91be6d>] do_sys_open+0x46/0x80 [<000000000a854999>] __x64_sys_openat+0x20/0x30 [<00000000c50d89c9>] do_syscall_64+0x38/0x90 [<00000000cecd6b5f>] entry_SYSCALL_64_after_hwframe+0x44/0xa9 In efivarfs_create(), inode->i_private is setup with efivar_entry object which is never freed. Cc: Signed-off-by: Vamshi K Sthambamkadi Link: https://lore.kernel.org/r/20201023115429.GA2479@cosmos Signed-off-by: Ard Biesheuvel Signed-off-by: Greg Kroah-Hartman --- fs/efivarfs/super.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/efivarfs/super.c +++ b/fs/efivarfs/super.c @@ -23,6 +23,7 @@ LIST_HEAD(efivarfs_list); static void efivarfs_evict_inode(struct inode *inode) { clear_inode(inode); + kfree(inode->i_private); } static const struct super_operations efivarfs_ops = {