From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAF65C282C0 for ; Fri, 25 Jan 2019 12:07:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 72CE0218F0 for ; Fri, 25 Jan 2019 12:07:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548418053; bh=OCQ7Gi+bO2jmkIGqsE7N96YVdx4WAvXOm7kNKMteST8=; h=Subject:To:From:Date:List-ID:From; b=k9jKrMda0J6bufl/CW1gP6hGtbfU8LwuGOsi+fBFLdug9bs5RKwd4QoIvfuIIt0BL c1VSruxb9CWKdHXJk5NatPis8d0ZtbtY++bR9X5IVXqqpmwhL8Xvaej/KhJIzJxgoM HkRcNPlmSV4zPoapMxB//0VFGh1bU+55VXAn5dLc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726095AbfAYMHd (ORCPT ); Fri, 25 Jan 2019 07:07:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:60750 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbfAYMHc (ORCPT ); Fri, 25 Jan 2019 07:07:32 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 97A11218D9; Fri, 25 Jan 2019 12:07:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548418052; bh=OCQ7Gi+bO2jmkIGqsE7N96YVdx4WAvXOm7kNKMteST8=; h=Subject:To:From:Date:From; b=zTWCfDXR1oQEw0LtuQdOL9ymP4BvA6S+4t0u9kZkh2fF11JgC5jMeqnseqAZ9UgPj sk0KdR5GcqvXrCR3ptIGmG6zvELu941B9pNK6OgW7IwjY6hg+h97UnKh3B82luePsE +dsLDL+jfajyFIe6I7FcZao1wpIEuM1DN31cpx6E= Subject: patch "debugfs: fix debugfs_rename parameter checking" added to driver-core-linus To: gregkh@linuxfoundation.org, stable@vger.kernel.org From: Date: Fri, 25 Jan 2019 13:07:29 +0100 Message-ID: <1548418049246146@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org This is a note to let you know that I've just added the patch titled debugfs: fix debugfs_rename parameter checking to my driver-core git tree which can be found at git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git in the driver-core-linus branch. The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.) The patch will hopefully also be merged in Linus's tree for the next -rc kernel release. If you have any questions about this process, please let me know. >From d88c93f090f708c18195553b352b9f205e65418f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 23 Jan 2019 11:27:02 +0100 Subject: debugfs: fix debugfs_rename parameter checking debugfs_rename() needs to check that the dentries passed into it really are valid, as sometimes they are not (i.e. if the return value of another debugfs call is passed into this one.) So fix this up by properly checking if the two parent directories are errors (they are allowed to be NULL), and if the dentry to rename is not NULL or an error. Cc: stable Signed-off-by: Greg Kroah-Hartman --- fs/debugfs/inode.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 13b01351dd1c..41ef452c1fcf 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c @@ -787,6 +787,13 @@ struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, struct dentry *dentry = NULL, *trap; struct name_snapshot old_name; + if (IS_ERR(old_dir)) + return old_dir; + if (IS_ERR(new_dir)) + return new_dir; + if (IS_ERR_OR_NULL(old_dentry)) + return old_dentry; + trap = lock_rename(new_dir, old_dir); /* Source or destination directories don't exist? */ if (d_really_is_negative(old_dir) || d_really_is_negative(new_dir)) -- 2.20.1