Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp197112rwb; Tue, 6 Dec 2022 19:33:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf7CSvDgBgien3vcTfBEUmLcvGakqWwSrvugSHeGTI8anFQhdxU67oMqdXlp3MCHrkP0m2Ve X-Received: by 2002:a17:906:1310:b0:7c0:c5e9:634d with SMTP id w16-20020a170906131000b007c0c5e9634dmr17854037ejb.220.1670384008301; Tue, 06 Dec 2022 19:33:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1670384008; cv=pass; d=google.com; s=arc-20160816; b=rdRsYtWPm3E22mNfU+CXyv7jmoD55G0kmUA1pNQU/aVYqsZ9JqfcLV4Fv51xiK08qN FZwxldTagXe1YwjM7MYnixssSSvORbzo3A1fbh2iVRC5F8QcvsrFIQ6T030YbDhpE45Y vzztfBOgELJgEIbOsksFeX5ONHPhEdDieIXj2YEIF9WBjweHQhqbGtAXry+bzZBqRGVt o+K+BPj0LXBtLBsDfBbcwkYX6Zn+v2Djjd3+VKaidc6YCUmXiAZW8jnsrLKrtcEkCXZK tneD03BFpA2nPMldazMXhd0SZKXqckiWivjaRERF0Pa4mEF6lmR7VKitL/6h5Wsw10dK FOrg== 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:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=yBZqd97XlB19KWL/nC59Tqv+Za36KpH38qQZDrr13fg=; b=t+f7LQjfi1Xyr8kyFCsq7KINJptELUdykNTwZqzmT1DysOA4qpo9a6LiGLnnbXe3c7 K1XzwAreqlT6LUkkXULibdoVB2qvoxEmZKTzvacMuFP/3OCgfa8GI/gdKLM8kr5DjES2 k87e2HjnHrXMmmbwcJkmqcGKc96jOAld18GgkdvCKg5ggi414I33KKf7oiPAzZvG90so S8sCZoC5V/wFhwjJHivumJriHOBE8wRBQJSuFAnr3dN0MH3rgSE14+eNbPIKhpXAlT6N RvZk/0m1PR/bzHZql6TZweNSDCqDYnvrLrSuGaizWmlK7iaGUqthqTGIJ3Mfgnn7BCZp 6btQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@live.com header.s=selector1 header.b=YIopbJVS; 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 h12-20020a05640250cc00b00463c29b153dsi3964463edb.297.2022.12.06.19.33.07; Tue, 06 Dec 2022 19:33:28 -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=YIopbJVS; 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 S229679AbiLGDFt (ORCPT + 78 others); Tue, 6 Dec 2022 22:05:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229500AbiLGDFr (ORCPT ); Tue, 6 Dec 2022 22:05:47 -0500 Received: from IND01-BMX-obe.outbound.protection.outlook.com (mail-bmxind01olkn2069.outbound.protection.outlook.com [40.92.103.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F68D537D0; Tue, 6 Dec 2022 19:05:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FW0JtyLMwkASaNF9u25WjZ13obXd4FMZs8KCP+4qjuQQSp1ch5yzPTihlYos34I6/tlcb/i1nWMXwMcBjgUwYo7I1+j0LOKl51fB8JI3JOJuiFKv9hTSJO5AVeqQc/9NoJJ2pKjXSpKgFrvKXR+AQOOe+He6fapYPlUgWe/EZn+v+goIFCGqMPAPhyGOgavYZwJIcEBmS1kBl36FTnZdDZcyz3cmd7TpH+2slPKbATiT4e7bTb0uTUkSSUIE5uBe6t+XrfL3Gb66AlWkq5WhW+9NmkYg7nXYSvWoyka1yWbN8tzGP+Dq/rZM6cLD07yvGW+ufyXSDw+jb6S4qfbxvw== 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=yBZqd97XlB19KWL/nC59Tqv+Za36KpH38qQZDrr13fg=; b=kXKJSKQyd15wKTzL8oLdlPRSP+J5P4Rq+lSKAkhYTOCbNgdeDdkx1C561VkcGZHGNCgCRk86X8OROx1uzRe+ptIL8bPkv/kvpTU+B6AH1wVR20Zq5rcjVjm0N8clOy8EYUVIH5868Gwrt3VNLfIcd5GNDQ9is2u/DX3bjg9i29uOfDNWAt5ZH3i3Nye9BupNv//O83Ak/myPyT2ZAXKny0YGM5TrZ051EEWs5pmslgcrhFwK+M4uQlJuhbH77UPkeFVswPW9c2dcgqUxeKP5xrtpx3UW3oIk0cjjEi/CHHmAJ5s89XDlqUbyGsN5Bx0KYcJSDxHhCPzPGhshALbkiw== 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=yBZqd97XlB19KWL/nC59Tqv+Za36KpH38qQZDrr13fg=; b=YIopbJVSAcOUZJW4WoaS0+ucDyeXkNQTVoioglxa8mbHhEoy8XOXLfx3g53GSMg+8twS+AbEMfkmi4Rq/rSNF0dXX8r1XGYwtWDLoXLso7gJG/Z1dVIUrXUAVE+LBmboJr0W83xtmXSoSZZH23D2bPQYkS9F99wRWe+LkTzHfGp1sW7KLCSDuwPCqlSMzqQgFaZFhM/hXiUEo8o/U91hnqxci/bsMGcMl10/bjvebacgZ7G0l2EIzDhHCZ0lfCtYKwqUiX/DpNhOxQKKGig9bX1RWGg3gWMP+itD+oFM1aO/aJ/5pKoXA3NpxjstXlGvUvltn4NlvlUYdM4jYUv1fg== Received: from BM1PR01MB0931.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:2::9) by PN2PR01MB8896.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:115::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.13; Wed, 7 Dec 2022 03:05:40 +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.014; Wed, 7 Dec 2022 03:05:40 +0000 From: Aditya Garg To: "willy@infradead.org" , "ira.weiny@intel.com" , "axboe@kernel.dk" , Andrew Morton , "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" CC: "stable@vger.kernel.org" Subject: [PATCH v2] hfsplus: Fix bug causing custom uid and gid being unable to be assigned with mount Thread-Topic: [PATCH v2] hfsplus: Fix bug causing custom uid and gid being unable to be assigned with mount Thread-Index: AQHZCejJlmiHexwDakaNkSkAkua99g== Date: Wed, 7 Dec 2022 03:05:40 +0000 Message-ID: References: <93F5197D-2B61-4129-B5D4-771934F70577@live.com> In-Reply-To: <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: [2FX15KG/udpB6oHqPI64CcVIQXyAA36W] x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BM1PR01MB0931:EE_|PN2PR01MB8896:EE_ x-ms-office365-filtering-correlation-id: c90fc2b9-1899-4e0c-c3ff-08dad7ffec41 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: LmDYvvOkibVtpqUYwZuJ6pGMe4+wJGGeApLkh1URmcPFGwoEPGE9y+XqUwNxgOpPHPRIuI2/xRHknX8EHKcV+hgcdI/6OnSvho+2U8CYyvKs3AiM0z6ZcAx1tIjNOH2/c8b3HnC/YldNykdoPeYeAQcYt4v46vWWNjPOIZdVCEAJIoRxl8obC5hcK40YaXe5cTmD+lNmXjZy5Pb/P+V+dOb9MtYa4fGVhezxAMcoZ8onfwS6oNnvO5mvSsgDIOMEEzKh5kToojPKpirHe5VmxeXDy96um/OR+ryLwGDexdjq1TBE3w+dLBiMPoWXaqoY0MCQjiM4gCN+JjHaJKiPpXiIosm39QFViV7TPSSKzmIRgUNf3qgrm8niSvGg6NxSFtI/b2SYw+T6PEah2gJ+8G5msqwx9j6xqRSQafEe5LWvVT+DR3UUTyXa/eZg4o5csGGeIuzOQ/bQjSBH0xjbM2MyeY0NbpsV6nqQoVZ6fTtolatasRcYdJ0jzrwLHT73JHAUKL/IL0Hyl8y6tbUDkzxwtFTr+bw+P7Yh8iirLN47i8AepO3QOVjCa6pAeXtw2P5px1EPuIB1Xi6glZuaNA== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?mUeoj/cv8oAlhiqhx6gkOqkpUZ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-ascii?Q?IYOWc6TTpH38i2iO7O77eqiElulRF74accQ5r9UT2Ukgd3xDyCYcl1/NnkY/?= =?us-ascii?Q?XCxA+Oajr2RnW62FxDQCvTIA5HVcY0XxXgh0UVZv51DiJytgmubQV2/gdY0Z?= =?us-ascii?Q?ES8W2JPFn7AMobLY0vrX8f7J+gPzME2jvvOVK5qY/DKmZ/ggm+MQQz2y5frc?= =?us-ascii?Q?S8RXYCUxbobOsXfX+mWrbJFjl4Vu1Tsj8r38PWUGa04AT3i/K8YBunQrpoZl?= =?us-ascii?Q?mbsR6Ui7OCI8lpxu3+AehU8z+IVtR/JrDi8PXo5L6u11zpCavt+E8y44TJU0?= =?us-ascii?Q?scxSf/dZyQDV1rIAGvH3sTC26glHNXv5f/UMP3pEdXtIoVq04K6vh7fIxxRM?= =?us-ascii?Q?ZeCNmEP+0TsZftaLDpb5eNy3KNGBjLYxhqeIwLFWeQ=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: c90fc2b9-1899-4e0c-c3ff-08dad7ffec41 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Dec 2022 03:05:40.6399 (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: PN2PR01MB8896 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 Despite specifying UID and GID in mount command, the specified UID and GID were not being assigned. This patch fixes this issue. Cc: stable@vger.kernel.org Signed-off-by: Aditya Garg --- fs/hfsplus/hfsplus_fs.h | 2 ++ fs/hfsplus/inode.c | 4 ++-- fs/hfsplus/options.c | 4 ++++ 3 files changed, 8 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..b675581aa 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)) || (!i_uid_read(inode) && !mo= de)) 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)) || (!i_gid_read(inode) && !mo= de)) inode->i_gid =3D sbi->gid; =20 if (dir) { diff --git a/fs/hfsplus/options.c b/fs/hfsplus/options.c index 047e05c57..c94a58762 100644 --- a/fs/hfsplus/options.c +++ b/fs/hfsplus/options.c @@ -140,6 +140,8 @@ int hfsplus_parse_options(char *input, struct hfsplus_s= b_info *sbi) if (!uid_valid(sbi->uid)) { pr_err("invalid uid specified\n"); return 0; + } else { + set_bit(HFSPLUS_SB_UID, &sbi->flags); } break; case opt_gid: @@ -151,6 +153,8 @@ int hfsplus_parse_options(char *input, struct hfsplus_s= b_info *sbi) if (!gid_valid(sbi->gid)) { pr_err("invalid gid specified\n"); return 0; + } else { + set_bit(HFSPLUS_SB_GID, &sbi->flags); } break; case opt_part: --=20 2.38.1