+ isofs-fix-setting-of-uid-and-gid-to-0.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     isofs: fix setting of uid and gid to 0
has been added to the -mm tree.  Its filename is
     isofs-fix-setting-of-uid-and-gid-to-0.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: isofs: fix setting of uid and gid to 0
From: Jan Kara <jack@xxxxxxx>

isofs allows setting of default uid and gid of files but value 0 was used
to indicate that user did not specify any uid/gid mount option.  Since
this option also overrides uid/gid set in Rock Ridge extension, it makes
sense to allow forcing uid/gid 0.  Fix option processing to allow this.

Cc: <Hans-Joachim.Baader@xxxxxx>
Signed-off-by: Jan Kara <jack@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 fs/isofs/inode.c |   26 ++++++++++++--------------
 fs/isofs/isofs.h |    2 ++
 2 files changed, 14 insertions(+), 14 deletions(-)

diff -puN fs/isofs/inode.c~isofs-fix-setting-of-uid-and-gid-to-0 fs/isofs/inode.c
--- a/fs/isofs/inode.c~isofs-fix-setting-of-uid-and-gid-to-0
+++ a/fs/isofs/inode.c
@@ -148,6 +148,8 @@ struct iso9660_options{
 	unsigned int blocksize;
 	mode_t fmode;
 	mode_t dmode;
+	char uid_set;
+	char gid_set;
 	gid_t gid;
 	uid_t uid;
 	char *iocharset;
@@ -365,6 +367,8 @@ static int parse_options(char *options, 
 	popt->nocompress = 0;
 	popt->blocksize = 1024;
 	popt->fmode = popt->dmode = ISOFS_INVALID_MODE;
+	popt->uid_set = 0;
+	popt->gid_set = 0;
 	popt->gid = 0;
 	popt->uid = 0;
 	popt->iocharset = NULL;
@@ -443,11 +447,13 @@ static int parse_options(char *options, 
 			if (match_int(&args[0], &option))
 				return 0;
 			popt->uid = option;
+			popt->uid_set = 1;
 			break;
 		case Opt_gid:
 			if (match_int(&args[0], &option))
 				return 0;
 			popt->gid = option;
+			popt->gid_set = 1;
 			break;
 		case Opt_mode:
 			if (match_int(&args[0], &option))
@@ -805,6 +811,8 @@ root_found:
 	sbi->s_showassoc = opt.showassoc;
 	sbi->s_uid = opt.uid;
 	sbi->s_gid = opt.gid;
+	sbi->s_uid_set = opt.uid_set;
+	sbi->s_gid_set = opt.gid_set;
 	sbi->s_utf8 = opt.utf8;
 	sbi->s_nocompress = opt.nocompress;
 	sbi->s_overriderockperm = opt.overriderockperm;
@@ -1098,18 +1106,6 @@ static const struct address_space_operat
 	.bmap = _isofs_bmap
 };
 
-static inline void test_and_set_uid(uid_t *p, uid_t value)
-{
-	if (value)
-		*p = value;
-}
-
-static inline void test_and_set_gid(gid_t *p, gid_t value)
-{
-        if (value)
-                *p = value;
-}
-
 static int isofs_read_level3_size(struct inode *inode)
 {
 	unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
@@ -1360,8 +1356,10 @@ static int isofs_read_inode(struct inode
 	if (!high_sierra) {
 		parse_rock_ridge_inode(de, inode);
 		/* if we want uid/gid set, override the rock ridge setting */
-		test_and_set_uid(&inode->i_uid, sbi->s_uid);
-		test_and_set_gid(&inode->i_gid, sbi->s_gid);
+		if (sbi->s_uid_set)
+			inode->i_uid = sbi->s_uid;
+		if (sbi->s_gid_set)
+			inode->i_gid = sbi->s_gid;
 	}
 	/* Now set final access rights if overriding rock ridge setting */
 	if (S_ISDIR(inode->i_mode) && sbi->s_overriderockperm &&
diff -puN fs/isofs/isofs.h~isofs-fix-setting-of-uid-and-gid-to-0 fs/isofs/isofs.h
--- a/fs/isofs/isofs.h~isofs-fix-setting-of-uid-and-gid-to-0
+++ a/fs/isofs/isofs.h
@@ -51,6 +51,8 @@ struct isofs_sb_info {
 	unsigned char s_hide;
 	unsigned char s_showassoc;
 	unsigned char s_overriderockperm;
+	unsigned char s_uid_set;
+	unsigned char s_gid_set;
 
 	mode_t s_fmode;
 	mode_t s_dmode;
_

Patches currently in -mm which might be from jack@xxxxxxx are

origin.patch
linux-next.patch
ext2-add-blk_issue_flush-to-syncing-paths.patch
ext2-do-not-update-mtime-of-a-moved-directory.patch
ext3-fix-chain-verification-in-ext3_get_blocks.patch
isofs-let-mode-and-dmode-mount-options-override-rock-ridge-mode-setting.patch
isofs-fix-setting-of-uid-and-gid-to-0.patch
isofs-cleanup-mount-option-processing.patch
reiser4-update-names-of-quota-methods.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux