Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp421imm; Tue, 10 Jul 2018 19:28:59 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf45Vo4jmlhgEYJ+SImkPF0V8WNU1aJ+3RjBgG5/GqpW8qhHF2Xg0cFum3GMYjFEnZcZwRr X-Received: by 2002:a65:510c:: with SMTP id f12-v6mr24232251pgq.288.1531276139842; Tue, 10 Jul 2018 19:28:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531276139; cv=none; d=google.com; s=arc-20160816; b=M4OMrcAvVUrcZZHJZAfpB6VCxDTN0WOaWzMGkiuOPTzPxx2jeEOaQKOfaRG9cZC2p4 oVcWzHdBGu8p4XLjJdAtrov3VuzC1naaTqEHiwKwXVcKoSvJmWp4Ujn4WUsdtNrzRwd/ Qa/2nF0Rjserz0nO18ThJR41Oj4ypmKdTdrr+2VYjBfAHJpTWOAdpEbfT08hhTcbRMHC 2rwvTznobg0U/PbokKjliahhmBY3MWU/V/UmcaGComcjkdmFk5j6H76mLH9RZzLZDMOo C3fWKqMSAha9Z8EH5qkvUDHjj4wcOj+nuvAdwxpoZf+W5Vy3R4BpXBnALkQuCihfHkDG KSJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=LtVs/6WMnZUpqsem95zhDJyvc+7ikA2GlI8S0t/28qM=; b=BuKnIyd21EhkhaDTXhMvXT8z6+7K0D7pk3Rab+8F6LUcN8NgqClZvsxPEYx1+zI3f3 w3vRqqMzJ3uiRdxpdcwAN7NVoE9PBPVqryC7MU0h6oHYhxJvo0YJBOucdI2hEtXQ8GOy bkzWGROe0i4i3GIujJH8FmUKhFDS24sByGqNBzvozy9PDOLhXmLVAxjWqmJLfBGkOCB5 ZJITldUxz+klpKHo7nyrZSSoL4qnXNGJwd3zL7Q3upnepxsE9xkkqSCOUJw2rgTYp+eh JtdseRpwlcIkNjxL2ot/8KOj5h5uawSvLYapFNWLtjmqcLLvLQbUyZcsiIXACmPcvr0v eYGg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t62-v6si10739314pgd.485.2018.07.10.19.28.44; Tue, 10 Jul 2018 19:28:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732445AbeGKCYE (ORCPT + 99 others); Tue, 10 Jul 2018 22:24:04 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:45504 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732346AbeGKCYD (ORCPT ); Tue, 10 Jul 2018 22:24:03 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.87 #1 (Red Hat Linux)) id 1fd4la-0003HS-Dt; Wed, 11 Jul 2018 02:22:06 +0000 From: Al Viro To: Linus Torvalds Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Miklos Szeredi , stable@kernel.org Subject: [RFC][PATCH 02/42] cxl_getfile(): fix double-iput() on alloc_file() failures Date: Wed, 11 Jul 2018 03:21:26 +0100 Message-Id: <20180711022206.12571-2-viro@ZenIV.linux.org.uk> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180711022206.12571-1-viro@ZenIV.linux.org.uk> References: <20180711021136.GN30522@ZenIV.linux.org.uk> <20180711022206.12571-1-viro@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro Doing iput() after path_put() is wrong. Cc: stable@kernel.org Signed-off-by: Al Viro --- drivers/misc/cxl/api.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c index 753b1a698fc4..6b16946f9b05 100644 --- a/drivers/misc/cxl/api.c +++ b/drivers/misc/cxl/api.c @@ -103,15 +103,15 @@ static struct file *cxl_getfile(const char *name, d_instantiate(path.dentry, inode); file = alloc_file(&path, OPEN_FMODE(flags), fops); - if (IS_ERR(file)) - goto err_dput; + if (IS_ERR(file)) { + path_put(&path); + goto err_fs; + } file->f_flags = flags & (O_ACCMODE | O_NONBLOCK); file->private_data = priv; return file; -err_dput: - path_put(&path); err_inode: iput(inode); err_fs: -- 2.11.0