Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1399548rwb; Wed, 7 Dec 2022 12:33:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf6j6cXEDx/9InpWkq0tOrEnB7mtJo6+8OA86ju3Tn/UztcmDdiJ76FzRBmN7pOEC/TnW06D X-Received: by 2002:a05:6402:c8f:b0:46c:7f80:5417 with SMTP id cm15-20020a0564020c8f00b0046c7f805417mr16238475edb.353.1670445207870; Wed, 07 Dec 2022 12:33:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670445207; cv=none; d=google.com; s=arc-20160816; b=Mm+AnCnTubWS12ZDQi0prPxwp/gdS9LFSzh7yCxoLnIEsuDKIKCdoTjo9Ye/qbY1YN zGBoY5sqcLR7VAjfyur/ffemx27rZBgPOUNHpSqGM1N2bhZv9TvX5QEK5KSKCQL+Z3Y5 qZ2XEgk/15TSY8ey49coNSi+ddIcClquVPeP505gVlxsydDlVOKLBizDc0iiH2ZswcQF dEPoXVLaWk93mi0kr2M8lxwItLEMU/Lj6ClbgwkVqDsG9EhhKNpgWB3R6jhlTF5pxQSZ qa3iNO+oPEDyVDZwYvAgjwjzaRcMCx6g0RDThuO9adtM+c/eOwG1905bfKiy4pUPEaUe OxrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=sEx8KSd6M/54L2Poz9MZcu5n+KLYE7RdzT7Oy3ZvWZQ=; b=NFPVyviw28RsP4TKLmMc/PwPG3UB2F/iJvUqV7REXCw640YDeI/TlsiRtCIvCipXb3 98I+MO6P3ootJ8itwRn6tnz+serKEd0CnlP/HCxIpQ2b2ox2yo6EWhNiNlDsscIO+DAq OeR7FdT5uDL150EdPR4gTkbtY75ZopUMqdRf9riF50w2rDFPP2E0uywGNBK6BjZlBnCo Ms86TDylBq6nuDNFruGvC7luxmLs18/zYarqp9Aw54GNuX4IWTb9DEEYVQBSxzh9baYu ZiLXHdDAA+1cWSOlBifQ98Nbqmx/yTCSjHFQE9MEHfOKvxvATS2QXcf9x6iQGPG8hAU1 0iTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dubeyko-com.20210112.gappssmtp.com header.s=20210112 header.b=a5vOlXF4; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t18-20020a056402525200b0046194b2dd53si5864892edd.119.2022.12.07.12.33.10; Wed, 07 Dec 2022 12:33:27 -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=@dubeyko-com.20210112.gappssmtp.com header.s=20210112 header.b=a5vOlXF4; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229787AbiLGURX (ORCPT + 74 others); Wed, 7 Dec 2022 15:17:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229660AbiLGURV (ORCPT ); Wed, 7 Dec 2022 15:17:21 -0500 Received: from mail-oa1-x32.google.com (mail-oa1-x32.google.com [IPv6:2001:4860:4864:20::32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2964E0F3 for ; Wed, 7 Dec 2022 12:17:18 -0800 (PST) Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-1445ca00781so16049934fac.1 for ; Wed, 07 Dec 2022 12:17:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dubeyko-com.20210112.gappssmtp.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=sEx8KSd6M/54L2Poz9MZcu5n+KLYE7RdzT7Oy3ZvWZQ=; b=a5vOlXF4JUZQNcWlhUdUDAYIBDZv3IOLAFAohW2XoI9rwR2X/VY+H/ux3VztfMOa+R AZTbIM+LMvqOtkmZNUbuzrHzc9rHPn2VqNKudM3wOBvaEQiT37vQgwc0jv7fRDBwI/vL SwNgjOIPO8MEglyt8a/h6z6qaGa3NzUSXrp5R1DcJhgidyLvVmQ2kaKikujz3gP+arId ck3qW5vXsxcih8tDzy8OpjkC30cXzc0fSb9aG6ruDr/3+91ATWYscyGf0HQ9y0+bPnZC xLHa8eRRByKUoxkgvLRhlM6hcGSt3AZirBLPy7mNCncKundokUcQ5UhZ8KMjszYxA+8z 1DIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sEx8KSd6M/54L2Poz9MZcu5n+KLYE7RdzT7Oy3ZvWZQ=; b=vry45h/WdJyGIE63WD6DbQAegeI6SPiPBSzm/HxiD9tibBwyS4St90y8ai45LUxf61 TCb/o5i9thguLHKfH4/glmyD23Ammjm03MxUOvlTDPBLKMJlzzbJrRr4iCVhP9iiLXD4 D5R4zYnuGnHIRciOKLDQ5TK6VtONvX9O1/3KCOmmEX24mVZ9X1bf13iDfrxTcUDN9N05 u5yuNUr/ml+Ai0X4gQALQhXpWCkyv2jXaLxlJDb9Wl5W9taDahujbo0znHTPtDhpeZoZ i1eRmqiEsxAiUxYcJkiy5tSJrPxM89ibx6kI2YE4IUr1GxZZ+Bu5j+9PlwWS2PFxTt3Z Mszg== X-Gm-Message-State: ANoB5pn1Y1Wqu/15VN0SjL4qe2hvjdR+Ae1awz24rWdf/VnGRawdUb47 /xPK7Wl16NNOLsgqeNjoFvQz+Q== X-Received: by 2002:a05:6871:a6a1:b0:144:1f08:c66b with SMTP id wh33-20020a056871a6a100b001441f08c66bmr16700065oab.279.1670444237949; Wed, 07 Dec 2022 12:17:17 -0800 (PST) Received: from smtpclient.apple (172-125-78-211.lightspeed.sntcca.sbcglobal.net. [172.125.78.211]) by smtp.gmail.com with ESMTPSA id eo7-20020a056870ec8700b001446a45bb49sm7767366oab.23.2022.12.07.12.17.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Dec 2022 12:17:17 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: Re: [PATCH v2] hfsplus: Fix bug causing custom uid and gid being unable to be assigned with mount From: Viacheslav Dubeyko In-Reply-To: Date: Wed, 7 Dec 2022 12:17:14 -0800 Cc: "willy@infradead.org" , "ira.weiny@intel.com" , "axboe@kernel.dk" , Andrew Morton , "bvanassche@acm.org" , "keescook@chromium.org" , "songmuchun@bytedance.com" , "torvalds@linux-foundation.org" , "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Content-Transfer-Encoding: quoted-printable Message-Id: <082FE5D4-5B72-4B4F-AC00-E0D52C7F8758@dubeyko.com> References: <93F5197D-2B61-4129-B5D4-771934F70577@live.com> To: Aditya Garg X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 > On Dec 6, 2022, at 7:05 PM, Aditya Garg wrote: >=20 > From: Aditya Garg >=20 > Despite specifying UID and GID in mount command, the specified UID and = GID > were not being assigned. This patch fixes this issue. >=20 > 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(-) >=20 > 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) && !mode)) > 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) && !mode)) > 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_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: > --=20 > 2.38.1 >=20 Looks good. Reviewed-by: Viacheslav Dubeyko Thanks, Slava.