Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp839517pxu; Mon, 23 Nov 2020 05:36:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJxIuZ1B40M0GJ6NBJtH0+a2Z+MBwOrBJso0jXt6vuPhWjvRxZVbte/wv5RRhasTSLAWBGVJ X-Received: by 2002:a05:6402:1a2b:: with SMTP id be11mr18899693edb.353.1606138582885; Mon, 23 Nov 2020 05:36:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606138582; cv=none; d=google.com; s=arc-20160816; b=lGPcUl25EIaSKf4gOmiK29+adn0mE9wvOG7QhnUWHGACvOf4C/08EG11slO8nBxg/h pYPNXY8pn3kB/+e0YGsznXKaCDc3RaSbpBDagc0DAA8FbBgLwr0Wu8h5N2CczIedHABi Yoi5nf0bNdTCkaTP6IuN9ZL08tVdmOI5Wg9lAtgV5uF7eN8l93KXktef5GrSNda4Zsyx /JdH9fn3LMa6YHEogmEFrstDmTHh7rS/Qo2ShmVMJ/yqqeCHxNxcnYnBPAig52tJd68f ySHM0FLFAfxv1pumiINzq+MHFp7hTyDTHOyhRGLj9y9bHynHAdMBOvfW6Ef1jCSl+fK9 JQLQ== 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=TBiF/tj+mNPcQcLV+/jxOicmC7Q93uKaqP7TQ4hUYNfKcxhytcYT/6aAoCcf1+laPy zTDkl9gPl7CP3dgmRYo9SEPwO36YYqh54JhTcYl73TQhQclc2IOWQdR1A4Stnv+fymqr vK0X+73OmcbGt9S1Uax0BJQNdP+4ApJ8P3/eHEkrsrrtkz29DVmbbgihgaivCmPE0Cyq FBwQH1LdDPwzKVwPbQ+CR6QzWMjMNMdh5AxG8QpnaD707k6d2COzJXA0HTcMP/v0cjhH w97KurfG4uDgOm24mF8THm1lMdL+CB8/X4g++cfY8AE189WWPP+iF4mb9Sc7emsZVpVs MGSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k8YgFSO4; 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 i7si6474207ejc.568.2020.11.23.05.35.59; Mon, 23 Nov 2020 05:36:22 -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=k8YgFSO4; 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 S1730076AbgKWMZ5 (ORCPT + 99 others); Mon, 23 Nov 2020 07:25:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:35394 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730047AbgKWMZq (ORCPT ); Mon, 23 Nov 2020 07:25:46 -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 8DF8C20857; Mon, 23 Nov 2020 12:25:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606134346; bh=lYUHFsfMSCvVN1o385q1QZefOqjlrdDMMZNDJSIOhaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k8YgFSO4vTBDt0HAbTk3g9U34lSHtANS7B06LzGBxfyHrEgyYIzzaoAaO6+r8LwYS FAAa0zkBr/QffL/0Is4al6lwXkNYzdfhCYB7Pfx1vhUPRQG867+B1y9YfPDaZVyIwC E9Fg0wfk/zJfMkK9UupoY7hrUb3/VcHOBsEJ86Wo= 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.9 38/47] efivarfs: fix memory leak in efivarfs_create() Date: Mon, 23 Nov 2020 13:22:24 +0100 Message-Id: <20201123121807.399007267@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121805.530891002@linuxfoundation.org> References: <20201123121805.530891002@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 = {