Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7912209rwb; Tue, 6 Dec 2022 11:24:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf6FT5oGy604PXOUxrKKOYKFgtz0J2/yvP3YF5Z2/d0fi79y0ujL/Afi+8z9gg2H1NphqjZm X-Received: by 2002:a17:906:1b55:b0:7c1:ac7:a57a with SMTP id p21-20020a1709061b5500b007c10ac7a57amr3811465ejg.348.1670354670092; Tue, 06 Dec 2022 11:24:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670354670; cv=none; d=google.com; s=arc-20160816; b=ZAhCjYacBSf5REyfa3L8PcQiBBi0dyVz5EQfcXIFQ6SJTDVPXLFEj5RkllYLxlcoP+ 4eafg9v9Ehuwb2q+kidNwJRzaLej3/oqCh3349REPFtoeHzHQtWQSrvHk4552epzkaNE 3RXIfqO+FnpUNc31oa/dIt2uFRTsqFNRo7ExadFTHApPT0K6Dj2LwlNGBgiTlKJbCTmW HvR26Td/uVlcn8qgyghstzth4t/nj3d7N00bYDjd2Dq/RI0CBLK5w97Rn7rsFGyQ44Tk lSJ5FwbD64cVB/wmts/0pIHdyI6PRgmVNRbGbzLAmQEKNFenBAAZ69xt2i+QEYLB6187 tGVw== 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=bU0gQfsK0E6aJJop8DI/xus0uNp8ZM/+6s5+M9zf97w=; b=XK3g0mvNm4yq3RdslrjGhYITylgwELzgAYXhkWtZ/U0Tw8XqDf2NNRF+tBcG/ClNbX J3WNSTWTpo2XzjYK5IwXmMCiWeK5D/EEEfGSU+anTs5brn3GxfK3S8n4WDyloUidYMET nthzATbuUxrVG0ECW4zjMLWdWg2NPh1uJ1bjYR3X672aSU9GsegR8NCdGxbxOXm/18jW XKFTi2u2PjLzDLy+Q/nY7xMYOodM4ZLkamlhSSpuKpgW5uZ7cTD4TtPSDbboxmIvAR7y NLXGlNX9XxKyI6NvZI/sZajs5dTFmJaKxNwWBIHV0xfXJCv/se5XxiWoE5muMtG1hffl +35Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dubeyko-com.20210112.gappssmtp.com header.s=20210112 header.b=tLlaf1dw; 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 l7-20020a056402028700b0046cd7eb435asi2395059edv.172.2022.12.06.11.24.11; Tue, 06 Dec 2022 11:24:29 -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=tLlaf1dw; 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 S229588AbiLFS5Q (ORCPT + 77 others); Tue, 6 Dec 2022 13:57:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229600AbiLFS5D (ORCPT ); Tue, 6 Dec 2022 13:57:03 -0500 Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90BBC36C5A for ; Tue, 6 Dec 2022 10:57:02 -0800 (PST) Received: by mail-qt1-x830.google.com with SMTP id a27so14453724qtw.10 for ; Tue, 06 Dec 2022 10:57:02 -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=bU0gQfsK0E6aJJop8DI/xus0uNp8ZM/+6s5+M9zf97w=; b=tLlaf1dwu3SlkhotUHfUNlmo1t5xLPhK1VlQAdE2WqRVHAjLdo8MJQOg54c/Xuc1EA pBfezwSIBtT0KawNQ08im1uUvnO0e4+9bs+ecmiIjyBQuSZFmg1eiqBgUKiytUzD18UG Enygyhv4lYnO/bnPdIrM9ZGCKYwie5aI0iLWj+q+bVu0qZGFnJXSG4y8giyLo3RjGQBv l3JDzbQdzmDuSGI4e62Ll+wAqcyLp1lK4Sp/z5umf7aI8BCMn28IFhh7qcf+d6wNL8NV zQtCwc7RDRyoU4or6QLm43/P5+14an6HT8LCbA5gLVmeqtuIeHJ+CiXJvUnzFzt5mY9M hEXg== 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=bU0gQfsK0E6aJJop8DI/xus0uNp8ZM/+6s5+M9zf97w=; b=T4wsOfqqbOeJo6QYaEAlIjsCyoLZm/sVSfcBTT1NEa73qJvj6/A/k3mP38BQQaNhc3 Zwvt4oLqOJHfb8gjxFZWcro/Gpn3SFZWSVtaNnPK9HSSa/ifgUfaAyAkkMH8+Cym+Fb3 XMdMhmTOYUpnCl0nqhZGNS6clmg5dbQMS4XBd8GPQOBsvePiZoqO2bmYn7Rbls0nwY4a wlgXRe9pyvQwMv+U5Z2Izeuct9awZyz9pOhgHss1J/wRBNBYtdkNIP0G5GM0ty224sk8 S0zCPyEgsCj+biGNj4yrlggFim5fZGXy0Pylgapmvr/DArlYUpml5/21oU59P5i4dE/g +HKg== X-Gm-Message-State: ANoB5pnX6SiXqKyejoTGFGrW7s2p711dYZgGZ4xtmbv8N43KKzsCOLHN +zITuQ1tPike3slvsi4GCY8Mgw== X-Received: by 2002:ac8:66d4:0:b0:3a5:3388:4093 with SMTP id m20-20020ac866d4000000b003a533884093mr81388299qtp.262.1670353021544; Tue, 06 Dec 2022 10:57:01 -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 z18-20020ac87112000000b0039853b7b771sm12222875qto.80.2022.12.06.10.56.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Dec 2022 10:57:00 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: Re: [PATCH] hfsplus: Fix bug causing custom uid and gid being unable to be assigned with mount From: Viacheslav Dubeyko In-Reply-To: Date: Tue, 6 Dec 2022 10:56:56 -0800 Cc: "willy@infradead.org" , "ira.weiny@intel.com" , "axboe@kernel.dk" , "akpm@linux-foundation.org" , "bvanassche@acm.org" , "keescook@chromium.org" , "songmuchun@bytedance.com" , "torvalds@linux-foundation.org" , "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Transfer-Encoding: quoted-printable Message-Id: <20EA622D-12B9-49B6-8564-C8EE2A2329D2@dubeyko.com> References: <93F5197D-2B61-4129-B5D4-771934F70577@live.com> <55A80630-60FB-44BE-9628-29104AB8A7D0@dubeyko.com> <1D7AAEE4-9603-43A4-B89D-6F791EDCB929@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=unavailable 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 12:49 AM, Aditya Garg = wrote: >=20 >>=20 >> Well initially I when I tried to investigate what=E2=80=99s wrong, = and found that the old logic was the culprit, I did some logging to see = what exactly was wrong. The log patch is here btw :- = https://github.com/AdityaGarg8/linux/commit/f668fb012f595d83053020b88b9439= c295b4dc21 >>=20 >> So I saw that the old logic was always false, no matter whether I = mounted with uid or not. >>=20 >> I tried to see what makes this true, but couldn't succeed. So, I = thought of a simpler approach and changed the logic itself. >>=20 >> To be honest, I dunno what is the old logic for. Maybe instead of = completely removing the old logic, I could use an OR? >>=20 >> If you think its more logical, I can make this change :- >>=20 >> - if (!i_gid_read(inode) && !mode) >> + if ((test_bit(HFSPLUS_SB_UID, &sbi->flags)) || = (!i_uid_read(inode) && !mode)) >>=20 >> Thanks >> Aditya >>=20 >>=20 >=20 > I continuation with this message, I also think the bits should be set = only if (!uid_valid(sbi->uid) is false, else the bits may be set even if = UID is invalid? So, do you think the change given below should be good = for this? >=20 > 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: Looks reasonably well. I believe it=E2=80=99s better fix. Thanks, Slava.