From patchwork Fri Dec 2 15:39:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Garg X-Patchwork-Id: 28946 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp936150wrr; Fri, 2 Dec 2022 07:58:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf6vXZR0whEsnzfxjKQksRPqD0cReugJnoTTGALhYF5OwxCIxtGCW4Kvjs0SAVi4Jm7Xn3Zc X-Received: by 2002:a63:ce10:0:b0:478:5e53:4742 with SMTP id y16-20020a63ce10000000b004785e534742mr11700792pgf.471.1669996714550; Fri, 02 Dec 2022 07:58:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669996714; cv=pass; d=google.com; s=arc-20160816; b=Tp5EOD5kO/av/DX6XdYdV8R+1bSpVzNgOGwRPz7/3lQKwvNKZebVI0P8H2VIUISuqx 4hGiYx1IYWDOwHOja1wPmfTXEgno2gPEEuzbXIudTTdXB8ia6PGRWNQDID3hFbypNwP5 WAwM//ATqXgH2vqBCG5sxjmWGLu8Tbr/02e+p/H2my2y15MfVEiaYmaDrmlHQUibM9oy tLGg787fncmanqEX7Z8idOoU66B4Oad62nE3dCzReTN8wowztKhMqdoeaASI5U5rmyNn dbvu9MS2KufZisPCop3V/wEzLdpp67YvzRuiA/tB2GK3Dz9et1/D4h77eWZV8xRGXe5r mjjQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-id:content-language:accept-language:message-id:date :thread-index:thread-topic:subject:to:from:dkim-signature; bh=KMShO0wb+udI2OuRox1Tjsmtmz2Vph9zoShFXdn8JTM=; b=JGRHJFTcjLeEqkDn8+NuFwCRMglfBRnVxSO/WA22aN416NG/cQsR3gm/N7lWL18nYs CNpHC33KUNmM2pf2/ObW2RKTqgo8vQZouPV5PGBCc1505s/MAB+Gx9ImQdYALAi9q/mU J670mMR0cfKtEcrr52QXkCh2fLwvHCxPYMFvBzmL1gBd2pGEPvqHAYWtcEUEW4A0UNgd ySk0RoVmXCD2QcWLjQRaA35F+4lm4mKoBQju/fSqrpaGEvRuW8T4MbTaZhRvf5P3sgYV QSz2sTM1j3fu6K1eWE+pseoEAeWICYZD3Ih0pkKRJdu4tyq7NeP7yE2rO4bNuzqpda2N tQFA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@live.com header.s=selector1 header.b=AN9m3pFJ; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=live.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n12-20020a170903110c00b00187073496b4si8426975plh.136.2022.12.02.07.58.21; Fri, 02 Dec 2022 07:58:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@live.com header.s=selector1 header.b=AN9m3pFJ; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=live.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233772AbiLBPjp (ORCPT + 99 others); Fri, 2 Dec 2022 10:39:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233357AbiLBPjn (ORCPT ); Fri, 2 Dec 2022 10:39:43 -0500 Received: from IND01-MAX-obe.outbound.protection.outlook.com (mail-maxind01olkn2049.outbound.protection.outlook.com [40.92.102.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 967D5C4609; Fri, 2 Dec 2022 07:39:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PJ0hCCzu6XvhrLBmo1AohcJwsSr2DEUAivDHu37fJxx9cTqtyEq6cUp4Mdo6oc+Sx0v90jWYlXEeod+ne9FUIfH1j8Y/dxSmtbOKPHZluGgJzydDs6QBgbKj+7qZxIfupwMQ0JH70NZtikttkETHZQejY6Xnl9zTguSUE5neYndS9eYgrO2Jl6QkraKU9GLdmyaA4iKOvnTqbFqxDRSlu65HTyGIsQOvj3xMxAT7kkMhcJTB6E4BPw2Cu746xaxVt60myleGKpGwQSif+DMw0aHTkAph9NKIh+AapnhhGY2Epancz8s9mlzf0PRVVn6b0iIyHR2KIvUIEUVcmg8kBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=KMShO0wb+udI2OuRox1Tjsmtmz2Vph9zoShFXdn8JTM=; b=EkYJ9T64lgHFFzDy1gu38hCsLhTffdqghI0/qmLS0j7EikG+RXcqlh4JuYeb4IGW6cySSuLHiuaMTIaF38rY+oUr6LYqFexEKwxPIUNATvY/ODTTjqS0zt2pAJx/LAsddwiLI53OwS/Z6Yk4nVXkBFdLUm+iTIOA3IHl6EzL1NBAzuKgcWnN2Yn/c3Iet+tgUTmk/2uBb+pZrLPtmdYxDRk4cAw1KIb2mwXuj0jIMb8Yb5xzOGvOZrlDCTM4IorswIWfFzICTxwyUtptQ6xBbseDOvhfFSJFscYTzzczV1XVrdNZAxNIc6qhIm/BKLvrFKFWSHS9YXb9QE3aMqYYrA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KMShO0wb+udI2OuRox1Tjsmtmz2Vph9zoShFXdn8JTM=; b=AN9m3pFJNmww5HGfZdoc45s0n4wjAaudhuENqGhf91WsvhwVgbZF9DRg+hgVjFNmCWCmBHCa+TB0qijN+mX6L33skzD1z26I0Kpe3+EAwUMNfITG5P0nR45reY8eVb3QUQh9i41U8CaRgPMI/Q9CPmQsWlCuLcNLAhwb0hSAhv4WVQpqPEskS1rSVulXXzZRyC2AP9XEehFbEEai9VuZMiImoQlaC7d2upd30KFCA+iQQllCEMT5YZ6BOGgBBRQWJNyJlbBdj5QMFIbh4UvWtucE8JD/o2zzURrdJvJHFTTve60NyT6DT+dbvbSq7sjyKhZ9x9N230VWn4WaWiUvEg== Received: from BM1PR01MB0931.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:2::9) by MA0PR01MB5699.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a01:6e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.10; Fri, 2 Dec 2022 15:39:36 +0000 Received: from BM1PR01MB0931.INDPRD01.PROD.OUTLOOK.COM ([fe80::68ba:5320:b72:4b1]) by BM1PR01MB0931.INDPRD01.PROD.OUTLOOK.COM ([fe80::68ba:5320:b72:4b1%4]) with mapi id 15.20.5880.008; Fri, 2 Dec 2022 15:39:36 +0000 From: Aditya Garg To: "willy@infradead.org" , "ira.weiny@intel.com" , "axboe@kernel.dk" , "akpm@linux-foundation.org" , "bvanassche@acm.org" , "keescook@chromium.org" , "songmuchun@bytedance.com" , "slava@dubeyko.com" , "torvalds@linux-foundation.org" , "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH] hfsplus: Fix bug causing custom uid and gid being unable to be assigned with mount Thread-Topic: [PATCH] hfsplus: Fix bug causing custom uid and gid being unable to be assigned with mount Thread-Index: AQHZBmRIDbExT15kfkG02K9S1mwlSg== Date: Fri, 2 Dec 2022 15:39:36 +0000 Message-ID: <93F5197D-2B61-4129-B5D4-771934F70577@live.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [qGIcFsK2jAfZEIJCdv6HbjZ2pJiz5h5vkEt+XfEQqHNrEaoAE7QLvsB2bKXt36Fm] x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BM1PR01MB0931:EE_|MA0PR01MB5699:EE_ x-ms-office365-filtering-correlation-id: 10179672-6efe-4560-80d1-08dad47b6acc x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: YynlAkdcoBt80rcsAoVg2cSDxl++TfMReX3Pyuuf/YYaK9XrBHvGXDG2DNA1VL54nkTjP9ZeqZL/3OqYk+bOeZitf+Y5Nw8O0yShEKXY60vkqFc5XHs1ZokoSCKxEkGaPjVleGaW+xFzk7sWrz61nvKivijkYqck4Ti5lUY6uVD6jCInd0eAIL0uJ6O+pT4G4PUN6UUQtFoW8aPn5uESKQn0WfIuZ45bIk3TUVwiybupocN0pGyQkgI8Y4l/J9Rr3eQ9hfUJpko7LRCIlmf0BIHkTHsUYqz3zacl76oYrMtjfjoGQCqAudx3gX6+XsxVEHRDRwD+iLfcQrRUiAUMaIysUBS7CFkI+hqx/JES+EVfaLHuvArxIqHqrJz4mTUbPVTCK75JKEDA/6/qBjFuQRCAy4rEjk/Tcr5+rTXQukSKdd88896As1fpR4Bgg7Tj5GmzuyPb46S4Ycd+E1y5qPRiYsZ0ocqeDJsbdkeHSdWRTnE9Xyt5N0ZcpvWn0RUEYNEMh4fN0vcBBZffAkD+TIcF+2InJCL4uKi0zjClezG5i0RiZw89W1ERBzJn0yo8qk8m9Irf7HhgI8vqf+B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d+VUda078Lpl8DumE9dbkBVXbNz+MyHduFhMsRjxe9pB2Ab4oq52+YD+/EVVDugk/bbQH9VBzDS+fwYHk5QUJCrT51sp/kGdT3p95OTgw/eqErSzb9khqTLB6xwAfCdCZoSDFsmuuKx2DxEupHr5n1Wo7lFiuccopN3a+nlA1G6SBvxtA5ZJPUCVlFXTQey1NRYOHNxfG/t0F0ZuBl5pIIB9g+QwK55MPhR+Ltudm4x3VTo+xb5Vu0ImZzaSW88z7b4otUsdoKcqTr7b4W+NDHfnGHdB5aZChg3zITwD4ZOcMjo8nz8v5quNiL4V3VvIAv/hFR2HKm5hwolUTYrZ7EPokSQH66xogHNT6Dn+TeSDQ== Content-ID: MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-42ed3.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BM1PR01MB0931.INDPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 10179672-6efe-4560-80d1-08dad47b6acc X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2022 15:39:36.3730 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MA0PR01MB5699 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751118475346228939?= X-GMAIL-MSGID: =?utf-8?q?1751118475346228939?= From: Aditya Garg Inspite of specifying UID and GID in mount command, the specified UID and GID was not being assigned. This patch fixes this issue. Signed-off-by: Aditya Garg --- fs/hfsplus/hfsplus_fs.h | 2 ++ fs/hfsplus/inode.c | 4 ++-- fs/hfsplus/options.c | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h index a5db2e3b2..6aa919e59 100644 --- a/fs/hfsplus/hfsplus_fs.h +++ b/fs/hfsplus/hfsplus_fs.h @@ -198,6 +198,8 @@ struct hfsplus_sb_info { #define HFSPLUS_SB_HFSX 3 #define HFSPLUS_SB_CASEFOLD 4 #define HFSPLUS_SB_NOBARRIER 5 +#define HFSPLUS_SB_UID 6 +#define HFSPLUS_SB_GID 7 static inline struct hfsplus_sb_info *HFSPLUS_SB(struct super_block *sb) { diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index aeab83ed1..4d1077db8 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c @@ -192,11 +192,11 @@ static void hfsplus_get_perms(struct inode *inode, mode = be16_to_cpu(perms->mode); i_uid_write(inode, be32_to_cpu(perms->owner)); - if (!i_uid_read(inode) && !mode) + if (test_bit(HFSPLUS_SB_UID, &sbi->flags)) inode->i_uid = sbi->uid; i_gid_write(inode, be32_to_cpu(perms->group)); - if (!i_gid_read(inode) && !mode) + if (test_bit(HFSPLUS_SB_GID, &sbi->flags)) inode->i_gid = sbi->gid; if (dir) { diff --git a/fs/hfsplus/options.c b/fs/hfsplus/options.c index 047e05c57..10a0bdacb 100644 --- a/fs/hfsplus/options.c +++ b/fs/hfsplus/options.c @@ -137,6 +137,7 @@ int hfsplus_parse_options(char *input, struct hfsplus_sb_info *sbi) return 0; } sbi->uid = make_kuid(current_user_ns(), (uid_t)tmp); + set_bit(HFSPLUS_SB_UID, &sbi->flags); if (!uid_valid(sbi->uid)) { pr_err("invalid uid specified\n"); return 0; @@ -148,6 +149,7 @@ int hfsplus_parse_options(char *input, struct hfsplus_sb_info *sbi) return 0; } sbi->gid = make_kgid(current_user_ns(), (gid_t)tmp); + set_bit(HFSPLUS_SB_GID, &sbi->flags); if (!gid_valid(sbi->gid)) { pr_err("invalid gid specified\n"); return 0;