Received: by 10.192.165.148 with SMTP id m20csp430227imm; Fri, 27 Apr 2018 01:08:59 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqTEfsbDRO9h3J3R/l9T1A98VgkdJ5nNGBlEKKb/W4pfAa+aae/LiU6XbiaeKaXV5gieuCz X-Received: by 2002:a17:902:6041:: with SMTP id a1-v6mr1365192plt.59.1524816539643; Fri, 27 Apr 2018 01:08:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524816539; cv=none; d=google.com; s=arc-20160816; b=UNwA3L5CvyGs4WQD2ekEvIAWKF4HnDkiMaH8pilRoMmfW6IxPj/5BN6k9duyf1wB/q eblUOmxaEMo2ulG4B3SBB5i8mqPTg3s/5j8CKtaKDLF48YALt/1GlWKc/bx1ek1NshA0 sIky0KAcKZTB0zS5hPVJ1uIfJRqfnMu0ZX2yh2woS37R2RH62jQiFsQbnj75wZ8tHKor KqLxb3J1DmzLfSN3JpsE+VebRDleyeymPnqoN1xYAbHmlSOP9NEJt35Se3jflspDNS+/ V7ogd4R7tJWdnxgAosmgvs8sHge6nDkV1cLJGY4yEEFoBQW87Tmlq7kQqmfbQV0jZdvf 60Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=8GBxIlhdsR30TVwjUkXKUWhWGzQJoN5XpN7Z6imxX60=; b=IUBbVyKF7huLICza+i8OX6amWMsEGOKU99V2yea/4iNGB0n7JTyMadaL3H2dT8ul8C 5F5QNX+GfUrDcEaI5+uE5qOhAdwVKMxAwzkEGfYmyqO3cndqurLZzMCsZK6kIs2Axpom d5W96h8MpD94m5bSTmuswA0SO6HLMnnURXJy0k1g7wGXERoBm1H9QYVOw0N+gicqZCOP HAvOTbm4cRHxQaduPL7NdTGoudQLhC/5Fg7NIdbCni8DURjxMLxmWzfGGUsM28UeZTCA aKwoSx3TT9fqio8nsRvYSRMnIh2kzFYhfnFm0apKMFfHCHWyP588vKTV/t33yKwfAz7N P6gA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a69-v6si803397pli.391.2018.04.27.01.08.45; Fri, 27 Apr 2018 01:08:59 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757615AbeD0IHi (ORCPT + 99 others); Fri, 27 Apr 2018 04:07:38 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:51332 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757548AbeD0IHg (ORCPT ); Fri, 27 Apr 2018 04:07:36 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3R87UVr003484 for ; Fri, 27 Apr 2018 04:07:35 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hkwdnechu-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 27 Apr 2018 04:07:35 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 27 Apr 2018 09:07:32 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 27 Apr 2018 09:07:29 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3R87SuS1507606; Fri, 27 Apr 2018 08:07:28 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B62A7AE061; Fri, 27 Apr 2018 08:57:08 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7185AAE053; Fri, 27 Apr 2018 08:57:08 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 27 Apr 2018 08:57:08 +0100 (BST) From: Thomas Richter To: gregkh@linuxfoundation.org Cc: brueckner@linux.vnet.ibm.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, linux-kernel@vger.kernel.org, Thomas Richter Subject: [PATCH] inode: debugfs_create_dir uses mode permission from parent Date: Fri, 27 Apr 2018 10:07:12 +0200 X-Mailer: git-send-email 2.13.5 X-TM-AS-GCONF: 00 x-cbid: 18042708-0040-0000-0000-000004529F3F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18042708-0041-0000-0000-000020F6AA6E Message-Id: <20180427080712.2380-1-tmricht@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-27_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804270080 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.14.3