Received: by 2002:ac0:adb4:0:0:0:0:0 with SMTP id o49-v6csp5236imb; Tue, 10 Jul 2018 19:26:34 -0700 (PDT) X-Google-Smtp-Source: AAOMgpduqdQB1rEB3SR3grOTLKAWjCXBD3H4EpbIN27NA5eBo8HOruwYohweN3dlLKgPtp3ffP+R X-Received: by 2002:a63:d613:: with SMTP id q19-v6mr21498995pgg.327.1531275994673; Tue, 10 Jul 2018 19:26:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531275994; cv=none; d=google.com; s=arc-20160816; b=M+MMwkUt2Ocs8pPsqiy5ZNTaAkWCfppbzFwQqHPzeeB2Q00VlBBquYz+y1yk+dO+Nj FiWXSKlqJ+Xlo5ySDNPO1gko3nH0sCs2qZRRucRM8sPHE3jHh5FM5Mmi6hv/d/xYGUee y1MdMxnNdQmvkylepAT2L0LR4aedPY4pjok5nZRYvty2OrNEuHPZ8KvHECoTAeAsfHEF xlctFCjSC+8r5EbRDo+vanGNS+SEVF0Gvm+tuSQV4QldOBl9mSPPtv38M3sgkjhj4fj5 erUeI9fKfkXFNWFru47trPcjKJ5TbY1pSabDe1xzD5z+70ILLjhQhAvYarSwIB3pgc0O 0lMA== 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=byfyt3tNvepwpXmljTqsy3oTnVPD98GVLo1YWn9kE7g=; b=B57/U8dn/eKFQemY+1hf1+XifAqq+t3A0QQUN60ouJzVzVnq+plL/nSuNMuuEsXXbc thHd9W5D789u8ZpIkY/mkvHgjVbn1kN5GOtn3g7LQWR4Ou9sdIV4lJ0QytaFZGQvIDXg xcQ6K+YOjtQlervHMRot4lVeNKrJ0CJpaeh8KBJphpShIms4+1Br0OnVEI48r8Lt8d24 jqAcgQ4wyXBv7WaSWAFsKHnu9ifn+vSoD/3UvyK2N+yoCepFEc3yFEXMZCIPhmbh43kM QVuk9BRphIRIU43ZtI2gYiPIPvv/K3OaSkJ7uq6pky1Q6OOv3ugs2t+e+fLPUdfxMCbK +eGw== 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 e14-v6si5399317pgg.345.2018.07.10.19.26.19; Tue, 10 Jul 2018 19:26:34 -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 S1732525AbeGKCYF (ORCPT + 99 others); Tue, 10 Jul 2018 22:24:05 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:45518 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732374AbeGKCYD (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-0003Hr-U3; 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 Subject: [RFC][PATCH 08/42] make sure do_dentry_open() won't return positive as an error Date: Wed, 11 Jul 2018 03:21:32 +0100 Message-Id: <20180711022206.12571-8-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 An ->open() instances really, really should not be doing that. There's a lot of places e.g. around atomic_open() that could be confused by that, so let's catch that early. Signed-off-by: Al Viro --- fs/open.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/open.c b/fs/open.c index 76c56966e297..558802e66e00 100644 --- a/fs/open.c +++ b/fs/open.c @@ -812,6 +812,10 @@ static int do_dentry_open(struct file *f, return 0; cleanup_all: + if (unlikely(error > 0)) { + WARN_ON(1); + error = -EINVAL; + } fops_put(f->f_op); if (f->f_mode & FMODE_WRITER) { put_write_access(inode); -- 2.11.0