Received: by 2002:aa6:c429:0:b029:98:93ff:f56f with SMTP id g9csp3395829lkq; Mon, 23 Nov 2020 04:45:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJyfz61qz7pzyKuj++e7Aejcf2x1M8zjnfZpOq7zwialM5Buo+tRncxl4hWt94ExOIErAGtk X-Received: by 2002:a17:906:f88e:: with SMTP id lg14mr23381729ejb.417.1606135538530; Mon, 23 Nov 2020 04:45:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606135538; cv=none; d=google.com; s=arc-20160816; b=z6fTbHVJZ2EWfbIrV9Hw0avwFLiAx0h9b++OHDYL/oLBerhpS6WFJkQQDSqQitIpRg k1ZFg3ED6NPEf6I7gycyppETabktbhZXSX/I1pfC3K6zfV93nSs4wEK8taSGlockEUiC cr+t+qzmyIFH7j+H+qaXLiMZFS3aawclPFZPAELZcgYuepAMMQQOZXwAYMTBx7Y9E6M4 AdacKoZxfEiUQUIu1YwOHw7HH+zdqkhZvXuLgOk7qf1wIgbzVRsitWgUB2Lm17Nnam7B Kvgb1BJHwgU9Iguovwc5unILlguyJ/YfvwODmMJ1Fk7iNpWi4csFuRfzOH0rn1ndtP7J iFFg== 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=xzg7j9pJ/FmAeEidfFfuWsAXsFb5pvYmIgKeVNfCOa0=; b=CkZQlxfMT4CA1+sDzq8Q3N43f/SoJeLSzjH+oJw2MWnaWmyx+01tfpBGh0RPSWrJB7 p3BMTl7kn8ccglDddKfcVc4YoQTortQS95IUO3DPnQC+JStoSMPBq1Wa0HnRVPM8sew6 5D86/SOkIPG1NQkuASzG/WJAYSmHPkF3KZnZ4ghZIFfl09ic/WSsBeDNZ/yXIemvaqvG orprqYpEHqRj72EFqYsq8kd92puxQQFRK0w5CV6EL1Waft4qJXa8dewk2+J++e5XQkpi gAabbAZO5ghiv5X5bLCQiHgSlhVhiq2Ya14eFZWsOlFSgVGs4H8RrChDNk+RI3jXJekB rwbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vMeh6E9D; 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 a21si6366589ejd.281.2020.11.23.04.45.15; Mon, 23 Nov 2020 04:45:38 -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=vMeh6E9D; 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 S1732545AbgKWMkr (ORCPT + 99 others); Mon, 23 Nov 2020 07:40:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:53562 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732514AbgKWMkl (ORCPT ); Mon, 23 Nov 2020 07:40:41 -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 3398F20732; Mon, 23 Nov 2020 12:40:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606135241; bh=YQxTo3qZOqu7l7wv1ojl0FFp11250/mb0j4+Kd3/Xoc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vMeh6E9DN6/vEDtJR5/Xpkqfka5Z/pJf2HiDSScEi0ClvGUMntoIMq6t+OCc/jssp ovQyQu2CTtcG0Bv/khq5r7Pjk930cgWqXjQj+anmxURMCrXUwB6G8Pydc/eSrL8bki 25zCOST/IsviSjFCbGlJNOIMOwl4H9ouvxhXLYHA= 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 5.4 126/158] efivarfs: fix memory leak in efivarfs_create() Date: Mon, 23 Nov 2020 13:22:34 +0100 Message-Id: <20201123121826.012554780@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121819.943135899@linuxfoundation.org> References: <20201123121819.943135899@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 @@ -21,6 +21,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 = {