Skip to contentSkip to conversation

Introduction

PATCH New NeilBrown 1 participant 3 messages Jun 1, 2005

Subsystems (2)
lore
Share & tools
lore

NeilBrown

author
#0 lore raw

PATCH 1/1 Introduction

Hi,
here are two patches for 2.4, which appear to be too late for 2.4.31... The first fixes a small semantic problem.
The second adds some missing locking, that would only be a possible problem if using direct_io with xfs (I think).

NeilBrown

[PATCH kNFSd 001 of 2] Don't drop setuid on directories when ownership changed by NFSd [PATCH kNFSd 002 of 2] Claim i_alloc_sem while changing file size in nfsd

-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo! Search APIs Find out how you can build Yahoo! directly into your own Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

author
#1 lore raw

PATCH 1/1 Don't drop setuid on directories when ownership changed by NFSd

..as setuid means something totally different on directories.

### Diffstat output

 ./fs/nfsd/vfs.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
fs/nfsd/vfs.c renamed from fs/nfsd/vfs.c~current~ +8 -4
diff ./fs/nfsd/vfs.c~current~ ./fs/nfsd/vfs.c
@@ -280,13 +280,17 @@ nfsd_setattr(struct svc_rqst *rqstp, str
 	}
 
 	/* Revoke setuid/setgid bit on chown/chgrp */
-	if ((iap->ia_valid & ATTR_UID) && (imode & S_ISUID)
-	 && iap->ia_uid != inode->i_uid) {
+	if ((iap->ia_valid & ATTR_UID)
+	    && (imode & S_ISUID)
+	    && !S_ISDIR(imode)
+	    && iap->ia_uid != inode->i_uid) {
 		iap->ia_valid |= ATTR_MODE;
 		iap->ia_mode = imode &= ~S_ISUID;
 	}
-	if ((iap->ia_valid & ATTR_GID) && (imode & S_ISGID)
-	 && iap->ia_gid != inode->i_gid) {
+	if ((iap->ia_valid & ATTR_GID)
+	    && (imode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)
+	    && !S_ISDIR(imode)
+	    && iap->ia_gid != inode->i_gid) {
 		iap->ia_valid |= ATTR_MODE;
 		iap->ia_mode = imode &= ~S_ISGID;
 	}

-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo! Search APIs Find out how you can build Yahoo! directly into your own Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

author
#2 lore raw

PATCH 1/1 Claim i_alloc_sem while changing file size in nfsd

In reply to NeilBrown

nfsd should hold i_alloc_sem while calling notify_change with ATTR_SIZE set, just like do_truncate does.

From: Oleg Drokin <[email protected]>

### Diffstat output

 ./fs/nfsd/vfs.c |    2 ++
 1 files changed, 2 insertions(+)
fs/nfsd/vfs.c renamed from fs/nfsd/vfs.c~current~ +2 -0
diff ./fs/nfsd/vfs.c~current~ ./fs/nfsd/vfs.c
@@ -301,6 +301,7 @@ nfsd_setattr(struct svc_rqst *rqstp, str
 	iap->ia_valid |= ATTR_CTIME;
 
 	if (iap->ia_valid & ATTR_SIZE) {
+		down_write(&inode->i_alloc_sem);
 		fh_lock(fhp);
 		size_change = 1;
 	}
@@ -311,6 +312,7 @@ nfsd_setattr(struct svc_rqst *rqstp, str
 	}
 	if (size_change) {
 		fh_unlock(fhp);
+		up_write(&inode->i_alloc_sem);
 		put_write_access(inode);
 	}
 	if (!err)

### Diffstat output

 ./fs/nfsd/vfs.c |    2 ++
 1 files changed, 2 insertions(+)
fs/nfsd/vfs.c renamed from fs/nfsd/vfs.c~current~ +2 -0
diff ./fs/nfsd/vfs.c~current~ ./fs/nfsd/vfs.c
@@ -301,6 +301,7 @@ nfsd_setattr(struct svc_rqst *rqstp, str
 	iap->ia_valid |= ATTR_CTIME;
 
 	if (iap->ia_valid & ATTR_SIZE) {
+		down_write(&inode->i_alloc_sem);
 		fh_lock(fhp);
 		size_change = 1;
 	}
@@ -311,6 +312,7 @@ nfsd_setattr(struct svc_rqst *rqstp, str
 	}
 	if (size_change) {
 		fh_unlock(fhp);
+		up_write(&inode->i_alloc_sem);
 		put_write_access(inode);
 	}
 	if (!err)

-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo! Search APIs Find out how you can build Yahoo! directly into your own Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs