From patchwork Wed Dec 7 03:05:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Garg X-Patchwork-Id: 30609 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3181780wrr; Tue, 6 Dec 2022 19:07:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf5s63DiQR+z5188g9w/OxCgyeSVOikW16KujMToFcijRzuPHz010IPFlGBgwDocpLyKo79i X-Received: by 2002:a17:902:ea82:b0:189:9bb4:70 with SMTP id x2-20020a170902ea8200b001899bb40070mr39408622plb.108.1670382459740; Tue, 06 Dec 2022 19:07:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1670382459; cv=pass; d=google.com; s=arc-20160816; b=a4YCmHLmEEifyWWvJwKYTcDGKu8vmICdpNIe7nsfmLJxf5V6rmV3vEj8XCw+/laWYk FDb5PGqUyrV6DuSw61F/Ls1L3RRfhMuQR7dFYtbYx7BjEsmAqz3KlgHT/+en6Z/D1/6q HKYzJpW0ymnzxg5ZcmYVsHaDPEQXCEhA3WGdOLPldVc09GPC9xaQbtq38/ZQGiuK0nme NAVZv2Sv8Y3t3ObIiylo6RvGVyXwGBoyG66ZZp/1d3rN19e6c9Jjf5l3qFQNqJm6nBmU NWe5g8a8r+2821frhH3d5KMo6ll1sExQ0QbNwWZYbaqeLUly/OpKLCNabaXiYvv9HJAC Jxjg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d16-20020a170903231000b0017f61ac5a53si12114290plh.111.2022.12.06.19.07.24; Tue, 06 Dec 2022 19:07:39 -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 + 99 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+P7Yh8iirLN47i8Aep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VcY0XxXgh0UVZv51DiJytgmubQV2/gdY0ZES8W2JPFn7AMobLY0vrX8f7J+gPzME2jvvOVK5qY/DKmZ/ggm+MQQz2y5frcS8RXYCUxbobOsXfX+mWrbJFjl4Vu1Tsj8r38PWUGa04AT3i/K8YBunQrpoZlmbsR6Ui7OCI8lpxu3+AehU8z+IVtR/JrDi8PXo5L6u11zpCavt+E8y44TJU0scxSf/dZyQDV1rIAGvH3sTC26glHNXv5f/UMP3pEdXtIoVq04K6vh7fIxxRMZeCNmEP+0TsZftaLDpb5eNy3KNGBjLYxhqeIwLFWeQ== 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: 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751118475346228939?= X-GMAIL-MSGID: =?utf-8?q?1751522958063643690?= 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 Reviewed-by: Viacheslav Dubeyko --- 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 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 = 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)) || (!i_uid_read(inode) && !mode)) 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)) || (!i_gid_read(inode) && !mode)) inode->i_gid = sbi->gid; 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_sb_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_sb_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: