Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932590AbcCBAJ5 (ORCPT ); Tue, 1 Mar 2016 19:09:57 -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 S932500AbcCAX6Y (ORCPT ); Tue, 1 Mar 2016 18:58:24 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; q=dns; s=mandrill; d=linuxfoundation.org; b=LXpGDALzn27tBh8W+gBaW4+5trx6qXHl6e3cJ/6MQXODris6nlruGkvk21mGCcf8BUQLEfsq0KbK wTmBrtUcvULhOaDnb7sDqmXYubme/GHceXXgbm1BXRGIGqcH7B5q5ov+Ap5OcOeThIWHa9MPX522 e2kWvbwOqwudHAXMwGs=; From: Greg Kroah-Hartman Subject: [PATCH 4.4 317/342] should_follow_link(): validate ->d_seq after having decided to follow X-Mailer: git-send-email 2.7.2 To: Cc: Greg Kroah-Hartman , , Al Viro Message-Id: <20160301234538.121370124@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.15fd9e45e4144b0c80e7f94d36f70b5c X-Mandrill-User: md_30481620 Date: Tue, 01 Mar 2016 23:55:30 +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: 817 Lines: 31 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Al Viro commit a7f775428b8f5808815c0e3004020cedb94cbe3b upstream. ... otherwise d_is_symlink() above might have nothing to do with the inode value we've got. Signed-off-by: Al Viro Signed-off-by: Greg Kroah-Hartman --- fs/namei.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/fs/namei.c +++ b/fs/namei.c @@ -1711,6 +1711,11 @@ static inline int should_follow_link(str return 0; if (!follow) return 0; + /* make sure that d_is_symlink above matches inode */ + if (nd->flags & LOOKUP_RCU) { + if (read_seqcount_retry(&link->dentry->d_seq, seq)) + return -ECHILD; + } return pick_link(nd, link, inode, seq); }