Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp635785ybt; Fri, 19 Jun 2020 09:51:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxV0sCbmgtbT+rwhzNYL0DWXOSUpOdq2Z9qal+SgJZ6DGJI3VSXW5/OiKKaKceZNEhmiJdm X-Received: by 2002:a17:906:7f94:: with SMTP id f20mr4673006ejr.394.1592585503606; Fri, 19 Jun 2020 09:51:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592585503; cv=none; d=google.com; s=arc-20160816; b=oNZzRSyLjihR1XSi3VLSrCShdB8jFi1y/rIuKv97qIjc+xofeuobqR//qU7DQNYE03 Y42uggDtF/X1sFgtn0Khh8Ib+mm1pn92kO1zuE9bYv3Aq5rV2WVc6Eb6/6AZlFCYWR+U cUsQR0G6nNKLe2v39mNBbE9+RoOyvcP5N8Ban87084fntYHDekVfkQr7WUrL79DoLLO9 qB/zGMfS+OW1KN20YEq6BzUIZlKkY/KZ/XMHQ6sFsNqINm1SLHRD9Q85MvDTN8b1354a WbpNYbZC1rtcMFpGzou5teQeFq/QibRgtkZwKnz2zNM25hFR7eIn1qkbzPL5QwO11qmo T4cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=bFha0tuYnlPogfIaYG1I8II3jyJ+3oBgzxTriPFbxQc=; b=I75kVoWO4JQMgAmoJPbrhOGUQqNAfaQfAer8+10Q1J3NWbqFF/lgO+fOKMjjaRs02b 2a69wbYOJ5t4pZRqWvrbl8NzmZEfEjY1DwOQBgmYkY+VWzB1dSxBhhxDSmdvMZkJ4akR 5P8Jv85EMJy8rbBfEcm23D6Iw/Hare1xBoeruY1Wa+KpiNhTJKgzLD5wkJbMihZJIW46 Zkn53xa+T/Ig5OdbqjzY2E9cTX9iWZI8zMEPP5ajB3KZ8yszs/QwQLBZcYGAGQs1H5c4 WKW+ept8szc+jN6ys6D/fHObXZn88RqKtWmUpECmlwVF02sQUt0XEQw4Ombh5k5bGgpa QJyQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q22si4295754eji.446.2020.06.19.09.51.21; Fri, 19 Jun 2020 09:51:43 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405253AbgFSQqd (ORCPT + 99 others); Fri, 19 Jun 2020 12:46:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405018AbgFSQqI (ORCPT ); Fri, 19 Jun 2020 12:46:08 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63C8FC061798; Fri, 19 Jun 2020 09:46:07 -0700 (PDT) Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jmK9R-00045H-N2; Fri, 19 Jun 2020 18:46:01 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 58BA81C0085; Fri, 19 Jun 2020 18:46:01 +0200 (CEST) Date: Fri, 19 Jun 2020 16:46:01 -0000 From: "tip-bot2 for Qiushi Wu" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: efi/urgent] efi/esrt: Fix reference count leak in esre_create_sysfs_entry. Cc: Qiushi Wu , Ard Biesheuvel , x86 , LKML In-Reply-To: <20200528183804.4497-1-wu000273@umn.edu> References: <20200528183804.4497-1-wu000273@umn.edu> MIME-Version: 1.0 Message-ID: <159258516116.16989.8861794799780746697.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the efi/urgent branch of tip: Commit-ID: 4ddf4739be6e375116c375f0a68bf3893ffcee21 Gitweb: https://git.kernel.org/tip/4ddf4739be6e375116c375f0a68bf3893ffcee21 Author: Qiushi Wu AuthorDate: Thu, 28 May 2020 13:38:04 -05:00 Committer: Ard Biesheuvel CommitterDate: Mon, 15 Jun 2020 14:38:56 +02:00 efi/esrt: Fix reference count leak in esre_create_sysfs_entry. kobject_init_and_add() takes reference even when it fails. If this function returns an error, kobject_put() must be called to properly clean up the memory associated with the object. Previous commit "b8eb718348b8" fixed a similar problem. Fixes: 0bb549052d33 ("efi: Add esrt support") Signed-off-by: Qiushi Wu Link: https://lore.kernel.org/r/20200528183804.4497-1-wu000273@umn.edu Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/esrt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/efi/esrt.c b/drivers/firmware/efi/esrt.c index e3d6926..d591527 100644 --- a/drivers/firmware/efi/esrt.c +++ b/drivers/firmware/efi/esrt.c @@ -181,7 +181,7 @@ static int esre_create_sysfs_entry(void *esre, int entry_num) rc = kobject_init_and_add(&entry->kobj, &esre1_ktype, NULL, "entry%d", entry_num); if (rc) { - kfree(entry); + kobject_put(&entry->kobj); return rc; } }