Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2295071rwb; Fri, 2 Dec 2022 07:59:11 -0800 (PST) X-Google-Smtp-Source: AA0mqf7A9PhlBSKN7ZNGrm+VoI52K/2FmxJK9dc9og7XmgtMX0hO8swRbFfOtzD57zlvcXgoK3bX X-Received: by 2002:a63:f850:0:b0:477:f9fa:80cb with SMTP id v16-20020a63f850000000b00477f9fa80cbmr28800093pgj.118.1669996751023; Fri, 02 Dec 2022 07:59:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669996751; cv=pass; d=google.com; s=arc-20160816; b=jeBAP7GsXJJQfj0dpojUGUv9eP01Ng4dblGX6EWFpjS39P4UUSoPTe3Qvgc2bZmj7s xpuSGnxc/YbQYQ7O01xghIF1h+V6vHNom78pFbwAw/cfHIzBSAXv6oytrHL5g9mSmTbR gAnm9qKvadITUFyxQFs5M6/GHYxj4EAS4CCaStGMdwGNOFEphLtbFRMOxHkK6fEaffM+ PrjGnsKIITPKL7EDbPhBxyw0JyuQ2UjiVEpV7KgmmPMjh0GEVAKxrMUsALbpw2SXB9Tb gIXKR6fkWidRnMwuzxIK+2St18P9h9KD2WlJAWQVceEPUVBU/I7j5y2gXE3d2vaz3SG5 J+oA== 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 Return-Path: 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.59.00; Fri, 02 Dec 2022 07:59:11 -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 + 82 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+BY+48nqT8qRZBYIYPdH1zW4ow= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?b1xeTkTd0FJ+eAu7N2QdH+A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-ascii?Q?LdE3nRAM5LcYXyBWCUeSpc/rmNCtnLlVECWGP2cFRxpgWsiNSvuPxC965juE?= =?us-ascii?Q?ofl6D2DJD/I8FMks/Tpmuzi+nPezPodsX2cE9WFngd+VUda078Lpl8DumE9d?= =?us-ascii?Q?bkBVXbNz+MyHduFhMsRjxe9pB2Ab4oq52+YD+/EVVDugk/bbQH9VBzDS+fwY?= =?us-ascii?Q?Hk5QUJCrT51sp/kGdT3p95OTgw/eqErSzb9khqTLB6xwAfCdCZoSDFsmuuKx?= =?us-ascii?Q?2DxEupHr5n1Wo7lFiuccopN3a+nlA1G6SBvxtA5ZJPUCVlFXTQey1NRYOHNx?= =?us-ascii?Q?fG/t0F0ZuBl5pIIB9g+QwK55MPhR+Ltudm4x3VTo+xb5Vu0ImZzaSW88z7b4?= =?us-ascii?Q?otUsdoKcqTr7b4W+NDHfnGHdB5aZChg3zITwD4ZOcMjo8nz8v5quNiL4V3Vv?= =?us-ascii?Q?IAv/hFR2HKm5hwolUTYrZ7EPokSQH66xogHNT6Dn+TeSDQ=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable 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 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 =20 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 =3D be16_to_cpu(perms->mode); =20 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 =3D sbi->uid; =20 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 =3D sbi->gid; =20 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_s= b_info *sbi) return 0; } sbi->uid =3D 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_s= b_info *sbi) return 0; } sbi->gid =3D 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; --=20 2.38.1