From patchwork Thu Feb 15 12:41:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danilo Krummrich X-Patchwork-Id: 10221103 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0C6F560467 for ; Thu, 15 Feb 2018 12:50:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA20A29168 for ; Thu, 15 Feb 2018 12:50:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5F9C291AF; Thu, 15 Feb 2018 12:50:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB9AC2916E for ; Thu, 15 Feb 2018 12:50:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030346AbeBOMuA (ORCPT ); Thu, 15 Feb 2018 07:50:00 -0500 Received: from hs01.dk-develop.de ([213.136.71.231]:41745 "EHLO hs01.dk-develop.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030245AbeBOMuA (ORCPT ); Thu, 15 Feb 2018 07:50:00 -0500 X-Greylist: delayed 517 seconds by postgrey-1.27 at vger.kernel.org; Thu, 15 Feb 2018 07:50:00 EST Received: from danilo-linux.fritz.box (ipbcc13fda.dynamic.kabel-deutschland.de [188.193.63.218]) by hs01.dk-develop.de (Postfix) with ESMTPSA id CAC371320D55; Thu, 15 Feb 2018 13:41:21 +0100 (CET) From: Danilo Krummrich To: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org Cc: Danilo Krummrich Subject: [PATCH] vfs: namei: use path_equal() in follow_dotdot() Date: Thu, 15 Feb 2018 13:41:07 +0100 Message-Id: <20180215124107.24371-1-danilokrummrich@dk-develop.de> X-Mailer: git-send-email 2.14.1 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use path_equal() to detect whether we're already in root. Signed-off-by: Danilo Krummrich --- fs/namei.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 9cc91fb7f156..7662b7e112c3 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1455,10 +1455,8 @@ static int path_parent_directory(struct path *path) static int follow_dotdot(struct nameidata *nd) { while(1) { - if (nd->path.dentry == nd->root.dentry && - nd->path.mnt == nd->root.mnt) { + if (path_equal(&nd->path, &nd->root)) break; - } if (nd->path.dentry != nd->path.mnt->mnt_root) { int ret = path_parent_directory(&nd->path); if (ret)