From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87C8D6FA7 for ; Sun, 17 Sep 2023 20:10:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF3C2C433C8; Sun, 17 Sep 2023 20:10:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1694981459; bh=YFK/3zNY1PQNMBimBwD8XRUkTOFxjk9jQBcETvJBRQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g3tcd97ZlrqWs3St99obUkPisTg9KiyY4Y5rwYKxUEpB4iGWbKN35j5Tq3ihQwGiX 2XN2L/ypjofe5od6TcfMWdwomyAWxLOHLSiOKjiB3GGUmQb/nHhn2gb8mhKyM0SM72 VqfXxfru+uT/kxYc8eIZSyjuESB4gDrO8cMZpv98= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Wang Ming , Christian Brauner , Sasha Levin Subject: [PATCH 5.15 058/511] fs: Fix error checking for d_hash_and_lookup() Date: Sun, 17 Sep 2023 21:08:05 +0200 Message-ID: <20230917191115.288363402@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230917191113.831992765@linuxfoundation.org> References: <20230917191113.831992765@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wang Ming [ Upstream commit 0d5a4f8f775ff990142cdc810a84eae078589d27 ] The d_hash_and_lookup() function returns error pointers or NULL. Most incorrect error checks were fixed, but the one in int path_pts() was forgotten. Fixes: eedf265aa003 ("devpts: Make each mount of devpts an independent filesystem.") Signed-off-by: Wang Ming Message-Id: <20230713120555.7025-1-machel@vivo.com> Signed-off-by: Christian Brauner Signed-off-by: Sasha Levin --- fs/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/namei.c b/fs/namei.c index 885b0e93ee966..ea2785103376e 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2836,7 +2836,7 @@ int path_pts(struct path *path) dput(path->dentry); path->dentry = parent; child = d_hash_and_lookup(parent, &this); - if (!child) + if (IS_ERR_OR_NULL(child)) return -ENOENT; path->dentry = child; -- 2.40.1