mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aditya Garg <gargaditya08@live.com>
To: Viacheslav Dubeyko <slava@dubeyko.com>
Cc: "willy@infradead.org" <willy@infradead.org>,
	"ira.weiny@intel.com" <ira.weiny@intel.com>,
	"axboe@kernel.dk" <axboe@kernel.dk>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"bvanassche@acm.org" <bvanassche@acm.org>,
	"keescook@chromium.org" <keescook@chromium.org>,
	"songmuchun@bytedance.com" <songmuchun@bytedance.com>,
	"torvalds@linux-foundation.org" <torvalds@linux-foundation.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] hfsplus: Fix bug causing custom uid and gid being unable to be assigned with mount
Date: Tue, 6 Dec 2022 08:49:34 +0000	[thread overview]
Message-ID: <CD80923F-4422-416B-AAC1-A676D37C564F@live.com> (raw)
In-Reply-To: <FBF299DB-E235-4BD3-82BD-5A54EE9E26DA@live.com>


> Well initially I when I tried to investigate what’s 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/f668fb012f595d83053020b88b9439c295b4dc21
> 
> So I saw that the old logic was always false, no matter whether I mounted with uid or not.
> 
> I tried to see what makes this true, but couldn't succeed. So, I thought of a simpler approach and changed the logic itself.
> 
> To be honest, I dunno what is the old logic for. Maybe instead of completely removing the old logic, I could use an OR?
> 
> If you think its more logical, I can make this change :-
> 
> -	if (!i_gid_read(inode) && !mode)
> +	if ((test_bit(HFSPLUS_SB_UID, &sbi->flags)) || (!i_uid_read(inode) && !mode))
> 
> Thanks
> Aditya
> 
> 

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?

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:


  reply	other threads:[~2022-12-06  8:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-02 15:39 Aditya Garg
2022-12-02 20:52 ` Viacheslav Dubeyko
2022-12-03  7:56   ` Aditya Garg
2022-12-06  0:35     ` Viacheslav Dubeyko
2022-12-06  8:12       ` Aditya Garg
2022-12-06  8:49         ` Aditya Garg [this message]
2022-12-06 18:56           ` Viacheslav Dubeyko
2022-12-07  3:04             ` Aditya Garg
2022-12-07  3:05 ` [PATCH v2] " Aditya Garg
2022-12-07 20:17   ` Viacheslav Dubeyko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CD80923F-4422-416B-AAC1-A676D37C564F@live.com \
    --to=gargaditya08@live.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=ira.weiny@intel.com \
    --cc=keescook@chromium.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=slava@dubeyko.com \
    --cc=songmuchun@bytedance.com \
    --cc=torvalds@linux-foundation.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®