Received: by 10.192.165.148 with SMTP id m20csp444475imm; Fri, 27 Apr 2018 01:29:08 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpegCslXkBAKJwLRoVB/pYfemNqkgw49Yv07g3t/H0j2e/nWlXEgN+WkMYcAVNLvwIp5dNp X-Received: by 10.98.212.90 with SMTP id u26mr1363615pfl.166.1524817748294; Fri, 27 Apr 2018 01:29:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524817748; cv=none; d=google.com; s=arc-20160816; b=k3odzmPfuW4lCMbIOWpuN9TTPCoh84DRkqM/a3ImJMdbU3awjhW3q3bQdfSBij4Zsf ZyagALCx2ulWeRDsptuaeC1TSS/kT/4qWljfjM0B5/wqi4CObMN6MRaDQ6f9avE9yWXK J4jA7cASuvq7mettfrZJebygGfGXJ6jLoddLp00acI0FTHvK2oX3Y2sTrr3i0Cg4eFY5 0ppgr8I6L4OJa6cLBuktp0BWJn4aTq4mGimyAnpEpZ/yhq1JF/Ay/Yb1RTcaV98FWOIz 21JsWChIV5MAn/89SNwRX7y7nbY5Uva9DBPswtQk9bX7Gtkuvu4CH+caar4auD7ctToa oNAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:arc-authentication-results; bh=CncCJVojFKVVInlXFu7FRx9xmOAqvrkRw23Yq1po6kI=; b=VIafgkGWglTcKff5W7Upp39UhMxSEPYL2w2be1+lvnrzhnpuzqkACUqgZcM+PZJAbJ dJMaa8N4HEN4rzVBV7HgkvMeiqh/pPb+xgdqllR3xSBsB6kU1RVzybfeM3gPVtOmg+tR svAp9X0XlYiuybMOW71K/zysCKbByFzgIEKP77Q//l0GUruis3ow1NZK6oTplLh40o/T DbqgZf4UILhqDFlWXfgS6heeFgklTDgw6vfLYNlTjZ/Lj6UcWWUbsA8phDRc5wXANxwR Tg0TkZFzM3P2amZlHTGnH4f41r0AF8zYDALgEsOSZDrY32yGjpjzvYaitaAwBlvLA/LI gwmw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k14-v6si805192pgs.418.2018.04.27.01.28.54; Fri, 27 Apr 2018 01:29:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932373AbeD0I1s (ORCPT + 99 others); Fri, 27 Apr 2018 04:27:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:54926 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932218AbeD0I1q (ORCPT ); Fri, 27 Apr 2018 04:27:46 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 6D7F72184B; Fri, 27 Apr 2018 08:27:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6D7F72184B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org Date: Fri, 27 Apr 2018 10:27:37 +0200 From: Greg KH To: Thomas Richter Cc: brueckner@linux.vnet.ibm.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] inode: debugfs_create_dir uses mode permission from parent Message-ID: <20180427082737.GA25242@kroah.com> References: <20180427080712.2380-1-tmricht@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180427080712.2380-1-tmricht@linux.ibm.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 27, 2018 at 10:07:12AM +0200, Thomas Richter wrote: > Currently function debugfs_create_dir() creates a new > directory in the debugfs (usually mounted /sys/kernel/debug) > with permission rwxr-xr-x. This is hard coded. > > Change this to use the parent directory permission. > > Fixes: edac65eaf8d5c ("debugfs: take mode-dependent parts of debugfs_get_inode() into callers") > Signed-off-by: Thomas Richter > Cc: Greg Kroah-Hartman > --- > fs/debugfs/inode.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c > index 13b01351dd1c..80618330d86a 100644 > --- a/fs/debugfs/inode.c > +++ b/fs/debugfs/inode.c > @@ -512,7 +512,10 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent) > if (unlikely(!inode)) > return failed_creating(dentry); > > - inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO; > + if(!parent) > + parent = debugfs_mount->mnt_root; > + inode->i_mode = S_IFDIR | (d_inode(parent)->i_mode > + & (S_IRWXU | S_IRWXG)); > inode->i_op = &simple_dir_inode_operations; > inode->i_fop = &simple_dir_operations; > This looks ok, but is it going to change the permissions of existing stuff in ways that might breaks things, right? Have you done a before/after comparison? thanks, greg k-h