[PATCH] NFSD: Checking whether kill_suid by should_remove_suid()

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

 



As local filesystem, writing data to the file by non-owner will
clears the SUID+SGID, owner will not.

Signed-off-by: Kinglong Mee <kinglongmee@xxxxxxxxx>
---
 fs/nfsd/vfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 16f0673..19c0931 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -943,7 +943,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh
*fhp, struct file *file,
 	fsnotify_modify(file);

 	/* clear setuid/setgid flag after write */
-	if (inode->i_mode & (S_ISUID | S_ISGID))
+	if (should_remove_suid(dentry))
 		kill_suid(dentry);

 	if (stable) {
-- 
1.9.0

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




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux