Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp995075ybt; Fri, 19 Jun 2020 20:58:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVsoE5acR34FVTg5e5tlwVwut75Lpj8xwFKA5xMcyb+t/u6HQiQmodvqSovCu2ezwXQUvT X-Received: by 2002:a17:906:434f:: with SMTP id z15mr6357602ejm.178.1592625517739; Fri, 19 Jun 2020 20:58:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592625517; cv=none; d=google.com; s=arc-20160816; b=rF2iClzJ+UdY/tPmtoiBpfUCUy/dSujHzbX8VdOgYTLaWrSUV3/R21dRsHkOmJSGZa CBqWOMZyBfaDiG7qX/z66Sn7R8vI4myx+LoT+it76tg4j3hDGzdqzhgk4OD+1A2+oTWW MQJDt475P/1mwycZ2ysUBwQyd19gwjJkiHtBX4+nNU4b1GGkfEVD7GNX9r2sQBOKOqgW LY7aK3CuvrLFjvsEPdhQNDy31ChsJdR10YQJda2mETaoJA0nRj+4V4/fmp+W306kmgqB qSnISIVBGFDvCXdu6yYv35wSb2OBAwPFjhONBHSh//SA/2W5LFeKw8jHdbxsEp0fuMac X9JQ== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=X1ucrF4W4B8xOzmUDqZt0nx+5CHdWOKW+0B4TM/NEQ0=; b=lBuCgjGdrFbUJkoy6gEypgtMy5T0nJlqdK3jnlD324sgkFGuPKsDhrsglVdeCq9m8L 5yCETUEoHHGbVSGTy17AB83/EAU8dTgDPvZM4sk6Z/4Ql8+yJwOmzogw7D3KqfIUXYIW Lr6+phSbWzSYjZi6QSa4piEHkddwOQ9zdeIDG+Uz0CsKC2vRNMPpm2Vu8hEVXyoaRrxE NkYvd6F5y9pvN5dqUsJPEfLi0lS7i2eHi7omyKJlPz/3YvmW6iHNq5YC11Pt8jiwAV5Y bjmmXp/guTmur+vqq7fpZk8lmR2x/eAK0nd+sg28kdQpmR5EwnembpcNEr8uo8dUCgHJ 3U1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vicvIHst; 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 r24si655617edp.282.2020.06.19.20.58.16; Fri, 19 Jun 2020 20:58:37 -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=@kernel.org header.s=default header.b=vicvIHst; 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 S2390157AbgFSQ3m (ORCPT + 99 others); Fri, 19 Jun 2020 12:29:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:49046 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389843AbgFSOyX (ORCPT ); Fri, 19 Jun 2020 10:54:23 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 3E53F21556; Fri, 19 Jun 2020 14:54:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592578463; bh=NWMLcpyikfEyP3vhtWUk2KoId6XXFoE9zxGdE35jo0U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vicvIHstJcx5OzSc3ZYezBT9W/iF2OlaFeLyr7ZGpMPZwxyQ8MW7Zu4HxFjGvhei1 0J1F2me451N6Sb+AGKXzUTWHMZ2NEp4KdJ4ujRS78L6UkSkCHyVQmlPHDhpVevVgr4 i8XO7LTEIUFkFF3VJH0pxRhhqk6ymiG7pD2QTY4Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?=E4=BA=BF=E4=B8=80?= , Ard Biesheuvel Subject: [PATCH 4.19 032/267] efi/efivars: Add missing kobject_put() in sysfs entry creation error path Date: Fri, 19 Jun 2020 16:30:17 +0200 Message-Id: <20200619141650.400313581@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141648.840376470@linuxfoundation.org> References: <20200619141648.840376470@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ard Biesheuvel commit d8bd8c6e2cfab8b78b537715255be8d7557791c0 upstream. The documentation provided by kobject_init_and_add() clearly spells out the need to call kobject_put() on the kobject if an error is returned. Add this missing call to the error path. Cc: Reported-by: 亿一 Signed-off-by: Ard Biesheuvel Signed-off-by: Greg Kroah-Hartman --- drivers/firmware/efi/efivars.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/firmware/efi/efivars.c +++ b/drivers/firmware/efi/efivars.c @@ -586,8 +586,10 @@ efivar_create_sysfs_entry(struct efivar_ ret = kobject_init_and_add(&new_var->kobj, &efivar_ktype, NULL, "%s", short_name); kfree(short_name); - if (ret) + if (ret) { + kobject_put(&new_var->kobj); return ret; + } kobject_uevent(&new_var->kobj, KOBJ_ADD); if (efivar_entry_add(new_var, &efivar_sysfs_list)) {