From patchwork Thu May 7 13:06:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlad Dogaru X-Patchwork-Id: 6357761 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7785D9F32B for ; Thu, 7 May 2015 13:08:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A62572038C for ; Thu, 7 May 2015 13:08:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 40ED020386 for ; Thu, 7 May 2015 13:07:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751379AbbEGNHx (ORCPT ); Thu, 7 May 2015 09:07:53 -0400 Received: from mga14.intel.com ([192.55.52.115]:46560 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751021AbbEGNHw (ORCPT ); Thu, 7 May 2015 09:07:52 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 07 May 2015 06:07:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,384,1427785200"; d="scan'208";a="722205852" Received: from vdogaru.rb.intel.com ([10.237.104.66]) by fmsmga002.fm.intel.com with ESMTP; 07 May 2015 06:07:17 -0700 From: Vlad Dogaru To: viro@zeniv.linux.org.uk, akpm@linux-foundation.org, hch@lst.de, linux-fsdevel@vger.kernel.org, jlbec@evilplan.org Cc: octavian.purdila@intel.com, daniel.baluta@intel.com, adriana.reus@intel.com, Vlad Dogaru Subject: [PATCH linux-next] configfs: set new file and directory owners Date: Thu, 7 May 2015 16:06:58 +0300 Message-Id: <1431004018-5682-1-git-send-email-vlad.dogaru@intel.com> X-Mailer: git-send-email 1.9.1 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP All new files and directories in configfs are owned by root, regardless of the process which creates them. Fix this by preserving filesystem semantics and assigning the uid and gid of the current process to all new items in configfs. Signed-off-by: Vlad Dogaru --- fs/configfs/dir.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index c81ce7f..f05dfa8 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c @@ -31,6 +31,8 @@ #include #include #include +#include +#include #include #include "configfs_internal.h" @@ -245,6 +247,9 @@ static void init_dir(struct inode * inode) inode->i_op = &configfs_dir_inode_operations; inode->i_fop = &configfs_dir_operations; + inode->i_uid = current_fsuid(); + inode->i_gid = current_fsgid(); + /* directory inodes start off with i_nlink == 2 (for "." entry) */ inc_nlink(inode); } @@ -253,6 +258,9 @@ static void configfs_init_file(struct inode * inode) { inode->i_size = PAGE_SIZE; inode->i_fop = &configfs_file_operations; + + inode->i_uid = current_fsuid(); + inode->i_gid = current_fsgid(); } static void init_symlink(struct inode * inode)