Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756405AbcCAX6w (ORCPT ); Tue, 1 Mar 2016 18:58:52 -0500 Received: from mail333.us4.mandrillapp.com ([205.201.137.77]:58697 "EHLO mail333.us4.mandrillapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932592AbcCAX6h (ORCPT ); Tue, 1 Mar 2016 18:58:37 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; q=dns; s=mandrill; d=linuxfoundation.org; b=WAwgsuUuZS82kCSBo+AR7dXjSMmKVD1gMH05vBuuA1jPoBlD60W+G4gWPuF9twSTcoZNcq7Qe14Q FYSp+rqrl3DCVLWg2TAlSxG0PcrwvgDGUc6EMk1rhAXhtcCB8MCQh+Pd4oZHFrSh2OVzV7J/oN6B 8gKaLRBsxEGJmws5CZE=; From: Greg Kroah-Hartman Subject: [PATCH 4.4 318/342] do_last(): ELOOP failure exit should be done after leaving RCU mode X-Mailer: git-send-email 2.7.2 To: Cc: Greg Kroah-Hartman , , Al Viro Message-Id: <20160301234538.151695784@linuxfoundation.org> In-Reply-To: <20160301234527.990448862@linuxfoundation.org> References: <20160301234527.990448862@linuxfoundation.org> X-Report-Abuse: Please forward a copy of this message, including all headers, to abuse@mandrill.com X-Report-Abuse: You can also report abuse here: http://mandrillapp.com/contact/abuse?id=30481620.e400c75ee32b48738514be2a897582e7 X-Mandrill-User: md_30481620 Date: Tue, 01 Mar 2016 23:55:40 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1104 Lines: 42 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Al Viro commit 5129fa482b16615fd4464d2f5d23acb1b7056c66 upstream. ... or we risk seeing a bogus value of d_is_symlink() there. Signed-off-by: Al Viro Signed-off-by: Greg Kroah-Hartman --- fs/namei.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) --- a/fs/namei.c +++ b/fs/namei.c @@ -3149,11 +3149,6 @@ finish_lookup: if (unlikely(error)) return error; - if (unlikely(d_is_symlink(path.dentry)) && !(open_flag & O_PATH)) { - path_to_nameidata(&path, nd); - return -ELOOP; - } - if ((nd->flags & LOOKUP_RCU) || nd->path.mnt != path.mnt) { path_to_nameidata(&path, nd); } else { @@ -3172,6 +3167,10 @@ finish_open: return error; } audit_inode(nd->name, nd->path.dentry, 0); + if (unlikely(d_is_symlink(nd->path.dentry)) && !(open_flag & O_PATH)) { + error = -ELOOP; + goto out; + } error = -EISDIR; if ((open_flag & O_CREAT) && d_is_dir(nd->path.dentry)) goto out;